Provides a set of accessor functions to fetch the individual fields of the HTTP request.
Utility methods that are generically useful for manipulating HTTP requests are included here as well. An instance of this class is passed to handlers. There will be exactly one request object per thead at any time.
The fields {@link #headers}, {@link #query}, and {@link #url}, and the method {@link #getQueryData()}are most often used to examine the content of the request. The field {@link #props}contains information about the server, or up-stream handlers.
The methods {@link #sendResponse(String,String,int)} and{@link Request#sendError(int,String)}are commonly used to return content to the client. The methods {@link #addHeader(String)} and{@link #setStatus(int)} can be used to modify the response headersand return code respectively before the response is sent.
Many of the other methods are used internally, but can be useful to handlers that need finer control over the output that the above methods provide. Note that the order of the methods is important. For instance, the user cannot change the HTTP response headers (by calling the addHeader
method or by modifying the responseHeaders
field) after having already sent an HTTP response.
A number of the fields in the Request
object are public, by design. Many of the methods are convenience methods; the underlying data fields are meant to be accessed for more complicated operations, such as changing the URL or deleting HTTP response headers.
@see Handler
@see Server
@author Stephen Uhler (stephen.uhler@sun.com)
@author Colin Stevens (colin.stevens@sun.com)
@version 2.6
|
|