Save This Page
Home » commons-httpclient-3.1-src » org.apache.commons » httpclient » methods » [javadoc | source]
org.apache.commons.httpclient.methods
abstract public class: EntityEnclosingMethod [javadoc | source]
java.lang.Object
   org.apache.commons.httpclient.HttpMethodBase
      org.apache.commons.httpclient.methods.ExpectContinueMethod
         org.apache.commons.httpclient.methods.EntityEnclosingMethod

All Implemented Interfaces:
    HttpMethod

Direct Known Subclasses:
    PutMethod, NoncompliantPostMethod, PostMethod, UrlPostMethod, UrlPutMethod

This abstract class serves as a foundation for all HTTP methods that can enclose an entity within requests
Field Summary
public static final  long CONTENT_LENGTH_AUTO    The content length will be calculated automatically. This implies buffering of the content.
     
    public static final  long CONTENT_LENGTH_CHUNKED    The request will use chunked transfer encoding. Content length is not calculated and the content is not buffered.
       
      Fields inherited from org.apache.commons.httpclient.HttpMethodBase:
      statusLine,  effectiveVersion
      Constructor:
       public EntityEnclosingMethod() 
       public EntityEnclosingMethod(String uri) 
        Constructor specifying a URI.
        Parameters:
        uri - either an absolute or relative URI
        since: 2.0 -
      Method from org.apache.commons.httpclient.methods.EntityEnclosingMethod Summary:
      addContentLengthRequestHeader,   addRequestHeaders,   clearRequestBody,   generateRequestBody,   generateRequestEntity,   getFollowRedirects,   getRequestCharSet,   getRequestContentLength,   getRequestEntity,   hasRequestContent,   recycle,   setContentChunked,   setFollowRedirects,   setRequestBody,   setRequestBody,   setRequestContentLength,   setRequestContentLength,   setRequestEntity,   writeRequestBody
      Methods from org.apache.commons.httpclient.methods.ExpectContinueMethod:
      addRequestHeaders,   getUseExpectHeader,   hasRequestContent,   setUseExpectHeader
      Methods from org.apache.commons.httpclient.HttpMethodBase:
      abort,   addCookieRequestHeader,   addHostRequestHeader,   addProxyConnectionHeader,   addRequestHeader,   addRequestHeader,   addRequestHeaders,   addResponseFooter,   addUserAgentRequestHeader,   checkNotUsed,   checkUsed,   execute,   fakeResponse,   generateRequestLine,   getAuthenticationRealm,   getContentCharSet,   getDoAuthentication,   getEffectiveVersion,   getFollowRedirects,   getHostAuthState,   getHostConfiguration,   getMethodRetryHandler,   getName,   getParams,   getPath,   getProxyAuthState,   getProxyAuthenticationRealm,   getQueryString,   getRecoverableExceptionCount,   getRequestCharSet,   getRequestHeader,   getRequestHeaderGroup,   getRequestHeaders,   getRequestHeaders,   getResponseBody,   getResponseBody,   getResponseBodyAsStream,   getResponseBodyAsString,   getResponseBodyAsString,   getResponseCharSet,   getResponseContentLength,   getResponseFooter,   getResponseFooters,   getResponseHeader,   getResponseHeaderGroup,   getResponseHeaders,   getResponseHeaders,   getResponseStream,   getResponseTrailerHeaderGroup,   getStatusCode,   getStatusLine,   getStatusText,   getURI,   hasBeenUsed,   isAborted,   isConnectionCloseForced,   isHttp11,   isRequestSent,   isStrictMode,   processCookieHeaders,   processResponseBody,   processResponseHeaders,   processStatusLine,   readResponse,   readResponseBody,   readResponseHeaders,   readStatusLine,   recycle,   releaseConnection,   removeRequestHeader,   removeRequestHeader,   responseBodyConsumed,   setConnectionCloseForced,   setDoAuthentication,   setFollowRedirects,   setHostConfiguration,   setHttp11,   setMethodRetryHandler,   setParams,   setPath,   setQueryString,   setQueryString,   setRequestHeader,   setRequestHeader,   setResponseStream,   setStrictMode,   setURI,   shouldCloseConnection,   validate,   writeRequest,   writeRequestBody,   writeRequestHeaders,   writeRequestLine
      Methods from java.lang.Object:
      equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
      Method from org.apache.commons.httpclient.methods.EntityEnclosingMethod Detail:
       protected  void addContentLengthRequestHeader(HttpState state,
          HttpConnection conn) throws IOException, HttpException 
        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) throws IOException, HttpException 
        Populates the request headers map to with additional 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.

       protected  void clearRequestBody() 
        Clears the request body.

        This method must be overridden by sub-classes that implement alternative request content input methods.

       protected byte[] generateRequestBody() 
        Generates the request body.

        This method must be overridden by sub-classes that implement alternative request content input methods.

       protected RequestEntity generateRequestEntity() 
       public boolean getFollowRedirects() 
        Entity enclosing requests cannot be redirected without user intervention according to RFC 2616.
       public 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.
       protected long getRequestContentLength() 
        Returns the length of the request body.
       public RequestEntity getRequestEntity() 
       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

       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.
       public  void setContentChunked(boolean chunked) 
        Sets whether or not the content should be chunked.
       public  void setFollowRedirects(boolean followRedirects) 
        Entity enclosing requests cannot be redirected without user intervention according to RFC 2616.
       public  void setRequestBody(InputStream body) 
      Deprecated! use - #setRequestEntity(RequestEntity)

        Sets the request body to be the specified inputstream.
       public  void setRequestBody(String body) 
      Deprecated! use - #setRequestEntity(RequestEntity)

        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 content encoding is used (ISO-8859-1).
       public  void setRequestContentLength(int length) 
      Deprecated! Use - #setContentChunked(boolean) or #setRequestEntity(RequestEntity)

        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.

       public  void setRequestContentLength(long length) 
      Deprecated! Use - #setContentChunked(boolean) or #setRequestEntity(RequestEntity)

        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.

       public  void setRequestEntity(RequestEntity requestEntity) 
       protected boolean writeRequestBody(HttpState state,
          HttpConnection conn) throws IOException, HttpException