org.codegist.crest.io.http
Interface HttpChannel


public interface HttpChannel

HTTP abstraction layer

Author:
Laurent Gilles (laurent.gilles@codegist.org)

Nested Class Summary
static interface HttpChannel.Response
          HTTP Chanel's response
 
Method Summary
 void addHeader(String name, String value)
          Adds a new HTTP header
 HttpChannel.Response send()
          Sends the HTTP request.
 void setAccept(String value)
          Sets the HTTP Accept header
 void setConnectionTimeout(int timeout)
          Sets the connection timeout
 void setContentType(String value)
          Sets the HTTP Content-Type header
 void setHeader(String name, String value)
          Sets a HTTP header, overriding any existing one
 void setSocketTimeout(int timeout)
          Sets the socket timeout
 void writeEntityWith(org.codegist.crest.io.http.HttpEntityWriter httpEntityWriter)
          Sets the HTTP entity writer to use
 

Method Detail

setSocketTimeout

void setSocketTimeout(int timeout)
                      throws IOException
Sets the socket timeout

Parameters:
timeout - the socket timeout
Throws:
IOException

setConnectionTimeout

void setConnectionTimeout(int timeout)
                          throws IOException
Sets the connection timeout

Parameters:
timeout - the connection timeout
Throws:
IOException

addHeader

void addHeader(String name,
               String value)
               throws IOException
Adds a new HTTP header

Parameters:
name - the HTTP header name
value - the HTTP header value
Throws:
IOException

setHeader

void setHeader(String name,
               String value)
               throws IOException
Sets a HTTP header, overriding any existing one

Parameters:
name - the HTTP header name
value - the HTTP header value
Throws:
IOException

setContentType

void setContentType(String value)
                    throws IOException
Sets the HTTP Content-Type header

Parameters:
value - the HTTP Content-Type header value
Throws:
IOException

setAccept

void setAccept(String value)
               throws IOException
Sets the HTTP Accept header

Parameters:
value - the HTTP Accept header value
Throws:
IOException

writeEntityWith

void writeEntityWith(org.codegist.crest.io.http.HttpEntityWriter httpEntityWriter)
                     throws IOException
Sets the HTTP entity writer to use

Parameters:
httpEntityWriter - the HTTP entity writer to use
Throws:
IOException

send

HttpChannel.Response send()
                          throws IOException
Sends the HTTP request. Once called, no other calls can be made to the HTTP channel instance

Returns:
the HTTP response
Throws:
IOException


Copyright © 2011. All Rights Reserved.