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

All Implemented Interfaces:
    HttpMethod

Direct Known Subclasses:
    NoncompliantPostMethod, UrlPostMethod

Implements the HTTP POST method.

The HTTP POST method is defined in section 9.5 of RFC2616:

The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions:
  • Annotation of existing resources
  • Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles
  • Providing a block of data, such as the result of submitting a form, to a data-handling process
  • Extending a database through an append operation

Field Summary
public static final  String FORM_URL_ENCODED_CONTENT_TYPE    The Content-Type for www-form-urlencoded. 
Fields inherited from org.apache.commons.httpclient.methods.EntityEnclosingMethod:
CONTENT_LENGTH_AUTO,  CONTENT_LENGTH_CHUNKED
Fields inherited from org.apache.commons.httpclient.HttpMethodBase:
statusLine,  effectiveVersion
Constructor:
 public PostMethod() 
 public PostMethod(String uri) 
    Constructor specifying a URI.
    Parameters:
    uri - either an absolute or relative URI
    since: 1.0 -
Method from org.apache.commons.httpclient.methods.PostMethod Summary:
addParameter,   addParameter,   addParameters,   clearRequestBody,   generateRequestEntity,   getName,   getParameter,   getParameters,   hasRequestContent,   removeParameter,   removeParameter,   setParameter,   setRequestBody
Methods from org.apache.commons.httpclient.methods.EntityEnclosingMethod:
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.PostMethod Detail:
 public  void addParameter(NameValuePair param) throws IllegalArgumentException 
    Adds a new parameter to be used in the POST request body.
 public  void addParameter(String paramName,
    String paramValue) throws IllegalArgumentException 
    Adds a new parameter to be used in the POST request body.
 public  void addParameters(NameValuePair[] parameters) 
    Adds an array of parameters to be used in the POST request body. Logs a warning if the parameters argument is null.
 protected  void clearRequestBody() 
    Clears request body.

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

 protected RequestEntity generateRequestEntity() 
 public String getName() 
    Returns "POST".
 public NameValuePair getParameter(String paramName) 
    Gets the parameter of the specified name. If there exists more than one parameter with the name paramName, then only the first one is returned.
 public NameValuePair[] getParameters() 
    Gets the parameters currently added to the PostMethod. If there are no parameters, a valid array is returned with zero elements. The returned array object contains an array of pointers to the internal data members.
 protected boolean hasRequestContent() 
    Returns true if there is a request body to be sent.

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

 public boolean removeParameter(String paramName) throws IllegalArgumentException 
    Removes all parameters with the given paramName. If there is more than one parameter with the given paramName, all of them are removed. If there is just one, it is removed. If there are none, then the request is ignored.
 public boolean removeParameter(String paramName,
    String paramValue) throws IllegalArgumentException 
    Removes all parameter with the given paramName and paramValue. If there is more than one parameter with the given paramName, only one is removed. If there are none, then the request is ignored.
 public  void setParameter(String parameterName,
    String parameterValue) 
    Sets the value of parameter with parameterName to parameterValue. This method does not preserve the initial insertion order.
 public  void setRequestBody(NameValuePair[] parametersBody) throws IllegalArgumentException 
    Sets an array of parameters to be used in the POST request body