|
|||||||||
| 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 PostMethod

java.lang.Objectorg.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:
- org.apache.commons.httpclient.HttpMethod
- Direct Known Subclasses:
- UrlPostMethod
- public class PostMethod
- extends EntityEnclosingMethod
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
- Since:
- 1.0
- Version:
- $Revision: 155418 $
| Field Summary | |
static java.lang.String |
FORM_URL_ENCODED_CONTENT_TYPE
The Content-Type for www-form-urlencoded. |
private static org.apache.commons.logging.Log |
LOG
Log object for this class. |
private java.util.Vector |
params
The buffered request body consisting of NameValuePairs. |
| Fields inherited from class org.apache.commons.httpclient.methods.EntityEnclosingMethod |
CONTENT_LENGTH_AUTO, CONTENT_LENGTH_CHUNKED |
| Fields inherited from class org.apache.commons.httpclient.HttpMethodBase |
|
| Constructor Summary | |
PostMethod()
No-arg constructor. |
|
PostMethod(java.lang.String uri)
Constructor specifying a URI. |
|
| Method Summary | |
void |
addParameter(org.apache.commons.httpclient.NameValuePair param)
Adds a new parameter to be used in the POST request body. |
void |
addParameter(java.lang.String paramName,
java.lang.String paramValue)
Adds a new parameter to be used in the POST request body. |
void |
addParameters(org.apache.commons.httpclient.NameValuePair[] parameters)
Adds an array of parameters to be used in the POST request body. |
protected void |
clearRequestBody()
Clears request body. |
protected RequestEntity |
generateRequestEntity()
Generates a request entity from the post parameters, if present. |
java.lang.String |
getName()
Returns "POST". |
org.apache.commons.httpclient.NameValuePair |
getParameter(java.lang.String paramName)
Gets the parameter of the specified name. |
org.apache.commons.httpclient.NameValuePair[] |
getParameters()
Gets the parameters currently added to the PostMethod. |
protected boolean |
hasRequestContent()
Returns true if there is a request body to be sent. |
boolean |
removeParameter(java.lang.String paramName)
Removes all parameters with the given paramName. |
boolean |
removeParameter(java.lang.String paramName,
java.lang.String paramValue)
Removes all parameter with the given paramName and paramValue. |
void |
setParameter(java.lang.String parameterName,
java.lang.String parameterValue)
Sets the value of parameter with parameterName to parameterValue. |
void |
setRequestBody(org.apache.commons.httpclient.NameValuePair[] parametersBody)
Sets an array of parameters to be used in the POST request body |
| Methods inherited from class org.apache.commons.httpclient.methods.EntityEnclosingMethod |
addContentLengthRequestHeader, addRequestHeaders, generateRequestBody, getFollowRedirects, getRequestCharSet, getRequestContentLength, getRequestEntity, recycle, setContentChunked, setFollowRedirects, setRequestBody, setRequestBody, setRequestContentLength, setRequestContentLength, setRequestEntity, writeRequestBody |
| 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 |
LOG
private static final org.apache.commons.logging.Log LOG
- Log object for this class.
FORM_URL_ENCODED_CONTENT_TYPE
public static final java.lang.String FORM_URL_ENCODED_CONTENT_TYPE
- The Content-Type for www-form-urlencoded.
- See Also:
- Constant Field Values
params
private java.util.Vector params
- The buffered request body consisting of
NameValuePairs.
| Constructor Detail |
PostMethod
public PostMethod()
- No-arg constructor.
- Since:
- 1.0
PostMethod
public PostMethod(java.lang.String uri)
- Constructor specifying a URI.
- Since:
- 1.0
| Method Detail |
getName
public java.lang.String getName()
- Returns "POST".
- Since:
- 2.0
hasRequestContent
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
- Overrides:
hasRequestContentin classEntityEnclosingMethod
- Since:
- 2.0beta1
clearRequestBody
protected void clearRequestBody()
- Clears request body.
This method must be overwritten by sub-classes that implement alternative request content input methods
- Overrides:
clearRequestBodyin classEntityEnclosingMethod
- Since:
- 2.0beta1
generateRequestEntity
protected RequestEntity generateRequestEntity()
- Generates a request entity from the post parameters, if present. Calls
EntityEnclosingMethod.generateRequestBody()55 if parameters have not been set.- Overrides:
generateRequestEntityin classEntityEnclosingMethod
- Since:
- 3.0
setParameter
public void setParameter(java.lang.String parameterName, java.lang.String parameterValue)
- Sets the value of parameter with parameterName to parameterValue. This method
does not preserve the initial insertion order.
- Since:
- 2.0
getParameter
public org.apache.commons.httpclient.NameValuePair getParameter(java.lang.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.
- Since:
- 2.0
getParameters
public org.apache.commons.httpclient.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.
- Since:
- 2.0
addParameter
public void addParameter(java.lang.String paramName, java.lang.String paramValue) throws java.lang.IllegalArgumentException
- Adds a new parameter to be used in the POST request body.
- Since:
- 1.0
addParameter
public void addParameter(org.apache.commons.httpclient.NameValuePair param) throws java.lang.IllegalArgumentException
- Adds a new parameter to be used in the POST request body.
- Since:
- 2.0
addParameters
public void addParameters(org.apache.commons.httpclient.NameValuePair[] parameters)
- Adds an array of parameters to be used in the POST request body. Logs a
warning if the parameters argument is null.
- Since:
- 2.0
removeParameter
public boolean removeParameter(java.lang.String paramName) throws java.lang.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.
- Since:
- 2.0
removeParameter
public boolean removeParameter(java.lang.String paramName, java.lang.String paramValue) throws java.lang.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.
- Since:
- 2.0
setRequestBody
public void setRequestBody(org.apache.commons.httpclient.NameValuePair[] parametersBody) throws java.lang.IllegalArgumentException
- Sets an array of parameters to be used in the POST request body
- Since:
- 2.0beta1
|
|||||||||
| 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