org.apache.catalina.connector
Class RequestWrapper

java.lang.Object
  |
  +--org.apache.catalina.connector.RequestWrapper
All Implemented Interfaces:
Request
Direct Known Subclasses:
HttpRequestWrapper

public abstract class RequestWrapper
extends java.lang.Object
implements Request

Abstract convenience class that wraps a Catalina-internal Request object. By default, all methods are delegated to the wrapped request, but subclasses can override individual methods as required to provide the functionality that they require.

Version:
$Revision: 1.3 $ $Date: 2001/07/22 20:25:06 $
Author:
Craig R. McClanahan

Field Summary
protected  Request request
          The wrapped request.
 
Constructor Summary
RequestWrapper(Request request)
          Construct a wrapper for the specified request.
 
Method Summary
 javax.servlet.ServletInputStream createInputStream()
          Create and return a ServletInputStream to read the content associated with this Request.
 void finishRequest()
          Perform whatever actions are required to flush and close the input stream or reader, in a single operation.
 java.lang.String getAuthorization()
          Return the authorization credentials sent with this request.
 Connector getConnector()
          Return the Connector through which this Request was received.
 Context getContext()
          Return the Context within which this Request is being processed.
 java.lang.String getInfo()
          Return descriptive information about this Request implementation and the corresponding version number, in the format <description>/<version>.
 javax.servlet.ServletRequest getRequest()
          Return the ServletRequest for which this object is the facade.
 Response getResponse()
          Return the Response with which this Request is associated.
 java.net.Socket getSocket()
          Return the Socket (if any) through which this Request was received.
 java.io.InputStream getStream()
          Return the input stream associated with this Request.
 Request getWrappedRequest()
          Return the wrapped request.
 Wrapper getWrapper()
          Return the Wrapper within which this Request is being processed.
 void recycle()
          Release all object references, and initialize instance variables, in preparation for reuse of this object.
 void setAuthorization(java.lang.String authorization)
          Set the authorization credentials sent with this request.
 void setConnector(Connector connector)
          Set the Connector through which this Request was received.
 void setContentLength(int length)
          Set the content length associated with this Request.
 void setContentType(java.lang.String type)
          Set the content type (and optionally the character encoding) associated with this Request.
 void setContext(Context context)
          Set the Context within which this Request is being processed.
 void setProtocol(java.lang.String protocol)
          Set the protocol name and version associated with this Request.
 void setRemoteAddr(java.lang.String remote)
          Set the remote IP address associated with this Request.
 void setResponse(Response response)
          Set the Response with which this Request is associated.
 void setScheme(java.lang.String scheme)
          Set the name of the scheme associated with this request.
 void setSecure(boolean secure)
          Set the value to be returned by isSecure() for this Request.
 void setServerName(java.lang.String name)
          Set the name of the server (virtual host) to process this request.
 void setServerPort(int port)
          Set the port number of the server to process this request.
 void setSocket(java.net.Socket socket)
          Set the Socket (if any) through which this Request was received.
 void setStream(java.io.InputStream stream)
          Set the input stream associated with this Request.
 void setWrapper(Wrapper wrapper)
          Set the Wrapper within which this Request is being processed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.catalina.Request
getNote, getNoteNames, removeNote, setNote
 

Field Detail

request

protected Request request
The wrapped request.

Constructor Detail

RequestWrapper

public RequestWrapper(Request request)
Construct a wrapper for the specified request.

Parameters:
request - The request to be wrapped
Method Detail

getWrappedRequest

public Request getWrappedRequest()
Return the wrapped request.


getAuthorization

public java.lang.String getAuthorization()
Return the authorization credentials sent with this request.

Specified by:
getAuthorization in interface Request

setAuthorization

public void setAuthorization(java.lang.String authorization)
Set the authorization credentials sent with this request.

Specified by:
setAuthorization in interface Request
Parameters:
authorization - The new authorization credentials

getConnector

public Connector getConnector()
Return the Connector through which this Request was received.

Specified by:
getConnector in interface Request

setConnector

public void setConnector(Connector connector)
Set the Connector through which this Request was received.

Specified by:
setConnector in interface Request
Parameters:
connector - The new connector

getContext

public Context getContext()
Return the Context within which this Request is being processed.

Specified by:
getContext in interface Request

setContext

public void setContext(Context context)
Set the Context within which this Request is being processed. This must be called as soon as the appropriate Context is identified, because it identifies the value to be returned by getContextPath(), and thus enables parsing of the request URI.

Specified by:
setContext in interface Request
Parameters:
context - The newly associated Context

getInfo

public java.lang.String getInfo()
Return descriptive information about this Request implementation and the corresponding version number, in the format <description>/<version>.

Specified by:
getInfo in interface Request

getRequest

public javax.servlet.ServletRequest getRequest()
Return the ServletRequest for which this object is the facade.

Specified by:
getRequest in interface Request

getResponse

public Response getResponse()
Return the Response with which this Request is associated.

Specified by:
getResponse in interface Request

setResponse

public void setResponse(Response response)
Set the Response with which this Request is associated.

Specified by:
setResponse in interface Request
Parameters:
response - The new associated response

getSocket

public java.net.Socket getSocket()
Return the Socket (if any) through which this Request was received. This should only be used to access underlying state information about this Socket, such as the SSLSession associated with an SSLSocket.

Specified by:
getSocket in interface Request

setSocket

public void setSocket(java.net.Socket socket)
Set the Socket (if any) through which this Request was received.

Specified by:
setSocket in interface Request
Parameters:
socket - The socket through which this request was received

getStream

public java.io.InputStream getStream()
Return the input stream associated with this Request.

Specified by:
getStream in interface Request

setStream

public void setStream(java.io.InputStream stream)
Set the input stream associated with this Request.

Specified by:
setStream in interface Request
Parameters:
stream - The new input stream

getWrapper

public Wrapper getWrapper()
Return the Wrapper within which this Request is being processed.

Specified by:
getWrapper in interface Request

setWrapper

public void setWrapper(Wrapper wrapper)
Set the Wrapper within which this Request is being processed. This must be called as soon as the appropriate Wrapper is identified, and before the Request is ultimately passed to an application servlet.

Specified by:
setWrapper in interface Request
Parameters:
wrapper - The newly associated Wrapper

createInputStream

public javax.servlet.ServletInputStream createInputStream()
                                                   throws java.io.IOException
Create and return a ServletInputStream to read the content associated with this Request.

Specified by:
createInputStream in interface Request
Throws:
java.io.IOException - if an input/output error occurs

finishRequest

public void finishRequest()
                   throws java.io.IOException
Perform whatever actions are required to flush and close the input stream or reader, in a single operation.

Specified by:
finishRequest in interface Request
Throws:
java.io.IOException - if an input/output error occurs

recycle

public void recycle()
Release all object references, and initialize instance variables, in preparation for reuse of this object.

Specified by:
recycle in interface Request

setContentLength

public void setContentLength(int length)
Set the content length associated with this Request.

Specified by:
setContentLength in interface Request
Parameters:
length - The new content length

setContentType

public void setContentType(java.lang.String type)
Set the content type (and optionally the character encoding) associated with this Request. For example, text/html; charset=ISO-8859-4.

Specified by:
setContentType in interface Request
Parameters:
type - The new content type

setProtocol

public void setProtocol(java.lang.String protocol)
Set the protocol name and version associated with this Request.

Specified by:
setProtocol in interface Request
Parameters:
protocol - Protocol name and version

setRemoteAddr

public void setRemoteAddr(java.lang.String remote)
Set the remote IP address associated with this Request. NOTE: This value will be used to resolve the value for getRemoteHost() if that method is called.

Specified by:
setRemoteAddr in interface Request
Parameters:
remote - The remote IP address

setScheme

public void setScheme(java.lang.String scheme)
Set the name of the scheme associated with this request. Typical values are http, https, and ftp.

Specified by:
setScheme in interface Request
Parameters:
scheme - The scheme

setSecure

public void setSecure(boolean secure)
Set the value to be returned by isSecure() for this Request.

Specified by:
setSecure in interface Request
Parameters:
secure - The new isSecure value

setServerName

public void setServerName(java.lang.String name)
Set the name of the server (virtual host) to process this request.

Specified by:
setServerName in interface Request
Parameters:
name - The server name

setServerPort

public void setServerPort(int port)
Set the port number of the server to process this request.

Specified by:
setServerPort in interface Request
Parameters:
port - The server port


Copyright © 2000-2001 Apache Software Foundation. All Rights Reserved.