Class PostMethod
- 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
@Deprecated public class PostMethod extends EntityEnclosingMethod
Deprecated.Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project. It is not recommended to use it in any new code. Instead, use HTTP client API plugins as a dependency in your code. E.g. Apache HttpComponents Client API 4.x Plugin or Async HTTP Client Plugin.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
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FORM_URL_ENCODED_CONTENT_TYPE
Deprecated.The Content-Type for www-form-urlencoded.-
Fields inherited from class org.apache.commons.httpclient.methods.EntityEnclosingMethod
CONTENT_LENGTH_AUTO, CONTENT_LENGTH_CHUNKED
-
-
Constructor Summary
Constructors Constructor Description PostMethod()
Deprecated.No-arg constructor.PostMethod(java.lang.String uri)
Deprecated.Constructor specifying a URI.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addParameter(java.lang.String paramName, java.lang.String paramValue)
Deprecated.Adds a new parameter to be used in the POST request body.void
addParameter(NameValuePair param)
Deprecated.Adds a new parameter to be used in the POST request body.void
addParameters(NameValuePair[] parameters)
Deprecated.Adds an array of parameters to be used in the POST request body.java.lang.String
getName()
Deprecated.Returns "POST".NameValuePair
getParameter(java.lang.String paramName)
Deprecated.Gets the parameter of the specified name.NameValuePair[]
getParameters()
Deprecated.Gets the parameters currently added to the PostMethod.boolean
removeParameter(java.lang.String paramName)
Deprecated.Removes all parameters with the given paramName.boolean
removeParameter(java.lang.String paramName, java.lang.String paramValue)
Deprecated.Removes all parameter with the given paramName and paramValue.void
setParameter(java.lang.String parameterName, java.lang.String parameterValue)
Deprecated.Sets the value of parameter with parameterName to parameterValue.void
setRequestBody(NameValuePair[] parametersBody)
Deprecated.Sets an array of parameters to be used in the POST request body-
Methods inherited from class org.apache.commons.httpclient.methods.EntityEnclosingMethod
getFollowRedirects, getRequestCharSet, getRequestEntity, recycle, setContentChunked, setFollowRedirects, setRequestBody, setRequestBody, setRequestContentLength, setRequestContentLength, setRequestEntity
-
Methods inherited from class org.apache.commons.httpclient.methods.ExpectContinueMethod
getUseExpectHeader, setUseExpectHeader
-
Methods inherited from class org.apache.commons.httpclient.HttpMethodBase
abort, addRequestHeader, addRequestHeader, addResponseFooter, execute, getAuthenticationRealm, getDoAuthentication, getEffectiveVersion, getHostAuthState, getHostConfiguration, getMethodRetryHandler, getParams, getPath, getProxyAuthenticationRealm, getProxyAuthState, getQueryString, getRecoverableExceptionCount, getRequestHeader, getRequestHeaders, getRequestHeaders, getResponseBody, getResponseBody, getResponseBodyAsStream, getResponseBodyAsString, getResponseBodyAsString, getResponseCharSet, getResponseContentLength, getResponseFooter, getResponseFooters, getResponseHeader, getResponseHeaders, getResponseHeaders, getStatusCode, getStatusLine, getStatusText, getURI, hasBeenUsed, isAborted, isHttp11, isRequestSent, isStrictMode, releaseConnection, removeRequestHeader, removeRequestHeader, setDoAuthentication, setHostConfiguration, setHttp11, setMethodRetryHandler, setParams, setPath, setQueryString, setQueryString, setRequestHeader, setRequestHeader, setStrictMode, setURI, validate
-
-
-
-
Field Detail
-
FORM_URL_ENCODED_CONTENT_TYPE
public static final java.lang.String FORM_URL_ENCODED_CONTENT_TYPE
Deprecated.The Content-Type for www-form-urlencoded.- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
public java.lang.String getName()
Deprecated.Returns "POST".- Specified by:
getName
in interfaceHttpMethod
- Specified by:
getName
in classHttpMethodBase
- Returns:
- "POST"
- Since:
- 2.0
-
setParameter
public void setParameter(java.lang.String parameterName, java.lang.String parameterValue)
Deprecated.Sets the value of parameter with parameterName to parameterValue. This method does not preserve the initial insertion order.- Parameters:
parameterName
- name of the parameterparameterValue
- value of the parameter- Since:
- 2.0
-
getParameter
public NameValuePair getParameter(java.lang.String paramName)
Deprecated.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.- Parameters:
paramName
- name of the parameter- Returns:
- If a parameter exists with the name argument, the coresponding NameValuePair is returned. Otherwise null.
- Since:
- 2.0
-
getParameters
public NameValuePair[] getParameters()
Deprecated.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.- Returns:
- An array of the current parameters
- Since:
- 2.0
-
addParameter
public void addParameter(java.lang.String paramName, java.lang.String paramValue) throws java.lang.IllegalArgumentException
Deprecated.Adds a new parameter to be used in the POST request body.- Parameters:
paramName
- The parameter name to add.paramValue
- The parameter value to add.- Throws:
java.lang.IllegalArgumentException
- if either argument is null- Since:
- 1.0
-
addParameter
public void addParameter(NameValuePair param) throws java.lang.IllegalArgumentException
Deprecated.Adds a new parameter to be used in the POST request body.- Parameters:
param
- The parameter to add.- Throws:
java.lang.IllegalArgumentException
- if the argument is null or contains null values- Since:
- 2.0
-
addParameters
public void addParameters(NameValuePair[] parameters)
Deprecated.Adds an array of parameters to be used in the POST request body. Logs a warning if the parameters argument is null.- Parameters:
parameters
- The array of parameters to add.- Since:
- 2.0
-
removeParameter
public boolean removeParameter(java.lang.String paramName) throws java.lang.IllegalArgumentException
Deprecated.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.- Parameters:
paramName
- The parameter name to remove.- Returns:
- true if at least one parameter was removed
- Throws:
java.lang.IllegalArgumentException
- When the parameter name passed is null- Since:
- 2.0
-
removeParameter
public boolean removeParameter(java.lang.String paramName, java.lang.String paramValue) throws java.lang.IllegalArgumentException
Deprecated.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.- Parameters:
paramName
- The parameter name to remove.paramValue
- The parameter value to remove.- Returns:
- true if a parameter was removed.
- Throws:
java.lang.IllegalArgumentException
- when param name or value are null- Since:
- 2.0
-
setRequestBody
public void setRequestBody(NameValuePair[] parametersBody) throws java.lang.IllegalArgumentException
Deprecated.Sets an array of parameters to be used in the POST request body- Parameters:
parametersBody
- The array of parameters to add.- Throws:
java.lang.IllegalArgumentException
- when param parameters are null- Since:
- 2.0beta1
-
-