FileDocCategorySizeDatePackage
BaseRequest.javaAPI DocGlassfish v2 API10308Fri May 04 22:33:14 BST 2007org.apache.tomcat.util.http

BaseRequest

public class BaseRequest extends Object
A general-purpose object for representing an HTTP request.

Fields Summary
public static final String
SCHEME_HTTP
public static final String
SCHEME_HTTPS
org.apache.tomcat.util.buf.MessageBytes
method
org.apache.tomcat.util.buf.MessageBytes
protocol
org.apache.tomcat.util.buf.MessageBytes
requestURI
org.apache.tomcat.util.buf.MessageBytes
remoteAddr
org.apache.tomcat.util.buf.MessageBytes
remoteHost
org.apache.tomcat.util.buf.MessageBytes
serverName
int
serverPort
org.apache.tomcat.util.buf.MessageBytes
remoteUser
org.apache.tomcat.util.buf.MessageBytes
authType
org.apache.tomcat.util.buf.MessageBytes
queryString
org.apache.tomcat.util.buf.MessageBytes
authorization
String
scheme
boolean
secure
int
contentLength
org.apache.tomcat.util.buf.MessageBytes
contentType
MimeHeaders
headers
Cookies
cookies
HashMap
attributes
org.apache.tomcat.util.buf.MessageBytes
tomcatInstanceId
private Object[]
notes
Constructors Summary
Methods Summary
public org.apache.tomcat.util.buf.MessageBytesauthType()
Get the auth type

return
the auth type

        return authType;
    
public org.apache.tomcat.util.buf.MessageBytesauthorization()
Get the authorization credentials

return
the authorization credentials

        return authorization;
    
public org.apache.tomcat.util.buf.MessageBytescontentType()
Get the content type

return
the content type

        return contentType;
    
public Cookiescookies()
Get cookies.

return
request cookies.

        return cookies;
    
public java.lang.ObjectgetAttribute(java.lang.String name)
Get an attribute on the request

param
name attribute name
return
attribute value

        if (name == null) {
            return null;
        }

        return attributes.get(name);
    
public java.util.IteratorgetAttributeNames()
Get iterator over attribute names

return
iterator over attribute names

        return attributes.keySet().iterator();
    
public intgetContentLength()
Get the content length

return
the content length

        return contentLength;
    
public final java.lang.ObjectgetNote(int id)

    
         
        return notes[id];
    
public java.lang.StringgetScheme()
Get the scheme

return
the scheme

        return scheme;
    
public booleangetSecure()
Get whether the request is secure or not.

return
true if the request is secure.

        return secure;
    
public intgetServerPort()
Get the server port

return
the server port

        return serverPort;
    
public MimeHeadersheaders()
Get this request's headers

return
request headers

        return headers;
    
public org.apache.tomcat.util.buf.MessageBytesinstanceId()
Get the host id ( or jvmRoute )

return
the jvm route

        return tomcatInstanceId;
    
public org.apache.tomcat.util.buf.MessageBytesjvmRoute()

        return tomcatInstanceId;
    
public org.apache.tomcat.util.buf.MessageBytesmethod()
Get the method.

return
the method

        return method;
    
public org.apache.tomcat.util.buf.MessageBytesprotocol()
Get the protocol

return
the protocol

        return protocol;
    
public org.apache.tomcat.util.buf.MessageBytesqueryString()
Get the query string

return
the query string

        return queryString;
    
public voidrecycle()
Recycles this object and readies it further use.

    
                 
       
        method.recycle();
        protocol.recycle();
        requestURI.recycle();
        remoteAddr.recycle();
        remoteHost.recycle();
        serverName.recycle();
        serverPort = 80;
        remoteUser.recycle();
        authType.recycle();
        queryString.recycle();
        authorization.recycle();
        scheme = SCHEME_HTTP;
        secure = false;
        contentLength = 0;
        contentType.recycle();
        headers.recycle();
        cookies.recycle();
        attributes.clear();
        tomcatInstanceId.recycle();
    
public org.apache.tomcat.util.buf.MessageBytesremoteAddr()
Get the remote address

return
the remote address

        return remoteAddr;
    
public org.apache.tomcat.util.buf.MessageBytesremoteHost()
Get the remote host

return
the remote host

        return remoteHost;
    
public org.apache.tomcat.util.buf.MessageBytesremoteUser()
Get the remote user

return
the remote user

        return remoteUser;
    
public org.apache.tomcat.util.buf.MessageBytesrequestURI()
Get the request uri

return
the request uri

        return requestURI;
    
public org.apache.tomcat.util.buf.MessageBytesserverName()
Get the server name

return
the server name

        return serverName;
    
public voidsetAttribute(java.lang.String name, java.lang.Object value)
Set an attribute on the request

param
name attribute name
param
value attribute value

        if (name == null || value == null) {
            return;
        }
        attributes.put(name, value);
    
public voidsetContentLength(int i)
Set the content length

param
i the content length

        contentLength = i;
    
public final voidsetNote(int id, java.lang.Object cr)

        notes[id]=cr;
    
public voidsetScheme(java.lang.String s)
Set the scheme.

param
s the scheme

        scheme = s;
    
public voidsetSecure(boolean b)
Set whether the request is secure or not.

param
b true if the request is secure.

        secure = b;
    
public voidsetServerPort(int i)
Set the server port

param
i the server port

        serverPort = i;
    
public java.lang.StringtoString()
** SLOW ** for debugging only!

        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);

        pw.println("=== BaseRequest ===");
        pw.println("method          = " + method.toString());
        pw.println("protocol        = " + protocol.toString());
        pw.println("requestURI      = " + requestURI.toString());
        pw.println("remoteAddr      = " + remoteAddr.toString());
        pw.println("remoteHost      = " + remoteHost.toString());
        pw.println("serverName      = " + serverName.toString());
        pw.println("serverPort      = " + serverPort);
        pw.println("remoteUser      = " + remoteUser.toString());
        pw.println("authType        = " + authType.toString());
        pw.println("queryString     = " + queryString.toString());
        pw.println("scheme          = " + scheme.toString());
        pw.println("secure          = " + secure);
        pw.println("contentLength   = " + contentLength);
        pw.println("contentType     = " + contentType);
        pw.println("attributes      = " + attributes.toString());
        pw.println("headers         = " + headers.toString());
        pw.println("cookies         = " + cookies.toString());
        pw.println("jvmRoute        = " + tomcatInstanceId.toString());
        return sw.toString();