|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A request to be applied to an HttpConnection
, and a container for the
associated response.
Method Summary | |
void |
addRequestHeader(Header header)
Adds the specified request header, NOT overwriting any previous value. |
void |
addRequestHeader(String headerName,
String headerValue)
Adds the specified request header, NOT overwriting any previous value. |
void |
addResponseFooter(Header footer)
Use this method internally to add footers. |
int |
execute(HttpState state,
HttpConnection connection)
Execute this method. |
boolean |
getDoAuthentication()
Whether or not I should automatically process responses where authentication is required (status code 401, etc.) |
boolean |
getFollowRedirects()
Whether or not I should automatically follow HTTP redirects (status code 302, etc.) |
HostConfiguration |
getHostConfiguration()
Gets the host configuration for this method. |
String |
getName()
Obtain the name of this method, suitable for use in the "request line", for example "GET" or "POST". |
String |
getPath()
Get the path part of my request. |
String |
getQueryString()
Get my query string. |
Header |
getRequestHeader(String headerName)
Get the request header associated with the given name. |
Header[] |
getRequestHeaders()
Return an array of my request headers. |
byte[] |
getResponseBody()
Return my response body, if any, as a byte array. |
InputStream |
getResponseBodyAsStream()
Return my response body, if any, as an InputStream . |
String |
getResponseBodyAsString()
Return my response body, if any, as a String . |
Header |
getResponseFooter(String footerName)
Return the specified response footer. |
Header[] |
getResponseFooters()
Return an array of my response footers |
Header |
getResponseHeader(String headerName)
Return the specified response header. |
Header[] |
getResponseHeaders()
Return an array of my response headers. |
int |
getStatusCode()
Return the status code associated with the latest response. |
StatusLine |
getStatusLine()
Return the Status-Line from the response. |
String |
getStatusText()
Return the status text (or "reason phrase") associated with the latest response. |
URI |
getURI()
Gets the URI for this method. |
boolean |
hasBeenUsed()
Return true if I have been executed
but not recycled. |
boolean |
isStrictMode()
Returns the value of strictMode. |
void |
recycle()
Recycle this method so that it can be used again. |
void |
releaseConnection()
Releases the connection being used by this method. |
void |
removeRequestHeader(String headerName)
Remove all request headers associated with the given name. |
void |
setDoAuthentication(boolean doAuthentication)
Set whether or not I should automatically process responses where authentication is required (status code 401, etc.) |
void |
setFollowRedirects(boolean followRedirects)
Set whether or not I should automatically follow HTTP redirects (status code 302, etc.) |
void |
setPath(String path)
Set the path part of my request. |
void |
setQueryString(NameValuePair[] params)
Set my query string. |
void |
setQueryString(String queryString)
Set my query string. |
void |
setRequestHeader(Header header)
Set the specified request header, overwriting any previous value. |
void |
setRequestHeader(String headerName,
String headerValue)
Set the specified request header, overwriting any previous value. |
void |
setStrictMode(boolean strictMode)
Turns strict mode on or off. |
boolean |
validate()
Confirm that I am ready to execute. |
Method Detail |
public String getName()
public HostConfiguration getHostConfiguration()
null
if none is setpublic void setPath(String path)
path
- the path to requestpublic String getPath()
public URI getURI() throws URIException
public void setStrictMode(boolean strictMode)
Turns strict mode on or off. In strict mode (the default) we following the letter of RFC 2616, the Http 1.1 specification. If strict mode is turned off we attempt to violate the specification in the same way that most Http user agent's do (and many HTTP servers expect.
NOTE: StrictMode is currently experimental and its functionaity may change in the future.
strictMode
- True to enable strict mode.public boolean isStrictMode()
public void setRequestHeader(String headerName, String headerValue)
headerName
- the header's nameheaderValue
- the header's valuepublic void setRequestHeader(Header header)
header
- the headerpublic void addRequestHeader(String headerName, String headerValue)
headerName
- the header's nameheaderValue
- the header's valuepublic void addRequestHeader(Header header)
header
- the headerpublic Header getRequestHeader(String headerName)
headerName
- the header namepublic void removeRequestHeader(String headerName)
headerName
- the header namepublic boolean getFollowRedirects()
public void setFollowRedirects(boolean followRedirects)
followRedirects
- True if I should automatically follow redirects.public void setQueryString(String queryString)
queryString
- the query stringpublic void setQueryString(NameValuePair[] params)
params
- an array of NameValuePair
s
to add as query string parametersspublic String getQueryString()
public Header[] getRequestHeaders()
public boolean validate()
public int getStatusCode()
public String getStatusText()
public Header[] getResponseHeaders()
public Header getResponseHeader(String headerName)
headerName
- The name of the header to be returned.public Header[] getResponseFooters()
public Header getResponseFooter(String footerName)
footerName
- The name of the footer.public byte[] getResponseBody()
public String getResponseBodyAsString()
String
. Otherwise return
null.public InputStream getResponseBodyAsStream() throws IOException
InputStream
. Otherwise
return null.public boolean hasBeenUsed()
executed
but not recycled.public int execute(HttpState state, HttpConnection connection) throws HttpException, IOException
state
- state information to associate with this requestconnection
- the HttpConnection
to write to/read frompublic void recycle()
public void releaseConnection()
public void addResponseFooter(Header footer)
footer
- The footer to add.public StatusLine getStatusLine()
public boolean getDoAuthentication()
public void setDoAuthentication(boolean doAuthentication)
doAuthentication
- true to process authentications
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |