|
|||||||||
| Home >> All >> org >> apache >> commons >> httpclient >> [ methods overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.commons.httpclient.methods
Class EntityEnclosingMethod

java.lang.Objectorg.apache.commons.httpclient.HttpMethodBase
org.apache.commons.httpclient.methods.ExpectContinueMethod
org.apache.commons.httpclient.methods.EntityEnclosingMethod
- All Implemented Interfaces:
- org.apache.commons.httpclient.HttpMethod
- Direct Known Subclasses:
- PostMethod, PutMethod
- public abstract class EntityEnclosingMethod
- extends ExpectContinueMethod
This abstract class serves as a foundation for all HTTP methods that can enclose an entity within requests
- Since:
- 2.0beta1
- Version:
- $Revision: 161963 $
| Field Summary | |
private boolean |
chunked
|
static long |
CONTENT_LENGTH_AUTO
Deprecated. Use InputStreamRequestEntity.CONTENT_LENGTH_AUTO 55 . |
static long |
CONTENT_LENGTH_CHUNKED
Deprecated. Use setContentChunked(boolean) 55 . |
private static org.apache.commons.logging.Log |
LOG
LOG object for this class. |
private int |
repeatCount
Counts how often the request was sent to the server. |
private long |
requestContentLength
Deprecated. |
private RequestEntity |
requestEntity
|
private java.io.InputStream |
requestStream
The unbuffered request body, if any. |
private java.lang.String |
requestString
The request body as string, if any. |
| Fields inherited from class org.apache.commons.httpclient.HttpMethodBase |
|
| Constructor Summary | |
EntityEnclosingMethod()
No-arg constructor. |
|
EntityEnclosingMethod(java.lang.String uri)
Constructor specifying a URI. |
|
| Method Summary | |
protected void |
addContentLengthRequestHeader(org.apache.commons.httpclient.HttpState state,
org.apache.commons.httpclient.HttpConnection conn)
Generates Content-Length or Transfer-Encoding: Chunked request header, as long as no Content-Length request header already exists. |
protected void |
addRequestHeaders(org.apache.commons.httpclient.HttpState state,
org.apache.commons.httpclient.HttpConnection conn)
Populates the request headers map to with additional headers to be submitted to the given org.apache.commons.httpclient.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. |
java.lang.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 |
recycle()
Deprecated. no longer supported and will be removed in the future version of HttpClient |
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 |
setRequestBody(java.io.InputStream body)
Deprecated. use setRequestEntity(RequestEntity) 55 |
void |
setRequestBody(java.lang.String body)
Deprecated. use setRequestEntity(RequestEntity) 55 |
void |
setRequestContentLength(int length)
Deprecated. Use setContentChunked(boolean) 55 or
setRequestEntity(RequestEntity) 55 |
void |
setRequestContentLength(long length)
Deprecated. Use setContentChunked(boolean) 55 or
setRequestEntity(RequestEntity) 55 |
void |
setRequestEntity(RequestEntity requestEntity)
|
protected boolean |
writeRequestBody(org.apache.commons.httpclient.HttpState state,
org.apache.commons.httpclient.HttpConnection conn)
Writes the request body to the given connection. |
| Methods inherited from class org.apache.commons.httpclient.methods.ExpectContinueMethod |
getUseExpectHeader, setUseExpectHeader |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
CONTENT_LENGTH_AUTO
public static final long CONTENT_LENGTH_AUTO
- Deprecated. Use
InputStreamRequestEntity.CONTENT_LENGTH_AUTO55 .- The content length will be calculated automatically. This implies buffering of the content.
- See Also:
- Constant Field Values
- The content length will be calculated automatically. This implies buffering of the content.
CONTENT_LENGTH_CHUNKED
public static final long CONTENT_LENGTH_CHUNKED
- Deprecated. Use
setContentChunked(boolean)55 .- The request will use chunked transfer encoding. Content length is not calculated and the content is not buffered.
- See Also:
- Constant Field Values
- The request will use chunked transfer encoding. Content length is not calculated and the content is not buffered.
LOG
private static final org.apache.commons.logging.Log LOG
- LOG object for this class.
requestStream
private java.io.InputStream requestStream
- The unbuffered request body, if any.
requestString
private java.lang.String requestString
- The request body as string, if any.
requestEntity
private RequestEntity requestEntity
repeatCount
private int repeatCount
- Counts how often the request was sent to the server.
requestContentLength
private long requestContentLength
- Deprecated.
- The content length of the
requestBodyStreamor one ofCONTENT_LENGTH_AUTOandCONTENT_LENGTH_CHUNKED. - The content length of the
chunked
private boolean chunked
| Constructor Detail |
EntityEnclosingMethod
public EntityEnclosingMethod()
- No-arg constructor.
- Since:
- 2.0
EntityEnclosingMethod
public EntityEnclosingMethod(java.lang.String uri)
- Constructor specifying a URI.
- Since:
- 2.0
| Method Detail |
hasRequestContent
protected boolean hasRequestContent()
- Returns true if there is a request body to be sent.
This method must be overridden by sub-classes that implement alternative request content input methods
- Specified by:
hasRequestContentin classExpectContinueMethod
- Since:
- 2.0beta1
clearRequestBody
protected void clearRequestBody()
- Clears the request body.
This method must be overridden by sub-classes that implement alternative request content input methods.
- Since:
- 2.0beta1
generateRequestBody
protected byte[] generateRequestBody()
- Generates the request body.
This method must be overridden by sub-classes that implement alternative request content input methods.
- Since:
- 2.0beta1
generateRequestEntity
protected RequestEntity generateRequestEntity()
getFollowRedirects
public boolean getFollowRedirects()
- Entity enclosing requests cannot be redirected without user intervention
according to RFC 2616.
- Since:
- 2.0
setFollowRedirects
public void setFollowRedirects(boolean followRedirects)
- Entity enclosing requests cannot be redirected without user intervention
according to RFC 2616.
setRequestContentLength
public void setRequestContentLength(int length)
- Deprecated. Use
setContentChunked(boolean)55 orsetRequestEntity(RequestEntity)55- Sets length information about the request body.
Note: If you specify a content length the request is unbuffered. This prevents redirection and automatic retry if a request fails the first time. This means that the HttpClient can not perform authorization automatically but will throw an Exception. You will have to set the necessary 'Authorization' or 'Proxy-Authorization' headers manually.
- Sets length information about the request body.
getRequestCharSet
public java.lang.String getRequestCharSet()
- Returns the request's charset. The charset is parsed from the request entity's
content type, unless the content type header has been set manually.
- Since:
- 3.0
setRequestContentLength
public void setRequestContentLength(long length)
- Deprecated. Use
setContentChunked(boolean)55 orsetRequestEntity(RequestEntity)55- Sets length information about the request body.
Note: If you specify a content length the request is unbuffered. This prevents redirection and automatic retry if a request fails the first time. This means that the HttpClient can not perform authorization automatically but will throw an Exception. You will have to set the necessary 'Authorization' or 'Proxy-Authorization' headers manually.
- Sets length information about the request body.
setContentChunked
public void setContentChunked(boolean chunked)
- Sets whether or not the content should be chunked.
- Since:
- 3.0
getRequestContentLength
protected long getRequestContentLength()
- Returns the length of the request body.
addRequestHeaders
protected void addRequestHeaders(org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn) throws java.io.IOException, org.apache.commons.httpclient.HttpException
- Populates the request headers map to with additional
headers to be submitted to
the given org.apache.commons.httpclient.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.
- Overrides:
addRequestHeadersin classExpectContinueMethod
- Since:
- 3.0
addContentLengthRequestHeader
protected void addContentLengthRequestHeader(org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn) throws java.io.IOException, org.apache.commons.httpclient.HttpException
- Generates Content-Length or Transfer-Encoding: Chunked
request header, as long as no Content-Length request header
already exists.
setRequestBody
public void setRequestBody(java.io.InputStream body)
- Deprecated. use
setRequestEntity(RequestEntity)55- Sets the request body to be the specified inputstream.
- Sets the request body to be the specified inputstream.
setRequestBody
public void setRequestBody(java.lang.String body)
- Deprecated. use
setRequestEntity(RequestEntity)55- Sets the request body to be the specified string. The string will be submitted, using the encoding specified in the Content-Type request header.
Example:setRequestHeader("Content-type", "text/xml; charset=UTF-8");
Would use the UTF-8 encoding. If no charset is specified, the default 55 content encoding is used (ISO-8859-1). - Sets the request body to be the specified string. The string will be submitted, using the encoding specified in the Content-Type request header.
writeRequestBody
protected boolean writeRequestBody(org.apache.commons.httpclient.HttpState state, org.apache.commons.httpclient.HttpConnection conn) throws java.io.IOException, org.apache.commons.httpclient.HttpException
- Writes the request body to the given connection.
recycle
public void recycle()
- Deprecated. no longer supported and will be removed in the future
version of HttpClient
- Recycles the HTTP method so that it can be used again. Note that all of the instance variables will be reset once this method has been called. This method will also release the connection being used by this HTTP method.
- Recycles the HTTP method so that it can be used again. Note that all of the instance variables will be reset once this method has been called. This method will also release the connection being used by this HTTP method.
getRequestEntity
public RequestEntity getRequestEntity()
- Since:
- 3.0
setRequestEntity
public void setRequestEntity(RequestEntity requestEntity)
- Since:
- 3.0
|
|||||||||
| Home >> All >> org >> apache >> commons >> httpclient >> [ methods overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC