addContentLengthRequestHeader
protected void addContentLengthRequestHeader(HttpState state,
HttpConnection conn)
throws IOException,
HttpException
Adds a Content-Length request header, as long as no
Content-Length request header already exists.
state
- current state of http requestsconn
- the connection to use for I/O
HttpException
- if a protocol exception occurs. Usually protocol exceptions
cannot be recovered from.
addContentTypeRequestHeader
protected void addContentTypeRequestHeader(HttpState state,
HttpConnection conn)
throws IOException,
HttpException
Adds a Content-Type request header.
state
- current state of http requestsconn
- the connection to use for I/O
HttpException
- if a protocol exception occurs. Usually protocol exceptions
cannot be recovered from.
addParameter
public void addParameter(String parameterName,
File parameterFile)
throws FileNotFoundException
Adds a binary file part
parameterName
- The name of the parameterparameterFile
- The name of the file.
addParameter
public void addParameter(String parameterName,
String parameterValue)
Adds a text field part
parameterName
- The name of the parameter.parameterValue
- The value of the parameter.
addParameter
public void addParameter(String parameterName,
String fileName,
File parameterFile)
throws FileNotFoundException
Adds a binary file part with the given file name
parameterName
- The name of the parameterfileName
- The file nameparameterFile
- The file
addPart
public void addPart(Part part)
Adds a part.
addRequestHeaders
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 and
Content-Type
headers, when appropriate.
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.
- addRequestHeaders in interface ExpectContinueMethod
state
- the state
information associated with this methodconn
- the connection
used to execute
this HTTP method
HttpException
- if a protocol exception occurs. Usually protocol exceptions
cannot be recovered from.
getParts
public Part[] getParts()
Returns all parts.
- an array of containing all parts
getRequestContentLength
protected long getRequestContentLength()
throws IOException
Return the length of the request body.
Once this method has been invoked, the request parameters cannot be
altered until the method is
recycled
.
- The request content length.
recycle
public void recycle()
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.
- recycle in interface HttpMethod
- recycle in interface HttpMethodBase