|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.httpclient.HttpMethodBase org.apache.commons.httpclient.methods.ExpectContinueMethod org.apache.commons.httpclient.methods.EntityEnclosingMethod
public abstract class EntityEnclosingMethod
This abstract class serves as a foundation for all HTTP methods that can enclose an entity within requests
Constructor Summary | |
---|---|
EntityEnclosingMethod()
No-arg constructor. |
|
EntityEnclosingMethod(String uri)
Constructor specifying a URI. |
Method Summary | |
---|---|
protected void |
addContentLengthRequestHeader(HttpState state,
HttpConnection conn)
Generates Content-Length or Transfer-Encoding: Chunked request header, as long as no Content-Length request header already exists. |
protected void |
addRequestHeaders(HttpState state,
HttpConnection conn)
Populates the request headers map to with additional headers to be submitted to
the given HttpConnection . |
protected void |
clearRequestBody()
Clears the request body. |
protected byte[] |
generateRequestBody()
Generates the request body. |
protected RequestEntity |
generateRequestEntity()
|
boolean |
getFollowRedirects()
Entity enclosing requests cannot be redirected without user intervention according to RFC 2616. |
String |
getRequestCharSet()
Returns the request's charset. |
protected long |
getRequestContentLength()
Returns the length of the request body. |
RequestEntity |
getRequestEntity()
|
protected boolean |
hasRequestContent()
Returns true if there is a request body to be sent. |
void |
setContentChunked(boolean chunked)
Sets whether or not the content should be chunked. |
void |
setFollowRedirects(boolean followRedirects)
Entity enclosing requests cannot be redirected without user intervention according to RFC 2616. |
void |
setRequestEntity(RequestEntity requestEntity)
|
protected boolean |
writeRequestBody(HttpState state,
HttpConnection conn)
Writes the request body to the given connection . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EntityEnclosingMethod()
public EntityEnclosingMethod(String uri)
uri
- either an absolute or relative URIMethod Detail |
---|
protected boolean hasRequestContent()
This method must be overridden by sub-classes that implement alternative request content input methods
hasRequestContent
in class ExpectContinueMethod
protected void clearRequestBody()
This method must be overridden by sub-classes that implement alternative request content input methods.
protected byte[] generateRequestBody()
This method must be overridden by sub-classes that implement alternative request content input methods.
protected RequestEntity generateRequestEntity()
public boolean getFollowRedirects()
getFollowRedirects
in interface HttpMethod
getFollowRedirects
in class HttpMethodBase
false
.public void setFollowRedirects(boolean followRedirects)
setFollowRedirects
in interface HttpMethod
setFollowRedirects
in class HttpMethodBase
followRedirects
- must always be false
public String getRequestCharSet()
getRequestCharSet
in class HttpMethodBase
RequestEntity.getContentType()
public void setContentChunked(boolean chunked)
chunked
- true
if the content should be chunkedprotected long getRequestContentLength()
protected void addRequestHeaders(HttpState state, HttpConnection conn) throws HttpException, IOException
headers
to be submitted to
the given HttpConnection
.
This implementation adds tt>Content-Length or Transfer-Encoding headers.
Subclasses may want to override this method to to add additional headers, and may choose to invoke this implementation (via super) to add the "standard" headers.
addRequestHeaders
in class ExpectContinueMethod
state
- the state
information associated with this methodconn
- the connection
used to execute
this HTTP method
IOException
HttpException
HttpMethodBase.writeRequestHeaders(org.apache.commons.httpclient.HttpState, org.apache.commons.httpclient.HttpConnection)
protected void addContentLengthRequestHeader(HttpState state, HttpConnection conn) throws IOException, HttpException
state
- current state of http requestsconn
- the connection to use for I/O
IOException
- when errors occur reading or writing to/from the
connection
HttpException
- when a recoverable error occursprotected boolean writeRequestBody(HttpState state, HttpConnection conn) throws IOException
connection
.
writeRequestBody
in class HttpMethodBase
state
- the state
information associated with this methodconn
- the connection
used to execute
this HTTP method
IOException
public RequestEntity getRequestEntity()
public void setRequestEntity(RequestEntity requestEntity)
requestEntity
- The requestEntity to set.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |