Groovy Documentation

org.vertx.groovy.core.http
[Groovy] Class HttpClientResponse

java.lang.Object
  org.vertx.groovy.core.http.HttpClientResponse
All Implemented Interfaces:
ReadStream

class HttpClientResponse

Represents a client-side HTTP response.

An instance of this class is provided to the user via a handler that was specified when one of the HTTP method operations, or the generic HttpClient#request(String, String, Closure)#request(String, String, Closure) method was called on an instance of HttpClient.

It implements ReadStream so it can be used with Pump to pump data with flow control.

Instances of this class are not thread-safe

Authors:
Tim Fox


Constructor Summary
protected HttpClientResponse(HttpClientResponse jResponse)

 
Method Summary
void bodyHandler(groovy.lang.Closure bodyHandler)

Convenience method for receiving the entire request body in one piece.

void dataHandler(groovy.lang.Closure dataHandler)

{@inheritDoc}

void endHandler(groovy.lang.Closure endHandler)

{@inheritDoc}

void exceptionHandler(groovy.lang.Closure exceptionHandler)

{@inheritDoc}

java.util.Map getHeaders()

@return The headers of the response

int getStatusCode()

@return The HTTP status code of the response

java.lang.String getStatusMessage()

@return The HTTP status message of the response

java.util.Map getTrailers()

@return The trailers of the response

void pause()

{@inheritDoc}

void resume()

{@inheritDoc}

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

HttpClientResponse

protected HttpClientResponse(HttpClientResponse jResponse)


 
Method Detail

bodyHandler

void bodyHandler(groovy.lang.Closure bodyHandler)
Convenience method for receiving the entire request body in one piece. This saves the user having to manually set a data and end handler and append the chunks of the body until the whole body received.

Don't use this if your request body is large - you could potentially run out of RAM.

Parameters:
bodyHandler - This handler will be called after all the body has been received


dataHandler

void dataHandler(groovy.lang.Closure dataHandler)
{@inheritDoc}


endHandler

void endHandler(groovy.lang.Closure endHandler)
{@inheritDoc}


exceptionHandler

void exceptionHandler(groovy.lang.Closure exceptionHandler)
{@inheritDoc}


getHeaders

java.util.Map getHeaders()
Returns:
The headers of the response


getStatusCode

int getStatusCode()
Returns:
The HTTP status code of the response


getStatusMessage

java.lang.String getStatusMessage()
Returns:
The HTTP status message of the response


getTrailers

java.util.Map getTrailers()
Returns:
The trailers of the response


pause

void pause()
{@inheritDoc}


resume

void resume()
{@inheritDoc}


 

Groovy Documentation