com.cafesoft.cams.agent.http
Interface CamsHttpAgentRequest

All Known Implementing Classes:
AbstractCamsHttpAgentRequest

public interface CamsHttpAgentRequest

Defines an interface that normalizes a container-specific HTTP request into an HTTP container-independent form that can be used by a Cafesoft HttpAccessControlAgent.

Since:
1/22/02

Method Summary
 void addHeader(String name, String value)
          Adds the specified header and value to this HttpRequest.
 void destroy()
          Destroy the CamsHttpAgentRequest.
 javax.servlet.http.Cookie[] getCookies(HttpCookieFilter filter)
          Returns an array containing all of the Cookie objects the client sent with this request.
 String getHeader(String name)
          Returns the value of the specified request header as a String.
 Enumeration getHeaderNames()
          Returns an enumeration of all the header names this request contains.
 Enumeration getHeaders(String name)
          Returns all the values of the specified request header as an Enumeration of String objects.
 String getMethod()
          Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
 String getParameter(String name)
          Returns the value mapped to the specified parameter.
 Enumeration getParameterNames()
          Returns all of the Http parameters.
 String getProtocol()
          Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.
 String getQueryString()
          Returns the query string that is contained in the request URL after the path.
 String getRemoteAddr()
          Returns the Internet Protocol (IP) address of the client that sent the request.
 String getRemoteHost()
          Returns the fully qualified name of the client that sent the request.
 String getRequestURI()
          Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.
 String getRequestURL()
          Reconstructs the URL the client used to make the request.
 String getScheme()
          Returns the name of the scheme used to make this request.
 String getServerAddr()
          Returns the IP address of the server where the CamsHttpAgent is running.
 String getServerName()
          Returns the host name of the server that received the request.
 int getServerPort()
          Returns the port number on which this request was received.
 SessionId getSessionId()
          Returns the session id if one exists.
 boolean isLogin()
          Determines if this Http request is for logging in.
 boolean isLogout()
          Determines if this Http request is for logging out.
 boolean isSecure()
          Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.
 void log()
          Logs the data contained in this CamsHttpAgentRequest.
 void recycle()
          Recycle the CamsHttpAgentRequest for reuse.
 void setSessionId(SessionId sessionId)
          Sets the session id.
 void validateHeaders()
          Validate the request headers.
 

Method Detail

getParameter

public String getParameter(String name)
Returns the value mapped to the specified parameter.

Parameters:
name - the name of the parameter
Returns:
the value mapped to the specified parameter

getParameterNames

public Enumeration getParameterNames()
Returns all of the Http parameters.

Returns:
all of the Http parameter names

addHeader

public void addHeader(String name,
                      String value)
Adds the specified header and value to this HttpRequest.

Parameters:
name - the name of the header
value - the value of the header

validateHeaders

public void validateHeaders()
                     throws CamsHttpAgentException
Validate the request headers.

Throws:
CamsHttpAgentException - if any header name starts with the prefix CAMS_. The message of the exception is the name of the request header that was invalid.

getRemoteAddr

public String getRemoteAddr()
Returns the Internet Protocol (IP) address of the client that sent the request.

Returns:
a String containing the IP address of the client that sent the request

getRemoteHost

public String getRemoteHost()
Returns the fully qualified name of the client that sent the request. If the hostname cannot be resolved, this method returns the dotted-string form of the IP address.

Returns:
a String containing the fully qualified name of the client

getProtocol

public String getProtocol()
Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1. For HTTP servlets, the value returned is the same as the value of the CGI variable SERVER_PROTOCOL.

Returns:
a String containing the protocol name and version number

getScheme

public String getScheme()
Returns the name of the scheme used to make this request.

Returns:
the scheme. For example, http or https.

getServerName

public String getServerName()
Returns the host name of the server that received the request.


getServerAddr

public String getServerAddr()
Returns the IP address of the server where the CamsHttpAgent is running.

Returns:
the server's IP address as a String

getServerPort

public int getServerPort()
Returns the port number on which this request was received.


isSecure

public boolean isSecure()
Returns a boolean indicating whether this request was made using a secure channel, such as HTTPS.


getMethod

public String getMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. Same as the value of the CGI variable REQUEST_METHOD.

Returns:
a String specifying the name of the method with which this request was made

getQueryString

public String getQueryString()
Returns the query string that is contained in the request URL after the path. This method returns if the URL does not have a query string. Same as the value of the CGI variable QUERY_STRING.

Returns:
a String containing the query string or null if the URL contains no query string. The value is not decoded by the container.

getRequestURI

public String getRequestURI()
Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request. The web container does not decode this String. For example: First line of HTTP request Returned Value POST /some/path.html HTTP/1.1 returns: /some/path.html GET http://foo.bar/a.html HTTP/1.0 returns: /a.html HEAD /xyz?a=b HTTP/1.1 returns: /xyz

Returns:
a String containing the part of the URL from the protocol name up to the query string

getRequestURL

public String getRequestURL()
Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.

Returns:
a String containing the reconstructed URL

getCookies

public javax.servlet.http.Cookie[] getCookies(HttpCookieFilter filter)
Returns an array containing all of the Cookie objects the client sent with this request. This method returns null if no cookies were sent.

Returns:
an array of all the Cookies included with this request, or null if the request has no cookies.

getHeader

public String getHeader(String name)
Returns the value of the specified request header as a String. If the request did not include a header of the specified name, this method returns null. The header name is case insensitive. You can use this method with any request header.

Parameters:
name - a String specifying the header name.
Returns:
a String containing the value of the requested header, or null if the request does not have a header of that name

getHeaders

public Enumeration getHeaders(String name)
Returns all the values of the specified request header as an Enumeration of String objects.

Some headers, such as Accept-Language can be sent by clients as several headers each with a different value rather than sending the header as a comma separated list.

If the request did not include any headers of the specified name, this method returns an empty Enumeration. The header name is case insensitive. You can use this method with any request header.

Parameters:
name - a String specifying the header name
Returns:
an Enumeration containing the values of the requested header. If the request does not have any headers of that name return an empty enumeration. If the container does not allow access to header information, return null

getHeaderNames

public Enumeration getHeaderNames()
Returns an enumeration of all the header names this request contains. If the request has no headers, this method returns an empty enumeration. Some HTTP containers do not allow do not allow access to headers using this method, in which case this method returns null

Returns:
an enumeration of all the header names sent with this request; if the request has no headers, an empty enumeration; if the HTTP container does not allow access to headers in this way, return null.

getSessionId

public SessionId getSessionId()
Returns the session id if one exists.

Returns:
the session id or null if one is not set

setSessionId

public void setSessionId(SessionId sessionId)
Sets the session id.

Parameters:
sessionId - the session id or null if one is not set

isLogin

public boolean isLogin()
Determines if this Http request is for logging in.

Returns:
true if this Http request is for logging in, false otherwise

isLogout

public boolean isLogout()
Determines if this Http request is for logging out.

Returns:
true if this Http request is for logging out, false otherwise

log

public void log()
Logs the data contained in this CamsHttpAgentRequest.


recycle

public void recycle()
Recycle the CamsHttpAgentRequest for reuse.

This method will return the CamsHttpAgentRequest object back to it's original creation state. That means any underlying collections should be cleared and not destroyed.


destroy

public void destroy()
Destroy the CamsHttpAgentRequest.

This method will destroy the CamsHttpAgentRequest object. This method should be used when the CamsHttpAgentRequest will no longer be used. This method should destroy everything including underlying collections.



Generated on 10:40:31 AM September 10, 2003, © 1996-2003 Cafésoft LLC. All rights reserved.