net.grinder.plugin.http
Class HTTPRequest

java.lang.Object
  extended by net.grinder.plugin.http.HTTPRequest

public class HTTPRequest
extends Object

An individual HTTP request for use in scripts.

Scripts can set default values for the URL, headers, and data. There are several overloaded methods corresponding to each HTTP method (GET, POST, ...) that allow specific values to override the defaults.

WARNING: The default values set with the various set methods, and apply to all users of the HTTPRequest. If a worker thread needs to set a thread specific value, it should either use its own HTTPRequest, or not use the defaults and pass the value as an argument to the HTTP method.

Streaming

There are variants of POST, PUT, and OPTIONS that accept an input stream, so an arbitrarily large amount of data can be sent without requiring a corresponding amount of memory. The streaming behaviour will vary depending on the version of HTTP in use and whether a Content-Length header has been supplied - please refer to the HttpOutputStream class Javadoc for full details. If you are streaming output to avoid loading complete request messages into memory, you may also want to use setReadResponseBody(boolean) to disable the reading of response bodies, and managed them yourself.

Author:
Philip Aston

Constructor Summary
HTTPRequest()
          Creates a new HTTPRequest instance.
 
Method Summary
 HTTPResponse DELETE()
          Makes an HTTP DELETE request.
 HTTPResponse DELETE(String uri)
          Makes an HTTP DELETE request.
 HTTPResponse DELETE(String uri, NVPair[] headers)
          Makes an HTTP DELETE request.
 HTTPResponse GET()
          Makes an HTTP GET request.
 HTTPResponse GET(NVPair[] queryData)
          Makes an HTTP GET request.
 HTTPResponse GET(String uri)
          Makes an HTTP GET request.
 HTTPResponse GET(String uri, NVPair[] queryData)
          Makes an HTTP GET request.
 HTTPResponse GET(String uri, NVPair[] queryData, NVPair[] headers)
          Makes an HTTP GET request.
 byte[] getData()
          Gets the default data.
 NVPair[] getFormData()
          Gets the default form data.
 NVPair[] getHeaders()
          Gets the default headers.
protected  PluginProcessContext getPluginProcessContext()
          Provide subclasses access to the process context.
 boolean getReadResponseBody()
          Return whether or not the whole response body will be read.
 String getUrl()
          Gets the default URL.
 HTTPResponse HEAD()
          Makes an HTTP HEAD request.
 HTTPResponse HEAD(NVPair[] queryData)
          Makes an HTTP HEAD request.
 HTTPResponse HEAD(String uri)
          Makes an HTTP HEAD request.
 HTTPResponse HEAD(String uri, NVPair[] queryData)
          Makes an HTTP HEAD request.
 HTTPResponse HEAD(String uri, NVPair[] queryData, NVPair[] headers)
          Makes an HTTP HEAD request.
 HTTPResponse OPTIONS()
          Makes an HTTP OPTIONS request.
 HTTPResponse OPTIONS(String uri)
          Makes an HTTP OPTIONS request.
 HTTPResponse OPTIONS(String uri, byte[] data)
          Makes an HTTP OPTIONS request.
 HTTPResponse OPTIONS(String uri, byte[] data, NVPair[] headers)
          Makes an HTTP OPTIONS request.
 HTTPResponse OPTIONS(String uri, InputStream inputStream)
          Makes an HTTP OPTIONS request.
 HTTPResponse OPTIONS(String uri, InputStream inputStream, NVPair[] headers)
          Makes an HTTP OPTIONS request.
 HTTPResponse POST()
          Makes an HTTP POST request.
 HTTPResponse POST(NVPair[] formData)
          Makes an HTTP POST request.
 HTTPResponse POST(String uri)
          Makes an HTTP POST request.
 HTTPResponse POST(String uri, byte[] data)
          Makes an HTTP POST request.
 HTTPResponse POST(String uri, byte[] data, NVPair[] headers)
          Makes an HTTP POST request.
 HTTPResponse POST(String uri, InputStream inputStream)
          Makes an HTTP POST request.
 HTTPResponse POST(String uri, InputStream inputStream, NVPair[] headers)
          Makes an HTTP POST request.
 HTTPResponse POST(String uri, NVPair[] formData)
          Makes an HTTP POST request.
 HTTPResponse POST(String uri, NVPair[] formData, NVPair[] headers)
          Makes an HTTP POST request.
protected  void processResponse(HTTPResponse response)
          Subclasses of HTTPRequest that wish to post-process responses should override this method.
 HTTPResponse PUT()
          Makes an HTTP PUT request.
 HTTPResponse PUT(String uri)
          Makes an HTTP PUT request.
 HTTPResponse PUT(String uri, byte[] data)
          Makes an HTTP PUT request.
 HTTPResponse PUT(String uri, byte[] data, NVPair[] headers)
          Makes an HTTP PUT request.
 HTTPResponse PUT(String uri, InputStream inputStream)
          Makes an HTTP PUT request.
 HTTPResponse PUT(String uri, InputStream inputStream, NVPair[] headers)
          Makes an HTTP PUT request.
 void setData(byte[] data)
          Sets the default data.
 byte[] setDataFromFile(String filename)
          Sets the default data from a file.
 void setFormData(NVPair[] formData)
          Sets the default form data.
 void setHeaders(NVPair[] headers)
          Sets the default headers.
 void setReadResponseBody(boolean b)
          Set whether or not the whole response body will be read.
 void setUrl(String url)
          Sets the default URL.
 String toString()
          Returns a string representation of the object and URL headers.
 HTTPResponse TRACE()
          Makes an HTTP TRACE request.
 HTTPResponse TRACE(String uri)
          Makes an HTTP TRACE request.
 HTTPResponse TRACE(String uri, NVPair[] headers)
          Makes an HTTP TRACE request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HTTPRequest

public HTTPRequest()
Creates a new HTTPRequest instance.

Method Detail

getUrl

public final String getUrl()
Gets the default URL.

Returns:
The default URL to be used for this request, or null if the default URL has not been set.

setUrl

public final void setUrl(String url)
                  throws ParseException,
                         URLException
Sets the default URL. The value given must be an absolute URL, including protocol and the server information.

See the warning above regarding thread safety. Multiple worker threads that need to set a specific URL should either not share the same HTTPRequest, or pass the URL as an argument to the call to the HTTP method.

Parameters:
url - The URL to be used for this request.
Throws:
ParseException - If the URL cannot be parsed.
URLException - If the URL is not absolute.

getHeaders

public final NVPair[] getHeaders()
Gets the default headers.

Returns:
The default headers to be used for this request.

setHeaders

public final void setHeaders(NVPair[] headers)
Sets the default headers.

See the warning above regarding thread safety. Multiple worker threads that need to set specific headers should either not share the same HTTPRequest, or pass the headers as an argument to the call to the HTTP method.

Parameters:
headers - The default headers to be used for this request.

toString

public String toString()
Returns a string representation of the object and URL headers.

Overrides:
toString in class Object
Returns:
a string representation of the object

getData

public final byte[] getData()
Gets the default data.

Returns:
The default data to be used for this request.

setData

public final void setData(byte[] data)
Sets the default data.

See the warning above regarding thread safety. Multiple worker threads that need to set specific data should either not share the same HTTPRequest, or pass the data as an argument to the call to POST, or PUT.

Parameters:
data - The default data to be used for this request.

setDataFromFile

public final byte[] setDataFromFile(String filename)
                             throws IOException
Sets the default data from a file.

See the warning above regarding thread safety. Multiple worker threads that need to set specific data should either not share the same HTTPRequest, or pass the data as an argument to the call to POST, or PUT. If the later is done, this method can still be used to read data from a file.

Parameters:
filename - Path name of data file.
Returns:
The data read from the file.
Throws:
IOException - If the file could not be read.

getFormData

public final NVPair[] getFormData()
Gets the default form data.

Returns:
The default form or query data to be used for this request.

setFormData

public final void setFormData(NVPair[] formData)
Sets the default form data.

Parameters:
formData - The default form or query data to be used for this request.

getReadResponseBody

public boolean getReadResponseBody()
Return whether or not the whole response body will be read.

Returns:
true => The response body will be read.
See Also:
setReadResponseBody(boolean)

setReadResponseBody

public void setReadResponseBody(boolean b)
Set whether or not the whole response body will be read.

If true, the response body will be read during one of the HTTP method operations (GET, PUT, ...). Otherwise, the response body will not be read. Most users will want to leave this set to its default value of true.

If set to false, the response body stream will be available for reading from the HTTPResponse.getInputStream(), and the following effects will be observed for the test statistics:

  1. The time taken to read the body will not included in the recorded test time.
  2. The response body length will be recorded as 0.

If desired, the caller could manually update the statistics by extending HTTPRequest and implementing processResponse(HTTPClient.HTTPResponse) as follows:

   final PluginProcessContext pluginProcessContext =
     getPluginProcessContext();

   final HTTPPluginThreadState threadState =
     (HTTPPluginThreadState)pluginProcessContext.getPluginThreadListener();

   final PluginThreadContext threadContext = threadState.getThreadContext();

   threadContext.resumeClock();
   final int bodyLength = ... // Read body from HTTPResponse.
   threadContext.pauseClock();

   final StatisticsForTest testStatistics = statistics.getForCurrentTest();
   testStatistics.addLong(
     StatisticsIndexMap.HTTP_PLUGIN_RESPONSE_LENGTH_KEY, bodyLength);

 

Parameters:
b - true => The response body will be read.

DELETE

public final HTTPResponse DELETE()
                          throws Exception
Makes an HTTP DELETE request.

Returns:
Contains details of the servers response.
Throws:
Exception - If an error occurs.

DELETE

public final HTTPResponse DELETE(String uri)
                          throws Exception
Makes an HTTP DELETE request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

DELETE

public final HTTPResponse DELETE(String uri,
                                 NVPair[] headers)
                          throws Exception
Makes an HTTP DELETE request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
headers - Request headers. Overrides headers with matching names set by setHeaders(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

GET

public final HTTPResponse GET()
                       throws Exception
Makes an HTTP GET request.

Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

GET

public final HTTPResponse GET(String uri)
                       throws Exception
Makes an HTTP GET request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

GET

public final HTTPResponse GET(NVPair[] queryData)
                       throws Exception
Makes an HTTP GET request.

Parameters:
queryData - Request headers. Replaces all the values set by setFormData(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

GET

public final HTTPResponse GET(String uri,
                              NVPair[] queryData)
                       throws Exception
Makes an HTTP GET request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
queryData - Request headers. Replaces all the values set by setFormData(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

GET

public final HTTPResponse GET(String uri,
                              NVPair[] queryData,
                              NVPair[] headers)
                       throws Exception
Makes an HTTP GET request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
queryData - Request headers. Replaces all the values set by setFormData(HTTPClient.NVPair[]).
headers - Request headers. Overrides headers with matching names set by setHeaders(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

HEAD

public final HTTPResponse HEAD()
                        throws Exception
Makes an HTTP HEAD request.

Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

HEAD

public final HTTPResponse HEAD(String uri)
                        throws Exception
Makes an HTTP HEAD request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

HEAD

public final HTTPResponse HEAD(NVPair[] queryData)
                        throws Exception
Makes an HTTP HEAD request.

Parameters:
queryData - Request headers. Replaces all the values set by setFormData(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

HEAD

public final HTTPResponse HEAD(String uri,
                               NVPair[] queryData)
                        throws Exception
Makes an HTTP HEAD request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
queryData - Request headers. Replaces all the values set by setFormData(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

HEAD

public final HTTPResponse HEAD(String uri,
                               NVPair[] queryData,
                               NVPair[] headers)
                        throws Exception
Makes an HTTP HEAD request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
queryData - Request headers. Replaces all the values set by setFormData(HTTPClient.NVPair[]).
headers - Request headers. Overrides headers with matching names set by setHeaders(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

OPTIONS

public final HTTPResponse OPTIONS()
                           throws Exception
Makes an HTTP OPTIONS request.

Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

OPTIONS

public final HTTPResponse OPTIONS(String uri)
                           throws Exception
Makes an HTTP OPTIONS request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

OPTIONS

public final HTTPResponse OPTIONS(String uri,
                                  byte[] data)
                           throws Exception
Makes an HTTP OPTIONS request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
data - Data to be submitted in the body of the request. Overrides the value set with setData(byte[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

OPTIONS

public final HTTPResponse OPTIONS(String uri,
                                  byte[] data,
                                  NVPair[] headers)
                           throws Exception
Makes an HTTP OPTIONS request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
data - Data to be submitted in the body of the request. Overrides the value set with setData(byte[]).
headers - Request headers. Overrides headers with matching names set by setHeaders(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

OPTIONS

public final HTTPResponse OPTIONS(String uri,
                                  InputStream inputStream)
                           throws Exception
Makes an HTTP OPTIONS request. This version allows the data to be passed as a stream, see the note in the class description.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
inputStream - Data to be submitted in the body of the request. This stream will be fully read and closed when the method is called. The value set with setData(byte[]) is ignored.
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

OPTIONS

public final HTTPResponse OPTIONS(String uri,
                                  InputStream inputStream,
                                  NVPair[] headers)
                           throws Exception
Makes an HTTP OPTIONS request. This version allows the data to be passed as a stream, see the note in the class description.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
inputStream - Data to be submitted in the body of the request. This stream will be fully read and closed when the method is called. The value set with setData(byte[]) is ignored.
headers - Request headers. Overrides headers with matching names set by setHeaders(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

POST

public final HTTPResponse POST()
                        throws Exception
Makes an HTTP POST request.

Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

POST

public final HTTPResponse POST(String uri)
                        throws Exception
Makes an HTTP POST request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

POST

public final HTTPResponse POST(NVPair[] formData)
                        throws Exception
Makes an HTTP POST request.

Parameters:
formData - Data to be submitted as an application/x-www-form-urlencoded encoded request body.
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

POST

public final HTTPResponse POST(String uri,
                               NVPair[] formData)
                        throws Exception
Makes an HTTP POST request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
formData - Data to be submitted as an application/x-www-form-urlencoded encoded request body.
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

POST

public final HTTPResponse POST(String uri,
                               NVPair[] formData,
                               NVPair[] headers)
                        throws Exception
Makes an HTTP POST request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
formData - Data to be submitted as an application/x-www-form-urlencoded encoded request body.
headers - Request headers. Overrides headers with matching names set by setHeaders(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

POST

public final HTTPResponse POST(String uri,
                               byte[] data)
                        throws Exception
Makes an HTTP POST request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
data - Data to be submitted in the body of the request. Overrides the value set with setData(byte[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

POST

public final HTTPResponse POST(String uri,
                               byte[] data,
                               NVPair[] headers)
                        throws Exception
Makes an HTTP POST request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
data - Data to be submitted in the body of the request. Overrides the value set with setData(byte[]).
headers - Request headers. Overrides headers with matching names set by setHeaders(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

POST

public final HTTPResponse POST(String uri,
                               InputStream inputStream)
                        throws Exception
Makes an HTTP POST request. This version allows the data to be passed as a stream, see the note in the class description.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
inputStream - Data to be submitted in the body of the request. This stream will be fully read and closed when the method is called. The value set with setData(byte[]) is ignored.
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

POST

public final HTTPResponse POST(String uri,
                               InputStream inputStream,
                               NVPair[] headers)
                        throws Exception
Makes an HTTP POST request. This version allows the data to be passed as a stream, see the note in the class description.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
inputStream - Data to be submitted in the body of the request. This stream will be fully read and closed when the method is called. The value set with setData(byte[]) is ignored.
headers - Request headers. Overrides headers with matching names set by setHeaders(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

PUT

public final HTTPResponse PUT()
                       throws Exception
Makes an HTTP PUT request.

Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

PUT

public final HTTPResponse PUT(String uri)
                       throws Exception
Makes an HTTP PUT request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

PUT

public final HTTPResponse PUT(String uri,
                              byte[] data)
                       throws Exception
Makes an HTTP PUT request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
data - Data to be submitted in the body of the request. Overrides the value set with setData(byte[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

PUT

public final HTTPResponse PUT(String uri,
                              byte[] data,
                              NVPair[] headers)
                       throws Exception
Makes an HTTP PUT request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
data - Data to be submitted in the body of the request. Overrides the value set with setData(byte[]).
headers - Request headers. Overrides headers with matching names set by setHeaders(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

PUT

public final HTTPResponse PUT(String uri,
                              InputStream inputStream)
                       throws Exception
Makes an HTTP PUT request. This version allows the data to be passed as a stream, see the note in the class description.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
inputStream - Data to be submitted in the body of the request. This stream will be fully read and closed when the method is called. The value set with setData(byte[]) is ignored.
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

PUT

public final HTTPResponse PUT(String uri,
                              InputStream inputStream,
                              NVPair[] headers)
                       throws Exception
Makes an HTTP PUT request. This version allows the data to be passed as a stream, see the note in the class description.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
inputStream - Data to be submitted in the body of the request. This stream will be fully read and closed when the method is called. The value set with setData(byte[]) is ignored.
headers - Request headers. Overrides headers with matching names set by setHeaders(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

TRACE

public final HTTPResponse TRACE()
                         throws Exception
Makes an HTTP TRACE request.

Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

TRACE

public final HTTPResponse TRACE(String uri)
                         throws Exception
Makes an HTTP TRACE request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

TRACE

public final HTTPResponse TRACE(String uri,
                                NVPair[] headers)
                         throws Exception
Makes an HTTP TRACE request.

Parameters:
uri - The URI. If a default URL has been specified with setUrl(java.lang.String), this value need not be absolute and, if relative, it will be resolved relative to the default URL. Otherwise this value must be an absolute URL.
headers - Request headers. Overrides headers with matching names set by setHeaders(HTTPClient.NVPair[]).
Returns:
Contains details of the server's response.
Throws:
Exception - If an error occurs.

processResponse

protected void processResponse(HTTPResponse response)
Subclasses of HTTPRequest that wish to post-process responses should override this method.

Parameters:
response - The response.

getPluginProcessContext

protected PluginProcessContext getPluginProcessContext()
Provide subclasses access to the process context.

Returns:
The process context.