SilverStream
Application Server 3.5

com.sssw.srv.busobj
Class AgoCGIHeaders

java.lang.Object
 |
 +--com.sssw.srv.busobj.AgoCGIHeaders

public class AgoCGIHeaders
extends Object

Holds the headers of an HTTP request. You can look up the headers of an HTTP request. These are formatted following the CGI specification. The CGI variables are included as well as the headers in the HTTP request message. Headers are formatted according to CGI as follows:

The CGI variables supported are:

AUTH_TYPE
Set only if the user has logged in, this describes the method used to authenticate the user. It is set to one of SSL or HTTP Basic.
CONTENT_LENGTH
The length of the content of the request. Note that PUT and POST requests might have a content.
CONTENT_TYPE
The MIME type of the content of the reqeust. Note that PUT and POST requests might have a content.
GATEWAY_INTERFACE
Really meant specifically for CGI, this is used here incase the format of CGI variables changes in the future. It is set to CGI/1.1
PATH_INFO
Never set. CGI allows the found resource to not be the terminal part of the request URI's path. That is there could be more of the URI passed the URI of this resource. Jigsaw and as such we do not support this. HttpResource.lookup() returns an error if we find a resource which is not a container before the last component. So PATH_INFO and PATH_TRANSLATED will always be unset.
PATH_TRANSLATED
Never set. This is supposed to be the PATH_INFO after any translations that the server does, e.g., converting /~name/ into /user/name. Since the server doesn't do any translations this is always the same as PATH_INFO
QUERY_STRING
The query string of the requested URL if any. This is what follows the first unescaped ? in a URL. The value is URL encoded.
REMOTE_ADDR
The IP address of the request machine.
REMOTE_HOST
The host name of the requesting machine. This is not set for performance reasons. Setting this would require a reverse DNS lookup to convert the address to a hostname.
REMOTE_USER
This is the name of the remote user (not including their domain). If the user is unauthenticated this is Anonymous
REQUEST_METHOD
The method of the request. E.g., GET, POST, PUT, DELETE.
SCRIPT_NAME
This is the name of the script, it will always be the URL since PATH_INFO is always null
SERVER_NAME
The host name of the server.
SERVER_PORT
The server port that the request came in on.
SERVER_PROTOCOL
The name and revision of the protcol this request came in with. The format is protocol/revision and will typically be HTTP/1.1
SERVER_SOFTWARE
The name and revision of the server software. In this case SilverStream/1.0

Note that SilverStream does not support REMOTE_IDENT variable since RFC 931 identification is not supported.


Constructor Summary
AgoCGIHeaders()
           
 
Method Summary
 String get(String header)
          Get the value of a header.
 Enumeration headers()
          Get an enumeration of the names of all the headers.
static String headerToCGIVariable(String header)
          Converts an HTTP header to a CGI variable name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgoCGIHeaders

public AgoCGIHeaders()
Method Detail

get

public String get(String header)
Get the value of a header.
Parameters:
header - The header being requested as a string
Returns:
The value of the header as a string or null if the header is not present.

headers

public Enumeration headers()
Get an enumeration of the names of all the headers.
Returns:
The enumeration of the headers (CGI variables). is not present.

headerToCGIVariable

public static String headerToCGIVariable(String header)
Converts an HTTP header to a CGI variable name. Rules are:
  1. Prepend HTTP_ to the header name
  2. Uppercase all letters in the header name
  3. Convert hyphens to underscores
Parameters:
header - The name of the HTTP header to convert to a CGI variable name
Returns:
The name of the CGI variable of the HTTP header

SilverStream
Application Server 3.5