addParameter
public void addParameter(String paramName,
String paramValue)
throws IllegalArgumentException
Adds a new parameter to be used in the POST request body.
paramName
- The parameter name to add.paramValue
- The parameter value to add.
addParameter
public void addParameter(NameValuePair param)
throws IllegalArgumentException
Adds a new parameter to be used in the POST request body.
param
- The parameter to add.
addParameters
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.
parameters
- The array of parameters to add.
clearRequestBody
protected void clearRequestBody()
Clears request body.
This method must be overwritten by sub-classes that implement
alternative request content input methods
- clearRequestBody in interface EntityEnclosingMethod
getParameter
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.
paramName
- name of the parameter
- If a parameter exists with the name argument, the coresponding
NameValuePair is returned. Otherwise null.
getParameters
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.
- An array of the current parameters
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
- hasRequestContent in interface EntityEnclosingMethod
removeParameter
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.
paramName
- The parameter name to remove.
- true if at least one parameter was removed
removeParameter
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.
paramName
- The parameter name to remove.paramValue
- The parameter value to remove.
- true if a parameter was removed.
setParameter
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.
parameterName
- name of the parameterparameterValue
- value of the parameter
setRequestBody
public void setRequestBody(NameValuePair[] parametersBody)
throws IllegalArgumentException
Sets an array of parameters to be used in the POST request body
parametersBody
- The array of parameters to add.