Application Server 3.5

Class 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:

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.
The length of the content of the request. Note that PUT and POST requests might have a content.
The MIME type of the content of the reqeust. Note that PUT and POST requests might have a content.
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
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.
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
The query string of the requested URL if any. This is what follows the first unescaped ? in a URL. The value is URL encoded.
The IP address of the request machine.
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.
This is the name of the remote user (not including their domain). If the user is unauthenticated this is Anonymous
The method of the request. E.g., GET, POST, PUT, DELETE.
This is the name of the script, it will always be the URL since PATH_INFO is always null
The host name of the server.
The server port that the request came in on.
The name and revision of the protcol this request came in with. The format is protocol/revision and will typically be HTTP/1.1
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
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


public AgoCGIHeaders()
Method Detail


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


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


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
header - The name of the HTTP header to convert to a CGI variable name
The name of the CGI variable of the HTTP header

Application Server 3.5