tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject svn commit: r534293 [2/11] - in /tomcat/sandbox/tomcat-lite: ./ bin/ external/ java/ java/org/apache/commons/logging/ java/org/apache/tomcat/lite/ java/org/apache/tomcat/lite/ctxmap/ java/org/apache/tomcat/lite/http/ java/org/apache/tomcat/lite/http11/...
Date Wed, 02 May 2007 02:22:50 GMT
Modified: tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/ServletRequestImpl.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/ServletRequestImpl.java?view=diff&rev=534293&r1=534292&r2=534293
==============================================================================
--- tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/ServletRequestImpl.java (original)
+++ tomcat/sandbox/tomcat-lite/java/org/apache/tomcat/lite/ServletRequestImpl.java Tue May  1 19:22:45 2007
@@ -14,10 +14,8 @@
  * limitations under the License.
  */
 
-
 package org.apache.tomcat.lite;
 
-
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
@@ -44,23 +42,21 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
-import org.apache.coyote.ActionCode;
+import org.apache.tomcat.lite.http11.Http11Buffer;
+import org.apache.tomcat.lite.http11.Http11Connection;
 import org.apache.tomcat.lite.util.MappingData;
-import org.apache.tomcat.lite.util.MessageReader;
 import org.apache.tomcat.lite.util.ParameterMap;
 import org.apache.tomcat.servlets.session.HttpSessionImpl;
 import org.apache.tomcat.servlets.session.SessionManagerServlet;
-import org.apache.tomcat.servlets.util.Enumerator;
-import org.apache.tomcat.servlets.util.RequestUtil;
-import org.apache.tomcat.servlets.util.StringParser;
-import org.apache.tomcat.util.buf.B2CConverter;
 import org.apache.tomcat.util.buf.ByteChunk;
-import org.apache.tomcat.util.buf.CharChunk;
 import org.apache.tomcat.util.buf.MessageBytes;
-import org.apache.tomcat.util.buf.StringCache;
+import org.apache.tomcat.util.buf.MessageReader;
+import org.apache.tomcat.util.buf.MessageReader.B2CConverter;
 import org.apache.tomcat.util.http.Cookies;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
+import org.apache.tomcat.util.http.LocaleParser;
 import org.apache.tomcat.util.http.Parameters;
+import org.apache.tomcat.util.http.RequestUtil;
 import org.apache.tomcat.util.http.ServerCookie;
 import org.apache.tomcat.util.res.StringManager;
 
@@ -73,15 +69,7 @@
  * @version $Revision: 325874 $ $Date: 2005-10-17 03:39:15 -0700 (Mon, 17 Oct 2005) $
  */
 
-public class ServletRequestImpl
-    implements HttpServletRequest {
-
-    /**
-     * The servlet context attribute under which we store the alternate
-     * deployment descriptor for this web application 
-     */
-    public static final String ALT_DD_ATTR = 
-        "org.apache.catalina.deploy.alt_dd";
+public class ServletRequestImpl implements HttpServletRequest {
 
     /**
      * The request attribute under which we store the array of X509Certificate
@@ -99,14 +87,6 @@
     public static final String CIPHER_SUITE_ATTR =
         "javax.servlet.request.cipher_suite";
 
-
-    /**
-     * The servlet context attribute under which we store the class loader
-     * used for loading servlets (as an object of type java.lang.ClassLoader).
-     */
-    public static final String CLASS_LOADER_ATTR =
-        "org.apache.catalina.classloader";
-
     /**
      * Request dispatcher state.
      */
@@ -120,14 +100,6 @@
         "org.apache.catalina.core.DISPATCHER_REQUEST_PATH";
 
     /**
-     * The JNDI directory context which is associated with the context. This
-     * context can be used to manipulate static files.
-     */
-    public static final String RESOURCES_ATTR =
-        "org.apache.catalina.resources";
-
-
-    /**
      * The servlet context attribute under which we store the class path
      * for our application class loader (as an object of type String),
      * delimited with the appropriate path delimiter for this platform.
@@ -169,15 +141,6 @@
 
 
     /**
-     * The request attribute under which the Invoker servlet will store
-     * the invoking servlet path, if it was used to execute a servlet
-     * indirectly instead of through a servlet mapping.
-     */
-    public static final String INVOKED_ATTR =
-        "org.apache.catalina.INVOKED";
-
-
-    /**
      * The request attribute under which we expose the value of the
      * <code>&lt;jsp-file&gt;</code> value associated with this servlet,
      * if any.
@@ -200,31 +163,6 @@
     public static final String SSL_SESSION_ID_ATTR =
         "javax.servlet.request.ssl_session";
 
-
-    /**
-     * The servlet context attribute under which the managed bean Registry
-     * will be stored for privileged contexts (if enabled).
-     */
-    public static final String MBEAN_REGISTRY_ATTR =
-        "org.apache.catalina.Registry";
-
-
-    /**
-     * The servlet context attribute under which the MBeanServer will be stored
-     * for privileged contexts (if enabled).
-     */
-    public static final String MBEAN_SERVER_ATTR =
-        "org.apache.catalina.MBeanServer";
-
-
-    /**
-     * The request attribute under which we store the servlet name on a
-     * named dispatcher request.
-     */
-    public static final String NAMED_DISPATCHER_ATTR =
-        "org.apache.catalina.NAMED";
-
-
     /**
      * The request attribute under which we forward a servlet name to
      * an error page.
@@ -248,17 +186,6 @@
 
 
     /**
-     * The servlet context attribute under which we store a flag used
-     * to mark this request as having been processed by the SSIServlet.
-     * We do this because of the pathInfo mangling happening when using
-     * the CGIServlet in conjunction with the SSI servlet. (value stored
-     * as an object of type String)
-     */
-     public static final String SSI_FLAG_ATTR =
-         "org.apache.catalina.ssi.SSIServlet";
-
-
-    /**
      * The request attribute under which we forward an HTTP status code
      * (as an object of type Integer) to an error page.
      */
@@ -274,14 +201,6 @@
 
     
     /**
-     * The servlet context attribute under which we record the set of
-     * welcome files (as an object of type String[]) for this application.
-     */
-    public static final String WELCOME_FILES_ATTR =
-        "org.apache.catalina.WELCOME_FILES";
-
-
-    /**
      * The servlet context attribute under which we store a temporary
      * working directory (as an object of type File) for use by servlets
      * within this web application.
@@ -289,63 +208,27 @@
     public static final String WORK_DIR_ATTR =
         "javax.servlet.context.tempdir";
 
-    // ----------------------------------------------------------- Constructors
-
-
-    static {
-        // Ensure that classes are loaded for SM
-        new StringCache.ByteEntry();
-        new StringCache.CharEntry();
-    }
-
-    public ServletRequestImpl() {
-
-        formats[0].setTimeZone(GMT_ZONE);
-        formats[1].setTimeZone(GMT_ZONE);
-        formats[2].setTimeZone(GMT_ZONE);
-
-    }
-
-
-    // ------------------------------------------------------------- Properties
-
-
-    /**
-     * Coyote request.
-     */
-    protected org.apache.coyote.Request coyoteRequest;
+    protected static final TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");
 
     /**
-     * Set the Coyote request.
-     * 
-     * @param coyoteRequest The Coyote request
+     * The string manager for this package.
      */
-    public void setCoyoteRequest(org.apache.coyote.Request coyoteRequest) {
-        this.coyoteRequest = coyoteRequest;
-        inputBuffer.setRequest(coyoteRequest);
-    }
+    protected static StringManager sm =
+        StringManager.getManager("org.apache.tomcat.lite");
 
     /**
-     * Get the Coyote request.
+     * The default Locale if none are specified.
      */
-    public org.apache.coyote.Request getCoyoteRequest() {
-        return (this.coyoteRequest);
-    }
-
-
-    // ----------------------------------------------------- Variables
-
-
-    protected static final TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");
+    protected static Locale defaultLocale = Locale.getDefault();
 
+    // ApplicationFilterFactory. What's the use ???
+    private static Integer REQUEST_INTEGER = new Integer(8);
 
     /**
-     * The string manager for this package.
+     * The match string for identifying a session ID parameter.
      */
-    protected static StringManager sm =
-        StringManager.getManager("org.apache.tomcat.lite");
-
-
+    private static final String match = ";" + SESSION_PARAMETER_NAME + "=";
+   
     /**
      * The set of cookies associated with this Request.
      */
@@ -358,18 +241,8 @@
      * Notice that because SimpleDateFormat is not thread-safe, we can't
      * declare formats[] as a static variable.
      */
-    protected SimpleDateFormat formats[] = {
-        new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US),
-        new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
-        new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
-    };
-
-
-    /**
-     * The default Locale if none are specified.
-     */
-    protected static Locale defaultLocale = Locale.getDefault();
-
+    protected SimpleDateFormat formats[] = null;
+    
 
     /**
      * The attributes associated with this Request, keyed by attribute name.
@@ -380,7 +253,7 @@
     /**
      * List of read only attributes for this Request.
      */
-    private HashMap readOnlyAttributes = new HashMap();
+    //private HashMap readOnlyAttributes = new HashMap();
 
 
     /**
@@ -390,16 +263,20 @@
 
 
     /**
-     * Internal notes associated with this request by Catalina components
-     * and event listeners.
+     * Authentication type.
+     */
+    protected String authType = null;
+
+    /**
+     * User principal.
      */
-    private transient HashMap notes = new HashMap();
+    protected Principal userPrincipal = null;
 
 
     /**
-     * Authentication type.
+     * The Subject associated with the current AccessControllerContext
      */
-    protected String authType = null;
+    protected transient Subject subject = null;
 
 
     /**
@@ -440,12 +317,6 @@
 
 
     /**
-     * User principal.
-     */
-    protected Principal userPrincipal = null;
-
-
-    /**
      * Session parsed flag.
      */
     protected boolean sessionParsed = false;
@@ -468,19 +339,6 @@
      */
     protected boolean secure = false;
 
-    
-    /**
-     * The Subject associated with the current AccessControllerContext
-     */
-    protected transient Subject subject = null;
-
-
-    /**
-     * Post data buffer.
-     */
-    protected static int CACHED_POST_LEN = 8192;
-    protected byte[] postData = null;
-
 
     /**
      * Hash map used in the getParametersMap method.
@@ -525,135 +383,49 @@
 
 
     /**
-     * The string parser we will use for parsing locales
-     */
-    private StringParser parser = new StringParser();
-
-
-    /**
-     * Local port
+     * Associated context.
      */
-    protected int localPort = -1;
+    protected ServletContextImpl context = null;
 
-    /**
-     * Remote address.
-     */
-    protected String remoteAddr = null;
 
 
-    /**
-     * Remote host.
-     */
-    protected String remoteHost = null;
+    // --------------------------------------------------------- Public Methods
 
-    
-    /**
-     * Remote port
-     */
-    protected int remotePort = -1;
-    
     /**
-     * Local address
+     * Filter chain associated with the request.
      */
-    protected String localAddr = null;
-
+    protected FilterChainImpl filterChain = new FilterChainImpl();
     
     /**
-     * Local address
-     */
-    protected String localName = null;
-
-    // --------------------------------------------------------- Public Methods
-
-    /**
-     * Release all object references, and initialize instance variables, in
-     * preparation for reuse of this object.
+     * Mapping data.
      */
-    public void recycle() {
-
-        context = null;
-        wrapper = null;
-
-        dispatcherType = null;
-        requestDispatcherPath = null;
-
-        authType = null;
-        inputBuffer.recycle();
-        usingInputStream = false;
-        usingReader = false;
-        userPrincipal = null;
-        subject = null;
-        sessionParsed = false;
-        parametersParsed = false;
-        cookiesParsed = false;
-        locales.clear();
-        localesParsed = false;
-        secure = false;
-        remoteAddr = null;
-        remoteHost = null;
-        remotePort = -1;
-        localPort = -1;
-        localAddr = null;
-        localName = null;
-
-        attributes.clear();
-        notes.clear();
-        cookies = null;
-
-        if (session != null) {
-            session.endAccess();
-        }
-        session = null;
-        requestedSessionCookie = false;
-        requestedSessionId = null;
-        requestedSessionURL = false;
-
-        parameterMap.setLocked(false);
-        parameterMap.clear();
-
-        mappingData.recycle();
-
-    }
+    protected MappingData mappingData = new MappingData();
 
 
     // -------------------------------------------------------- Request Methods
 
     /**
-     * Associated context.
+     * The response with which this request is associated.
      */
-    protected ServletContextImpl context = null;
-
+    protected ServletResponseImpl response = null;
+    
     /**
-     * Return the Context within which this Request is being processed.
+     * URI byte to char converter (not recycled).
      */
-    public ServletContextImpl getContext() {
-        return (this.context);
-    }
-
+   // protected B2CConverter URIConverter = null;
 
     /**
-     * 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 <code>getContextPath()</code>,
-     * and thus enables parsing of the request URI.
-     *
-     * @param context The newly associated Context
+     * Associated wrapper.
      */
-    public void setContext(ServletContextImpl context) {
-        this.context = context;
-    }
+    protected ServletConfigImpl wrapper = null;
 
 
-    /**
-     * Filter chain associated with the request.
+    /** New IO/buffer model  
      */
-    protected FilterChainImpl filterChain = new FilterChainImpl();
+    protected Http11Connection con;
 
-    /**
-     * Get filter chain associated with the request.
-     */
-    public FilterChainImpl getFilterChain() {
-        return (this.filterChain);
+
+    public ServletRequestImpl() {
     }
 
 
@@ -679,135 +451,95 @@
 //        mappingData.host = host;
 //    }
 
-
     /**
-     * Descriptive information about this Request implementation.
+     * Add a Cookie to the set of Cookies associated with this Request.
+     *
+     * @param cookie The new cookie
      */
-    protected static final String info =
-        "org.apache.coyote.catalina.CoyoteRequest/1.0";
+    public void addCookie(Cookie cookie) {
 
-    /**
-     * Return descriptive information about this Request implementation and
-     * the corresponding version number, in the format
-     * <code>&lt;description&gt;/&lt;version&gt;</code>.
-     */
-    public String getInfo() {
-        return (info);
-    }
+        if (!cookiesParsed)
+            parseCookies();
 
+        int size = 0;
+        if (cookies != null) {
+            size = cookies.length;
+        }
 
-    /**
-     * Mapping data.
-     */
-    protected MappingData mappingData = new MappingData();
+        Cookie[] newCookies = new Cookie[size + 1];
+        for (int i = 0; i < size; i++) {
+            newCookies[i] = cookies[i];
+        }
+        newCookies[size] = cookie;
+
+        cookies = newCookies;
+
+    }
 
     /**
-     * Return mapping data.
+     * Add a Header to the set of Headers associated with this Request.
+     *
+     * @param name The new header name
+     * @param value The new header value
      */
-    public MappingData getMappingData() {
-        return (mappingData);
+    public void addHeader(String name, String value) {
+        // Not used
     }
 
 
     /**
-     * Return the <code>ServletRequest</code> for which this object
-     * is the facade.  This method must be implemented by a subclass.
+     * Add a Locale to the set of preferred Locales for this Request.  The
+     * first added Locale will be the first one returned by getLocales().
+     *
+     * @param locale The new preferred Locale
      */
-    public HttpServletRequest getRequest() {
-        return this;
+    public void addLocale(Locale locale) {
+        locales.add(locale);
     }
 
 
     /**
-     * The response with which this request is associated.
-     */
-    protected ServletResponseImpl response = null;
-
-    /**
-     * Return the Response with which this Request is associated.
-     */
-    public ServletResponseImpl getResponse() {
-        return (this.response);
-    }
-
-    /**
-     * Set the Response with which this Request is associated.
-     *
-     * @param response The new associated response
-     */
-    public void setResponse(ServletResponseImpl response) {
-        this.response = response;
-    }
-
-    /**
-     * Return the input stream associated with this Request.
-     */
-    public InputStream getStream() {
-        if (inputStream == null) {
-            inputStream = new ServletInputStreamImpl(inputBuffer);
-        }
-        return inputStream;
-    }
-
-    /**
-     * Set the input stream associated with this Request.
+     * Add a parameter name and corresponding set of values to this Request.
+     * (This is used when restoring the original request on a form based
+     * login).
      *
-     * @param stream The new input stream
+     * @param name Name of this request parameter
+     * @param values Corresponding values for this request parameter
      */
-    public void setStream(InputStream stream) {
-        // Ignore
+    public void addParameter(String name, String values[]) {
+        con.reqB.getParameters().addParameterValues(name, values);
     }
 
-
-    /**
-     * URI byte to char converter (not recycled).
-     */
-    protected B2CConverter URIConverter = null;
-
     /**
-     * Return the URI converter.
+     * Clear the collection of Cookies associated with this Request.
      */
-    protected B2CConverter getURIConverter() {
-        return URIConverter;
+    public void clearCookies() {
+        cookiesParsed = true;
+        cookies = null;
     }
 
     /**
-     * Set the URI converter.
-     * 
-     * @param URIConverter the new URI connverter
+     * Clear the collection of Headers associated with this Request.
      */
-    protected void setURIConverter(B2CConverter URIConverter) {
-        this.URIConverter = URIConverter;
+    public void clearHeaders() {
+        // Not used
     }
 
-
-    /**
-     * Associated wrapper.
-     */
-    protected ServletConfigImpl wrapper = null;
-
     /**
-     * Return the Wrapper within which this Request is being processed.
+     * Clear the collection of Locales associated with this Request.
      */
-    public ServletConfigImpl getWrapper() {
-        return (this.wrapper);
+    public void clearLocales() {
+        locales.clear();
     }
 
-
     /**
-     * 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.
-     * @param wrapper The newly associated Wrapper
+     * Clear the collection of parameters associated with this Request.
      */
-    public void setWrapper(ServletConfigImpl wrapper) {
-        this.wrapper = wrapper;
+    public void clearParameters() {
+        // Not used
     }
 
 
-    // ------------------------------------------------- Request Public Methods
-
-
     /**
      * Create and return a ServletInputStream to read the content
      * associated with this Request.
@@ -816,12 +548,31 @@
      */
     public ServletInputStream createInputStream() 
         throws IOException {
-        if (inputStream == null) {
-            inputStream = new ServletInputStreamImpl(inputBuffer);
-        }
         return inputStream;
     }
 
+    public void decodeRequest() throws IOException {
+        MessageBytes decodedURI = getDecodedRequestURIMB();
+        decodedURI.duplicate(con.reqB.requestURI());
+
+        if (decodedURI.isBytes()) {
+            // %xx decoding of the URL
+            con.reqB.getURLDecoder().convert(decodedURI, false);
+            // Normalization
+            if (!normalize(decodedURI)) {
+                throw new IOException("Error normalizing");
+            }
+            // Character decoding
+            //convertURI(decodedURI, request);
+        } else {
+            // The URL is chars or String, and has been sent using an in-memory
+            // protocol handler, we have to assume the URL has been properly
+            // decoded already
+            decodedURI.toChars();
+        }
+
+
+    }
 
     /**
      * Perform whatever actions are required to flush and close the input
@@ -835,245 +586,278 @@
 
 
     /**
-     * Return the object bound with the specified name to the internal notes
-     * for this request, or <code>null</code> if no such binding exists.
+     * Return the specified request attribute if it exists; otherwise, return
+     * <code>null</code>.
      *
-     * @param name Name of the note to be returned
+     * @param name Name of the request attribute to return
      */
-    public Object getNote(String name) {
-        return (notes.get(name));
-    }
+    public Object getAttribute(String name) {
+
+        if (name.equals(ServletRequestImpl.DISPATCHER_TYPE_ATTR)) {
+            return (dispatcherType == null) 
+                ? REQUEST_INTEGER
+                : dispatcherType;
+        } else if (name.equals(ServletRequestImpl.DISPATCHER_REQUEST_PATH_ATTR)) {
+            return (requestDispatcherPath == null) 
+                ? getRequestPathMB().toString()
+                : requestDispatcherPath.toString();
+        }
+
+        Object attr=attributes.get(name);
+
+        if(attr!=null)
+            return(attr);
 
+//        attr =  con.reqB.getAttribute(name);
+//        if(attr != null)
+//            return attr;
+//        if( isSSLAttribute(name) ) {
+//            con.reqB.action(ActionCode.ACTION_REQ_SSL_ATTRIBUTE, 
+//                                 con.reqB);
+//            attr = con.reqB.getAttribute(ServletRequestImpl.CERTIFICATES_ATTR);
+//            if( attr != null) {
+//                attributes.put(ServletRequestImpl.CERTIFICATES_ATTR, attr);
+//            }
+//            attr = con.reqB.getAttribute(ServletRequestImpl.CIPHER_SUITE_ATTR);
+//            if(attr != null) {
+//                attributes.put(ServletRequestImpl.CIPHER_SUITE_ATTR, attr);
+//            }
+//            attr = con.reqB.getAttribute(ServletRequestImpl.KEY_SIZE_ATTR);
+//            if(attr != null) {
+//                attributes.put(ServletRequestImpl.KEY_SIZE_ATTR, attr);
+//            }
+//            attr = con.reqB.getAttribute(ServletRequestImpl.SSL_SESSION_ID_ATTR);
+//            if(attr != null) {
+//                attributes.put(ServletRequestImpl.SSL_SESSION_ID_ATTR, attr);
+//            }
+//            attr = attributes.get(name);
+//        }
+        return attr;
+    }
 
     /**
-     * Return an Iterator containing the String names of all notes bindings
-     * that exist for this request.
+     * Return the names of all request attributes for this Request, or an
+     * empty <code>Enumeration</code> if there are none.
      */
-    public Iterator getNoteNames() {
-        return (notes.keySet().iterator());
+    public Enumeration getAttributeNames() {
+        if (isSecure()) {
+            getAttribute(ServletRequestImpl.CERTIFICATES_ATTR);
+        }
+        return new Enumerator(attributes.keySet(), true);
     }
 
 
     /**
-     * Remove any object bound to the specified name in the internal notes
-     * for this request.
-     *
-     * @param name Name of the note to be removed
+     * Return the authentication type used for this Request.
      */
-    public void removeNote(String name) {
-        notes.remove(name);
+    public String getAuthType() {
+        return (authType);
     }
 
 
+    // ------------------------------------------------- Request Public Methods
+
+
     /**
-     * Bind an object to a specified name in the internal notes associated
-     * with this request, replacing any existing binding for this name.
-     *
-     * @param name Name to which the object should be bound
-     * @param value Object to be bound to the specified name
+     * Return the character encoding for this Request.
      */
-    public void setNote(String name, Object value) {
-        notes.put(name, value);
+    public String getCharacterEncoding() {
+      return (con.reqB.getCharacterEncoding());
     }
 
 
     /**
-     * Set the content length associated with this Request.
-     *
-     * @param length The new content length
+     * Return the content length for this Request.
      */
-    public void setContentLength(int length) {
-        // Not used
+    public int getContentLength() {
+        return (con.reqB.getContentLength());
     }
 
 
+//    /**
+//     * Return the object bound with the specified name to the internal notes
+//     * for this request, or <code>null</code> if no such binding exists.
+//     *
+//     * @param name Name of the note to be returned
+//     */
+//    public Object getNote(String name) {
+//        return (notes.get(name));
+//    }
+//
+//
+//    /**
+//     * Return an Iterator containing the String names of all notes bindings
+//     * that exist for this request.
+//     */
+//    public Iterator getNoteNames() {
+//        return (notes.keySet().iterator());
+//    }
+//
+//
+//    /**
+//     * Remove any object bound to the specified name in the internal notes
+//     * for this request.
+//     *
+//     * @param name Name of the note to be removed
+//     */
+//    public void removeNote(String name) {
+//        notes.remove(name);
+//    }
+//
+//
+//    /**
+//     * Bind an object to a specified name in the internal notes associated
+//     * with this request, replacing any existing binding for this name.
+//     *
+//     * @param name Name to which the object should be bound
+//     * @param value Object to be bound to the specified name
+//     */
+//    public void setNote(String name, Object value) {
+//        notes.put(name, value);
+//    }
+//
+
     /**
-     * Set the content type (and optionally the character encoding)
-     * associated with this Request.  For example,
-     * <code>text/html; charset=ISO-8859-4</code>.
-     *
-     * @param type The new content type
+     * Return the content type for this Request.
      */
-    public void setContentType(String type) {
-        // Not used
+    public String getContentType() {
+        return (con.reqB.getContentType());
     }
 
 
     /**
-     * Set the protocol name and version associated with this Request.
-     *
-     * @param protocol Protocol name and version
+     * Return the Context within which this Request is being processed.
      */
-    public void setProtocol(String protocol) {
-        // Not used
+    public ServletContextImpl getContext() {
+        return (this.context);
     }
 
 
     /**
-     * Set the IP address of the remote client associated with this Request.
-     *
-     * @param remoteAddr The remote IP address
+     * Return the portion of the request URI used to select the Context
+     * of the Request.
      */
-    public void setRemoteAddr(String remoteAddr) {
-        // Not used
+    public String getContextPath() {
+        return (mappingData.contextPath.toString());
     }
 
 
     /**
-     * Set the fully qualified name of the remote client associated with this
-     * Request.
-     *
-     * @param remoteHost The remote host name
+     * Get the context path.
+     * 
+     * @return the context path
      */
-    public void setRemoteHost(String remoteHost) {
-        // Not used
+    public MessageBytes getContextPathMB() {
+        return (mappingData.contextPath);
     }
 
 
     /**
-     * Set the name of the scheme associated with this request.  Typical values
-     * are <code>http</code>, <code>https</code>, and <code>ftp</code>.
-     *
-     * @param scheme The scheme
+     * Return the set of Cookies received with this Request.
      */
-    public void setScheme(String scheme) {
-        // Not used
+    public Cookie[] getCookies() {
+
+        if (!cookiesParsed)
+            parseCookies();
+
+        return cookies;
+
     }
 
 
     /**
-     * Set the value to be returned by <code>isSecure()</code>
-     * for this Request.
+     * Return the value of the specified date header, if any; otherwise
+     * return -1.
      *
-     * @param secure The new isSecure value
+     * @param name Name of the requested date header
+     *
+     * @exception IllegalArgumentException if the specified header value
+     *  cannot be converted to a date
      */
-    public void setSecure(boolean secure) {
-        this.secure = secure;
+    public long getDateHeader(String name) {
+
+        String value = getHeader(name);
+        if (value == null)
+            return (-1L);
+        if (formats == null) {
+            formats = new SimpleDateFormat[] {
+                new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US),
+                new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
+                new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
+            };
+            formats[0].setTimeZone(GMT_ZONE);
+            formats[1].setTimeZone(GMT_ZONE);
+            formats[2].setTimeZone(GMT_ZONE);
+        }
+        
+        // Attempt to convert the date header in a variety of formats
+        long result = FastHttpDateFormat.parseDate(value, formats);
+        if (result != (-1L)) {
+            return result;
+        }
+        throw new IllegalArgumentException(value);
+
     }
 
 
     /**
-     * Set the name of the server (virtual host) to process this request.
-     *
-     * @param name The server name
+     * Get the decoded request URI.
+     * 
+     * @return the URL decoded request URI
      */
-    public void setServerName(String name) {
-        coyoteRequest.serverName().setString(name);
+    public String getDecodedRequestURI() {
+        return (con.reqB.decodedURI().toString());
     }
 
 
     /**
-     * Set the port number of the server to process this request.
-     *
-     * @param port The server port
-     */
-    public void setServerPort(int port) {
-        coyoteRequest.setServerPort(port);
-    }
-
-
-    // ------------------------------------------------- ServletRequest Methods
-
-    // ApplicationFilterFactory. What's the use ???
-    private static Integer REQUEST_INTEGER = new Integer(8);
-    
-    /**
-     * Return the specified request attribute if it exists; otherwise, return
-     * <code>null</code>.
-     *
-     * @param name Name of the request attribute to return
+     * Get the decoded request URI.
+     * 
+     * @return the URL decoded request URI
      */
-    public Object getAttribute(String name) {
-
-        if (name.equals(ServletRequestImpl.DISPATCHER_TYPE_ATTR)) {
-            return (dispatcherType == null) 
-                ? REQUEST_INTEGER
-                : dispatcherType;
-        } else if (name.equals(ServletRequestImpl.DISPATCHER_REQUEST_PATH_ATTR)) {
-            return (requestDispatcherPath == null) 
-                ? getRequestPathMB().toString()
-                : requestDispatcherPath.toString();
-        }
-
-        Object attr=attributes.get(name);
-
-        if(attr!=null)
-            return(attr);
-
-        attr =  coyoteRequest.getAttribute(name);
-        if(attr != null)
-            return attr;
-        if( isSSLAttribute(name) ) {
-            coyoteRequest.action(ActionCode.ACTION_REQ_SSL_ATTRIBUTE, 
-                                 coyoteRequest);
-            attr = coyoteRequest.getAttribute(ServletRequestImpl.CERTIFICATES_ATTR);
-            if( attr != null) {
-                attributes.put(ServletRequestImpl.CERTIFICATES_ATTR, attr);
-            }
-            attr = coyoteRequest.getAttribute(ServletRequestImpl.CIPHER_SUITE_ATTR);
-            if(attr != null) {
-                attributes.put(ServletRequestImpl.CIPHER_SUITE_ATTR, attr);
-            }
-            attr = coyoteRequest.getAttribute(ServletRequestImpl.KEY_SIZE_ATTR);
-            if(attr != null) {
-                attributes.put(ServletRequestImpl.KEY_SIZE_ATTR, attr);
-            }
-            attr = coyoteRequest.getAttribute(ServletRequestImpl.SSL_SESSION_ID_ATTR);
-            if(attr != null) {
-                attributes.put(ServletRequestImpl.SSL_SESSION_ID_ATTR, attr);
-            }
-            attr = attributes.get(name);
-        }
-        return attr;
+    public MessageBytes getDecodedRequestURIMB() {
+        return (con.reqB.decodedURI());
     }
 
 
     /**
-     * Test if a given name is one of the special Servlet-spec SSL attributes.
+     * Get filter chain associated with the request.
      */
-    static boolean isSSLAttribute(String name) {
-        return ServletRequestImpl.CERTIFICATES_ATTR.equals(name) ||
-            ServletRequestImpl.CIPHER_SUITE_ATTR.equals(name) ||
-            ServletRequestImpl.KEY_SIZE_ATTR.equals(name)  ||
-            ServletRequestImpl.SSL_SESSION_ID_ATTR.equals(name);
+    public FilterChainImpl getFilterChain() {
+        return (this.filterChain);
     }
 
-    /**
-     * Return the names of all request attributes for this Request, or an
-     * empty <code>Enumeration</code> if there are none.
-     */
-    public Enumeration getAttributeNames() {
-        if (isSecure()) {
-            getAttribute(ServletRequestImpl.CERTIFICATES_ATTR);
-        }
-        return new Enumerator(attributes.keySet(), true);
-    }
 
+    // ------------------------------------------------- ServletRequest Methods
 
     /**
-     * Return the character encoding for this Request.
+     * Return the first value of the specified header, if any; otherwise,
+     * return <code>null</code>
+     *
+     * @param name Name of the requested header
      */
-    public String getCharacterEncoding() {
-      return (coyoteRequest.getCharacterEncoding());
+    public String getHeader(String name) {
+        return con.reqB.getHeader(name);
     }
-
-
+    
     /**
-     * Return the content length for this Request.
+     * Return the names of all headers received with this request.
      */
-    public int getContentLength() {
-        return (coyoteRequest.getContentLength());
+    public Enumeration getHeaderNames() {
+        return con.reqB.getMimeHeaders().names();
     }
 
 
     /**
-     * Return the content type for this Request.
+     * Return all of the values of the specified header, if any; otherwise,
+     * return an empty enumeration.
+     *
+     * @param name Name of the requested header
      */
-    public String getContentType() {
-        return (coyoteRequest.getContentType());
+    public Enumeration getHeaders(String name) {
+        return con.reqB.getMimeHeaders().values(name);
     }
 
-
     /**
      * Return the servlet input stream for this Request.  The default
      * implementation returns a servlet input stream created by
@@ -1087,18 +871,45 @@
 
         if (usingReader)
             throw new IllegalStateException
-                (sm.getString("coyoteRequest.getInputStream.ise"));
+                (sm.getString("con.reqB.getInputStream.ise"));
 
         usingInputStream = true;
-        if (inputStream == null) {
-            inputStream = new ServletInputStreamImpl(inputBuffer);
-        }
         return inputStream;
 
     }
 
 
     /**
+     * Return the value of the specified header as an integer, or -1 if there
+     * is no such header for this request.
+     *
+     * @param name Name of the requested header
+     *
+     * @exception IllegalArgumentException if the specified header value
+     *  cannot be converted to an integer
+     */
+    public int getIntHeader(String name) {
+
+        String value = getHeader(name);
+        if (value == null) {
+            return (-1);
+        } else {
+            return (Integer.parseInt(value));
+        }
+
+    }
+
+
+    /**
+     * Returns the Internet Protocol (IP) address of the interface on
+     * which the request  was received.
+     */       
+    public String getLocalAddr(){
+        return con.getLocalAddr();
+    }
+
+
+    /**
      * Return the preferred Locale that the client will accept content in,
      * based on the value for the first <code>Accept-Language</code> header
      * that was encountered.  If the request did not specify a preferred
@@ -1139,6 +950,41 @@
 
 
     /**
+     * Returns the host name of the Internet Protocol (IP) interface on
+     * which the request was received.
+     */
+    public String getLocalName(){
+        return con.getLocalName();
+    }
+
+
+    /**
+     * Returns the Internet Protocol (IP) port number of the interface
+     * on which the request was received.
+     */
+    public int getLocalPort(){
+        return con.getLocalPort();
+    }
+
+
+    /**
+     * Return mapping data.
+     */
+    public MappingData getMappingData() {
+        return (mappingData);
+    }
+
+
+
+    /**
+     * Return the HTTP request method used in this Request.
+     */
+    public String getMethod() {
+        return con.reqB.method().toString();
+    }
+
+
+    /**
      * Return the value of the specified request parameter, if any; otherwise,
      * return <code>null</code>.  If there is more than one value defined,
      * return only the first one.
@@ -1150,12 +996,11 @@
         if (!parametersParsed)
             parseParameters();
 
-        return coyoteRequest.getParameters().getParameter(name);
+        return con.reqB.getParameters().getParameter(name);
 
     }
 
 
-
     /**
      * Returns a <code>Map</code> of the parameters of this request.
      * Request parameters are extra information sent with the request.
@@ -1192,7 +1037,7 @@
         if (!parametersParsed)
             parseParameters();
 
-        return coyoteRequest.getParameters().getParameterNames();
+        return con.reqB.getParameters().getParameterNames();
 
     }
 
@@ -1208,16 +1053,70 @@
         if (!parametersParsed)
             parseParameters();
 
-        return coyoteRequest.getParameters().getParameterValues(name);
+        return con.reqB.getParameters().getParameterValues(name);
+
+    }
+
+
+    /**
+     * Return the path information associated with this Request.
+     */
+    public String getPathInfo() {
+        return (mappingData.pathInfo.toString());
+    }
+
 
+    /**
+     * Get the path info.
+     * 
+     * @return the path info
+     */
+    public MessageBytes getPathInfoMB() {
+        return (mappingData.pathInfo);
     }
 
 
     /**
+     * Return the extra path information for this request, translated
+     * to a real path.
+     */
+    public String getPathTranslated() {
+
+        if (context == null)
+            return (null);
+
+        if (getPathInfo() == null) {
+            return (null);
+        } else {
+            return (context.getServletContext().getRealPath(getPathInfo()));
+        }
+
+    }
+    
+    /**
+     * Return the principal that has been authenticated for this Request.
+     */
+    public Principal getPrincipal() {
+        return (userPrincipal);
+    }
+     
+    /**
      * Return the protocol and version used to make this Request.
      */
     public String getProtocol() {
-        return coyoteRequest.protocol().toString();
+        return con.reqB.protocol().toString();
+    }
+
+    /**
+     * Return the query string associated with this request.
+     */
+    public String getQueryString() {
+        String queryString = con.reqB.queryString().toString();
+        if (queryString == null || queryString.equals("")) {
+            return (null);
+        } else {
+            return queryString;
+        }
     }
 
 
@@ -1234,19 +1133,41 @@
 
         if (usingInputStream)
             throw new IllegalStateException
-                (sm.getString("coyoteRequest.getReader.ise"));
+                (sm.getString("con.reqB.getReader.ise"));
 
         usingReader = true;
-        inputBuffer.checkConverter();
-        if (reader == null) {
-            reader = new ServletReaderImpl(inputBuffer);
-        }
+        inputBuffer.setConverter(getB2C());
         return reader;
 
     }
 
+    /**
+     * Cached list of encoders.
+     */
+    protected HashMap encoders = new HashMap();
+    public static final String DEFAULT_CHARACTER_ENCODING="ISO-8859-1";
 
     /**
+     *  Converter for the encoding associated with the request.
+     *  If encoding is changed - a different encoder will be returned.
+     *  
+     *  Encoders are cached ( per request ) - at least 8K per charset
+     */
+    public B2CConverter getB2C() throws IOException {
+      String enc = getCharacterEncoding();
+      if (enc == null) {
+        enc = DEFAULT_CHARACTER_ENCODING;
+      }
+      B2CConverter conv = 
+        (B2CConverter) encoders.get(enc);
+      if (conv == null) {
+        conv = new B2CConverter(enc);
+        encoders.put(enc, conv);
+      }
+      return conv;
+    }
+    
+    /**
      * Return the real path of the specified virtual path.
      *
      * @param path Path to be translated
@@ -1276,12 +1197,7 @@
      * Return the remote IP address making this Request.
      */
     public String getRemoteAddr() {
-        if (remoteAddr == null) {
-            coyoteRequest.action
-                (ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE, coyoteRequest);
-            remoteAddr = coyoteRequest.remoteAddr().toString();
-        }
-        return remoteAddr;
+        return con.getRemoteAddr();
     }
 
 
@@ -1289,71 +1205,43 @@
      * Return the remote host name making this Request.
      */
     public String getRemoteHost() {
-        if (remoteHost == null) {
-//            if (!connector.getEnableLookups()) {
-//                remoteHost = getRemoteAddr();
-//            } else {
-                coyoteRequest.action
-                    (ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest);
-                remoteHost = coyoteRequest.remoteHost().toString();
-//            }
-        }
-        return remoteHost;
+        return con.getRemoteHost();
     }
-    
+
+
     /**
      * Returns the Internet Protocol (IP) source port of the client
      * or last proxy that sent the request.
      */    
     public int getRemotePort(){
-        if (remotePort == -1) {
-            coyoteRequest.action
-                (ActionCode.ACTION_REQ_REMOTEPORT_ATTRIBUTE, coyoteRequest);
-            remotePort = coyoteRequest.getRemotePort();
-        }
-        return remotePort;    
+        return con.getRemotePort();
     }
 
+
     /**
-     * Returns the host name of the Internet Protocol (IP) interface on
-     * which the request was received.
+     * Return the name of the remote user that has been authenticated
+     * for this Request.
      */
-    public String getLocalName(){
-        if (localName == null) {
-            coyoteRequest.action
-                (ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE, coyoteRequest);
-            localName = coyoteRequest.localName().toString();
-        }
-        return localName;
-    }
+    public String getRemoteUser() {
 
-    /**
-     * Returns the Internet Protocol (IP) address of the interface on
-     * which the request  was received.
-     */       
-    public String getLocalAddr(){
-        if (localAddr == null) {
-            coyoteRequest.action
-                (ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE, coyoteRequest);
-            localAddr = coyoteRequest.localAddr().toString();
+        if (userPrincipal != null) {
+            return (userPrincipal.getName());
+        } else {
+            return (null);
         }
-        return localAddr;    
+
     }
 
 
     /**
-     * Returns the Internet Protocol (IP) port number of the interface
-     * on which the request was received.
+     * Return the <code>ServletRequest</code> for which this object
+     * is the facade.  This method must be implemented by a subclass.
      */
-    public int getLocalPort(){
-        if (localPort == -1){
-            coyoteRequest.action
-                (ActionCode.ACTION_REQ_LOCALPORT_ATTRIBUTE, coyoteRequest);
-            localPort = coyoteRequest.getLocalPort();
-        }
-        return localPort;
+    public HttpServletRequest getRequest() {
+        return this;
     }
-    
+
+
     /**
      * Return a RequestDispatcher that wraps the resource at the specified
      * path, which may be interpreted as relative to the current request path.
@@ -1401,1074 +1289,865 @@
 
 
     /**
-     * Return the scheme used to make this Request.
+     * Return the session identifier included in this request, if any.
      */
-    public String getScheme() {
-        String scheme = coyoteRequest.scheme().toString();
-        if (scheme == null) {
-            scheme = (isSecure() ? "https" : "http");
-        }
-        return scheme;
+    public String getRequestedSessionId() {
+        return (requestedSessionId);
     }
 
 
+    // ---------------------------------------------------- HttpRequest Methods
+
+
     /**
-     * Return the server name responding to this Request.
-     */
-    public String getServerName() {
-        return (coyoteRequest.serverName().toString());
-    }
-
-
-    /**
-     * Return the server port responding to this Request.
-     */
-    public int getServerPort() {
-        return (coyoteRequest.getServerPort());
-    }
-
-
-    /**
-     * Was this request received on a secure connection?
+     * Get the request path.
+     * 
+     * @return the request path
      */
-    public boolean isSecure() {
-        return (secure);
+    public MessageBytes getRequestPathMB() {
+        return (mappingData.requestPath);
     }
 
 
     /**
-     * Remove the specified request attribute if it exists.
-     *
-     * @param name Name of the request attribute to remove
+     * Return the request URI for this request.
      */
-    public void removeAttribute(String name) {
-        Object value = null;
-        boolean found = false;
-
-        // Remove the specified attribute
-        // Check for read only attribute
-        // requests are per thread so synchronization unnecessary
-        if (readOnlyAttributes.containsKey(name)) {
-            return;
-        }
-        found = attributes.containsKey(name);
-        if (found) {
-            value = attributes.get(name);
-            attributes.remove(name);
-        } else {
-            return;
-        }
-
-        // Notify interested application event listeners
-        List listeners = context.getApplicationEventListeners();
-        if (listeners.size() == 0)
-            return;
-        ServletRequestAttributeEvent event = null;
-        for (int i = 0; i < listeners.size(); i++) {
-            if (!(listeners.get(i) instanceof ServletRequestAttributeListener))
-                continue;
-            ServletRequestAttributeListener listener =
-                (ServletRequestAttributeListener) listeners.get(i);
-            try {
-                if (event == null) {
-                    event = 
-                        new ServletRequestAttributeEvent(context.getServletContext(),
-                            getRequest(), name, value);
-                }
-                listener.attributeRemoved(event);
-            } catch (Throwable t) {
-                context.getLogger().error(sm.getString("coyoteRequest.attributeEvent"), t);
-                // Error valve will pick this execption up and display it to user
-                attributes.put( ServletRequestImpl.EXCEPTION_ATTR, t );
-            }
-        }
+    public String getRequestURI() {
+        return con.reqB.requestURI().toString();
     }
 
 
     /**
-     * Set the specified request attribute to the specified value.
+     * 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.
+     * <p>
+     * Because this method returns a <code>StringBuffer</code>,
+     * not a <code>String</code>, you can modify the URL easily,
+     * for example, to append query parameters.
+     * <p>
+     * This method is useful for creating redirect messages and
+     * for reporting errors.
      *
-     * @param name Name of the request attribute to set
-     * @param value The associated value
+     * @return A <code>StringBuffer</code> object containing the
+     *  reconstructed URL
      */
-    public void setAttribute(String name, Object value) {
-	
-        // Name cannot be null
-        if (name == null)
-            throw new IllegalArgumentException
-                (sm.getString("coyoteRequest.setAttribute.namenull"));
-
-        // Null value is the same as removeAttribute()
-        if (value == null) {
-            removeAttribute(name);
-            return;
-        }
-
-        if (name.equals(ServletRequestImpl.DISPATCHER_TYPE_ATTR)) {
-            dispatcherType = value;
-            return;
-        } else if (name.equals(ServletRequestImpl.DISPATCHER_REQUEST_PATH_ATTR)) {
-            requestDispatcherPath = value;
-            return;
-        }
-
-        Object oldValue = null;
-        boolean replaced = false;
+    public StringBuffer getRequestURL() {
 
-        // Add or replace the specified attribute
-        // Check for read only attribute
-        // requests are per thread so synchronization unnecessary
-        if (readOnlyAttributes.containsKey(name)) {
-            return;
-        }
+        StringBuffer url = new StringBuffer();
+        String scheme = getScheme();
+        int port = getServerPort();
+        if (port < 0)
+            port = 80; // Work around java.net.URL bug
 
-        oldValue = attributes.put(name, value);
-        if (oldValue != null) {
-            replaced = true;
+        url.append(scheme);
+        url.append("://");
+        url.append(getServerName());
+        if ((scheme.equals("http") && (port != 80))
+            || (scheme.equals("https") && (port != 443))) {
+            url.append(':');
+            url.append(port);
         }
+        url.append(getRequestURI());
 
-        // Pass special attributes to the native layer
-        if (name.startsWith("org.apache.tomcat.")) {
-            coyoteRequest.setAttribute(name, value);
-        }
-        
-        // Notify interested application event listeners
-        List listeners = context.getApplicationEventListeners();
-        if (listeners.size() == 0)
-            return;
-        ServletRequestAttributeEvent event = null;
+        return (url);
 
-        for (int i = 0; i < listeners.size(); i++) {
-            if (!(listeners.get(i) instanceof ServletRequestAttributeListener))
-                continue;
-            ServletRequestAttributeListener listener =
-                (ServletRequestAttributeListener) listeners.get(i);
-            try {
-                if (event == null) {
-                    if (replaced)
-                        event =
-                            new ServletRequestAttributeEvent(context.getServletContext(),
-                                                             getRequest(), name, oldValue);
-                    else
-                        event =
-                            new ServletRequestAttributeEvent(context.getServletContext(),
-                                                             getRequest(), name, value);
-                }
-                if (replaced) {
-                    listener.attributeReplaced(event);
-                } else {
-                    listener.attributeAdded(event);
-                }
-            } catch (Throwable t) {
-                context.getLogger().error(sm.getString("coyoteRequest.attributeEvent"), t);
-                // Error valve will pick this execption up and display it to user
-                attributes.put( ServletRequestImpl.EXCEPTION_ATTR, t );
-            }
-        }
     }
 
 
     /**
-     * Overrides the name of the character encoding used in the body of
-     * this request.  This method must be called prior to reading request
-     * parameters or reading input using <code>getReader()</code>.
-     *
-     * @param enc The character encoding to be used
-     *
-     * @exception UnsupportedEncodingException if the specified encoding
-     *  is not supported
-     *
-     * @since Servlet 2.3
+     * Return the Response with which this Request is associated.
      */
-    public void setCharacterEncoding(String enc)
-        throws UnsupportedEncodingException {
-
-        // Ensure that the specified encoding is valid
-        byte buffer[] = new byte[1];
-        buffer[0] = (byte) 'a';
-        String dummy = new String(buffer, enc);
-
-        // Save the validated encoding
-        coyoteRequest.setCharacterEncoding(enc);
-
+    public ServletResponseImpl getResponse() {
+        return (this.response);
     }
 
 
-    // ---------------------------------------------------- HttpRequest Methods
-
-
     /**
-     * Add a Cookie to the set of Cookies associated with this Request.
-     *
-     * @param cookie The new cookie
+     * Return the scheme used to make this Request.
      */
-    public void addCookie(Cookie cookie) {
-
-        if (!cookiesParsed)
-            parseCookies();
-
-        int size = 0;
-        if (cookies != null) {
-            size = cookies.length;
-        }
-
-        Cookie[] newCookies = new Cookie[size + 1];
-        for (int i = 0; i < size; i++) {
-            newCookies[i] = cookies[i];
+    public String getScheme() {
+        String scheme = con.reqB.scheme().toString();
+        if (scheme == null) {
+            scheme = (isSecure() ? "https" : "http");
         }
-        newCookies[size] = cookie;
-
-        cookies = newCookies;
-
+        return scheme;
     }
 
 
     /**
-     * Add a Header to the set of Headers associated with this Request.
-     *
-     * @param name The new header name
-     * @param value The new header value
+     * Return the server name responding to this Request.
      */
-    public void addHeader(String name, String value) {
-        // Not used
+    public String getServerName() {
+        return (con.serverName().toString());
     }
 
 
     /**
-     * Add a Locale to the set of preferred Locales for this Request.  The
-     * first added Locale will be the first one returned by getLocales().
-     *
-     * @param locale The new preferred Locale
+     * Return the server port responding to this Request.
      */
-    public void addLocale(Locale locale) {
-        locales.add(locale);
+    public int getServerPort() {
+        return (con.getServerPort());
     }
 
 
     /**
-     * Add a parameter name and corresponding set of values to this Request.
-     * (This is used when restoring the original request on a form based
-     * login).
-     *
-     * @param name Name of this request parameter
-     * @param values Corresponding values for this request parameter
+     * Return the portion of the request URI used to select the servlet
+     * that will process this request.
      */
-    public void addParameter(String name, String values[]) {
-        coyoteRequest.getParameters().addParameterValues(name, values);
+    public String getServletPath() {
+        return (mappingData.wrapperPath.toString());
     }
 
 
     /**
-     * Clear the collection of Cookies associated with this Request.
+     * Get the servlet path.
+     * 
+     * @return the servlet path
      */
-    public void clearCookies() {
-        cookiesParsed = true;
-        cookies = null;
+    public MessageBytes getServletPathMB() {
+        return (mappingData.wrapperPath);
     }
 
 
     /**
-     * Clear the collection of Headers associated with this Request.
+     * Return the session associated with this Request, creating one
+     * if necessary.
      */
-    public void clearHeaders() {
-        // Not used
-    }
-
-
-    /**
-     * Clear the collection of Locales associated with this Request.
-     */
-    public void clearLocales() {
-        locales.clear();
-    }
-
-
-    /**
-     * Clear the collection of parameters associated with this Request.
-     */
-    public void clearParameters() {
-        // Not used
-    }
-
-
-    /**
-     * Set the authentication type used for this request, if any; otherwise
-     * set the type to <code>null</code>.  Typical values are "BASIC",
-     * "DIGEST", or "SSL".
-     *
-     * @param type The authentication type used
-     */
-    public void setAuthType(String type) {
-        this.authType = type;
+    public HttpSession getSession() {
+        HttpSessionImpl session = doGetSession(true);
+        if (session != null) {
+            return session.getSession();
+        } else {
+            return null;
+        }
     }
 
 
     /**
-     * Set the context path for this Request.  This will normally be called
-     * when the associated Context is mapping the Request to a particular
-     * Wrapper.
+     * Return the session associated with this Request, creating one
+     * if necessary and requested.
      *
-     * @param path The context path
+     * @param create Create a new session if one does not exist
      */
-    public void setContextPath(String path) {
-
-        if (path == null) {
-            mappingData.contextPath.setString("");
+    public HttpSession getSession(boolean create) {
+        HttpSessionImpl session = doGetSession(create);
+        if (session != null) {
+            return session.getSession();
         } else {
-            mappingData.contextPath.setString(path);
+            return null;
         }
-
     }
 
 
     /**
-     * Set the HTTP request method used for this Request.
-     *
-     * @param method The request method
+     * Return the session associated with this Request, creating one
+     * if necessary.
      */
-    public void setMethod(String method) {
-        // Not used
+    public HttpSessionImpl getSessionInternal() {
+        return doGetSession(true);
     }
 
 
     /**
-     * Set the query string for this Request.  This will normally be called
-     * by the HTTP Connector, when it parses the request headers.
+     * Return the session associated with this Request, creating one
+     * if necessary and requested.
      *
-     * @param query The query string
+     * @param create Create a new session if one does not exist
      */
-    public void setQueryString(String query) {
-        // Not used
+    public HttpSessionImpl getSessionInternal(boolean create) {
+        return doGetSession(create);
     }
 
 
     /**
-     * Set the path information for this Request.  This will normally be called
-     * when the associated Context is mapping the Request to a particular
-     * Wrapper.
-     *
-     * @param path The path information
+     * Return the input stream associated with this Request.
      */
-    public void setPathInfo(String path) {
-        mappingData.pathInfo.setString(path);
+    public InputStream getStream() {
+        return inputStream;
     }
 
 
     /**
-     * Set a flag indicating whether or not the requested session ID for this
-     * request came in through a cookie.  This is normally called by the
-     * HTTP Connector, when it parses the request headers.
-     *
-     * @param flag The new flag
+     * Return the principal that has been authenticated for this Request.
      */
-    public void setRequestedSessionCookie(boolean flag) {
-
-        this.requestedSessionCookie = flag;
-
+    public Principal getUserPrincipal() {
+        return userPrincipal;
     }
 
 
     /**
-     * Set the requested session ID for this request.  This is normally called
-     * by the HTTP Connector, when it parses the request headers.
-     *
-     * @param id The new session id
+     * Return the Wrapper within which this Request is being processed.
      */
-    public void setRequestedSessionId(String id) {
-
-        this.requestedSessionId = id;
-
+    public ServletConfigImpl getWrapper() {
+        return (this.wrapper);
     }
 
 
     /**
-     * Set a flag indicating whether or not the requested session ID for this
-     * request came in through a URL.  This is normally called by the
-     * HTTP Connector, when it parses the request headers.
-     *
-     * @param flag The new flag
+     * Return <code>true</code> if the session identifier included in this
+     * request came from a cookie.
      */
-    public void setRequestedSessionURL(boolean flag) {
+    public boolean isRequestedSessionIdFromCookie() {
 
-        this.requestedSessionURL = flag;
+        if (requestedSessionId != null)
+            return (requestedSessionCookie);
+        else
+            return (false);
 
     }
 
 
     /**
-     * Set the unparsed request URI for this Request.  This will normally be
-     * called by the HTTP Connector, when it parses the request headers.
+     * Return <code>true</code> if the session identifier included in this
+     * request came from the request URI.
      *
-     * @param uri The request URI
+     * @deprecated As of Version 2.1 of the Java Servlet API, use
+     *  <code>isRequestedSessionIdFromURL()</code> instead.
      */
-    public void setRequestURI(String uri) {
-        // Not used
+    public boolean isRequestedSessionIdFromUrl() {
+        return (isRequestedSessionIdFromURL());
     }
 
 
     /**
-     * Set the decoded request URI.
-     * 
-     * @param uri The decoded request URI
+     * Return <code>true</code> if the session identifier included in this
+     * request came from the request URI.
      */
-    public void setDecodedRequestURI(String uri) {
-        // Not used
-    }
+    public boolean isRequestedSessionIdFromURL() {
 
+        if (requestedSessionId != null)
+            return (requestedSessionURL);
+        else
+            return (false);
 
-    /**
-     * Get the decoded request URI.
-     * 
-     * @return the URL decoded request URI
-     */
-    public String getDecodedRequestURI() {
-        return (coyoteRequest.decodedURI().toString());
     }
 
 
     /**
-     * Get the decoded request URI.
-     * 
-     * @return the URL decoded request URI
+     * Return <code>true</code> if the session identifier included in this
+     * request identifies a valid session.
      */
-    public MessageBytes getDecodedRequestURIMB() {
-        return (coyoteRequest.decodedURI());
-    }
-
-    public void decodeRequest() throws IOException {
-        MessageBytes decodedURI = getDecodedRequestURIMB();
-        decodedURI.duplicate(coyoteRequest.requestURI());
+    public boolean isRequestedSessionIdValid() {
 
-        if (decodedURI.getType() == MessageBytes.T_BYTES) {
-            // %xx decoding of the URL
-            coyoteRequest.getURLDecoder().convert(decodedURI, false);
-            // Normalization
-            if (!normalize(decodedURI)) {
-                throw new IOException("Error normalizing");
-            }
-            // Character decoding
-            //convertURI(decodedURI, request);
-        } else {
-            // The URL is chars or String, and has been sent using an in-memory
-            // protocol handler, we have to assume the URL has been properly
-            // decoded already
-            decodedURI.toChars();
+        if (requestedSessionId == null)
+            return (false);
+        if (context == null)
+            return (false);
+        SessionManagerServlet manager = context.getManager();
+        if (manager == null)
+            return (false);
+        HttpSessionImpl session = null;
+        try {
+            session = manager.findSession(requestedSessionId);
+        } catch (IOException e) {
+            session = null;
         }
+        if ((session != null) && session.isValid())
+            return (true);
+        else
+            return (false);
 
+    }
 
+    /**
+     * Was this request received on a secure connection?
+     */
+    public boolean isSecure() {
+        return (secure);
     }
     
     
     /**
-     * Normalize URI.
-     * <p>
-     * This method normalizes "\", "//", "/./" and "/../". This method will
-     * return false when trying to go above the root, or if the URI contains
-     * a null byte.
-     * 
-     * @param uriMB URI to be normalized
+     * Return <code>true</code> if the authenticated user principal
+     * possesses the specified role name.
+     *
+     * @param role Role name to be validated
      */
-    public static boolean normalize(MessageBytes uriMB) {
-
-        ByteChunk uriBC = uriMB.getByteChunk();
-        byte[] b = uriBC.getBytes();
-        int start = uriBC.getStart();
-        int end = uriBC.getEnd();
-
-        // URL * is acceptable
-        if ((end - start == 1) && b[start] == (byte) '*')
-          return true;
-
-        int pos = 0;
-        int index = 0;
-
-        // Replace '\' with '/'
-        // Check for null byte
-        for (pos = start; pos < end; pos++) {
-            if (b[pos] == (byte) '\\')
-                b[pos] = (byte) '/';
-            if (b[pos] == (byte) 0)
-                return false;
-        }
+    public boolean isUserInRole(String role) {
+        // Have we got an authenticated principal at all?
+        Principal userPrincipal = getPrincipal();
+        if (userPrincipal == null)
+            return (false);
 
-        // The URL must start with '/'
-        if (b[start] != (byte) '/') {
-            return false;
-        }
+        // Identify the Realm we will use for checking role assignmenets
+        if (context == null)
+            return (false);
 
-        // Replace "//" with "/"
-        for (pos = start; pos < (end - 1); pos++) {
-            if (b[pos] == (byte) '/') {
-                while ((pos + 1 < end) && (b[pos + 1] == (byte) '/')) {
-                    copyBytes(b, pos, pos + 1, end - pos - 1);
-                    end--;
-                }
+        // Check for a role alias defined in a <security-role-ref> element
+        if (wrapper != null) {
+            String realRole = wrapper.getSecurityRoleRef(role);
+            if (realRole != null) {
+                role = realRole;
             }
         }
 
-        // If the URI ends with "/." or "/..", then we append an extra "/"
-        // Note: It is possible to extend the URI by 1 without any side effect
-        // as the next character is a non-significant WS.
-        if (((end - start) >= 2) && (b[end - 1] == (byte) '.')) {
-            if ((b[end - 2] == (byte) '/') 
-                || ((b[end - 2] == (byte) '.') 
-                    && (b[end - 3] == (byte) '/'))) {
-                b[end] = (byte) '/';
-                end++;
-            }
+        if (role.equals(userPrincipal.getName())) {
+            return true;
         }
+        
+        // TODO: check !!!!
+        // Check for a role defined directly as a <security-role>
+        return false;
+    }
 
-        uriBC.setEnd(end);
+    /**
+     * Release all object references, and initialize instance variables, in
+     * preparation for reuse of this object.
+     */
+    public void recycle() {
 
-        index = 0;
+        context = null;
+        wrapper = null;
 
-        // Resolve occurrences of "/./" in the normalized path
-        while (true) {
-            index = uriBC.indexOf("/./", 0, 3, index);
-            if (index < 0)
-                break;
-            copyBytes(b, start + index, start + index + 2, 
-                      end - start - index - 2);
-            end = end - 2;
-            uriBC.setEnd(end);
-        }
+        dispatcherType = null;
+        requestDispatcherPath = null;
 
-        index = 0;
+        authType = null;
+        inputBuffer.recycle();
+        usingInputStream = false;
+        usingReader = false;
+        userPrincipal = null;
+        subject = null;
+        sessionParsed = false;
+        parametersParsed = false;
+        cookiesParsed = false;
+        locales.clear();
+        localesParsed = false;
+        secure = false;
 
-        // Resolve occurrences of "/../" in the normalized path
-        while (true) {
-            index = uriBC.indexOf("/../", 0, 4, index);
-            if (index < 0)
-                break;
-            // Prevent from going outside our context
-            if (index == 0)
-                return false;
-            int index2 = -1;
-            for (pos = start + index - 1; (pos >= 0) && (index2 < 0); pos --) {
-                if (b[pos] == (byte) '/') {
-                    index2 = pos;
-                }
-            }
-            copyBytes(b, start + index2, start + index + 3,
-                      end - start - index - 3);
-            end = end + index2 - index - 3;
-            uriBC.setEnd(end);
-            index = index2;
+        attributes.clear();
+        //notes.clear();
+        cookies = null;
+
+        if (session != null) {
+            session.endAccess();
         }
+        session = null;
+        requestedSessionCookie = false;
+        requestedSessionId = null;
+        requestedSessionURL = false;
 
-        //uriBC.setBytes(b, start, end);
-        uriBC.setEnd(end);
-        return true;
+        parameterMap.setLocked(false);
+        parameterMap.clear();
 
-    }
+        mappingData.recycle();
 
-    /**
-     * Copy an array of bytes to a different position. Used during 
-     * normalization.
-     */
-    protected static void copyBytes(byte[] b, int dest, int src, int len) {
-        for (int pos = 0; pos < len; pos++) {
-            b[pos + dest] = b[pos + src];
-        }
     }
 
 
     /**
-     * Set the servlet path for this Request.  This will normally be called
-     * when the associated Context is mapping the Request to a particular
-     * Wrapper.
+     * Remove the specified request attribute if it exists.
      *
-     * @param path The servlet path
+     * @param name Name of the request attribute to remove
      */
-    public void setServletPath(String path) {
-        if (path != null)
-            mappingData.wrapperPath.setString(path);
+    public void removeAttribute(String name) {
+        Object value = null;
+        boolean found = false;
+
+        // Remove the specified attribute
+        // Check for read only attribute
+        // requests are per thread so synchronization unnecessary
+//        if (readOnlyAttributes.containsKey(name)) {
+//            return;
+//        }
+        found = attributes.containsKey(name);
+        if (found) {
+            value = attributes.get(name);
+            attributes.remove(name);
+        } else {
+            return;
+        }
+
+        // Notify interested application event listeners
+        List listeners = context.getApplicationEventListeners();
+        if (listeners.size() == 0)
+            return;
+        ServletRequestAttributeEvent event = null;
+        for (int i = 0; i < listeners.size(); i++) {
+            if (!(listeners.get(i) instanceof ServletRequestAttributeListener))
+                continue;
+            ServletRequestAttributeListener listener =
+                (ServletRequestAttributeListener) listeners.get(i);
+            try {
+                if (event == null) {
+                    event = 
+                        new ServletRequestAttributeEvent(context.getServletContext(),
+                            getRequest(), name, value);
+                }
+                listener.attributeRemoved(event);
+            } catch (Throwable t) {
+                context.getLogger().error(sm.getString("con.reqB.attributeEvent"), t);
+                // Error valve will pick this execption up and display it to user
+                attributes.put( ServletRequestImpl.EXCEPTION_ATTR, t );
+            }
+        }
     }
 
 
     /**
-     * Set the Principal who has been authenticated for this Request.  This
-     * value is also used to calculate the value to be returned by the
-     * <code>getRemoteUser()</code> method.
+     * Set the specified request attribute to the specified value.
      *
-     * @param principal The user Principal
+     * @param name Name of the request attribute to set
+     * @param value The associated value
      */
-    public void setUserPrincipal(Principal principal) {
-
-        if (System.getSecurityManager() != null){
-            HttpSession session = getSession(false);
-            if ( (subject != null) && 
-                 (!subject.getPrincipals().contains(principal)) ){
-                subject.getPrincipals().add(principal);         
-            } else if (session != null &&
-                        session.getAttribute(ServletRequestImpl.SUBJECT_ATTR) == null) {
-                subject = new Subject();
-                subject.getPrincipals().add(principal);         
-            }
-            if (session != null){
-                session.setAttribute(ServletRequestImpl.SUBJECT_ATTR, subject);
-            }
-        } 
-
-        this.userPrincipal = principal;
-    }
-
+    public void setAttribute(String name, Object value) {
+	
+        // Name cannot be null
+        if (name == null)
+            throw new IllegalArgumentException
+                (sm.getString("con.reqB.setAttribute.namenull"));
 
-    // --------------------------------------------- HttpServletRequest Methods
+        // Null value is the same as removeAttribute()
+        if (value == null) {
+            removeAttribute(name);
+            return;
+        }
 
+        if (name.equals(ServletRequestImpl.DISPATCHER_TYPE_ATTR)) {
+            dispatcherType = value;
+            return;
+        } else if (name.equals(ServletRequestImpl.DISPATCHER_REQUEST_PATH_ATTR)) {
+            requestDispatcherPath = value;
+            return;
+        }
 
-    /**
-     * Return the authentication type used for this Request.
-     */
-    public String getAuthType() {
-        return (authType);
-    }
+        Object oldValue = null;
+        boolean replaced = false;
 
+        // Add or replace the specified attribute
+        // Check for read only attribute
+        // requests are per thread so synchronization unnecessary
+//        if (readOnlyAttributes.containsKey(name)) {
+//            return;
+//        }
 
-    /**
-     * Return the portion of the request URI used to select the Context
-     * of the Request.
-     */
-    public String getContextPath() {
-        return (mappingData.contextPath.toString());
-    }
+        oldValue = attributes.put(name, value);
+        if (oldValue != null) {
+            replaced = true;
+        }
 
+        // Pass special attributes to the native layer
+//        if (name.startsWith("org.apache.tomcat.")) {
+//            con.reqB.setAttribute(name, value);
+//        }
+//        
+        // Notify interested application event listeners
+        List listeners = context.getApplicationEventListeners();
+        if (listeners.size() == 0)
+            return;
+        ServletRequestAttributeEvent event = null;
 
-    /**
-     * Get the context path.
-     * 
-     * @return the context path
-     */
-    public MessageBytes getContextPathMB() {
-        return (mappingData.contextPath);
+        for (int i = 0; i < listeners.size(); i++) {
+            if (!(listeners.get(i) instanceof ServletRequestAttributeListener))
+                continue;
+            ServletRequestAttributeListener listener =
+                (ServletRequestAttributeListener) listeners.get(i);
+            try {
+                if (event == null) {
+                    if (replaced)
+                        event =
+                            new ServletRequestAttributeEvent(context.getServletContext(),
+                                                             getRequest(), name, oldValue);
+                    else
+                        event =
+                            new ServletRequestAttributeEvent(context.getServletContext(),
+                                                             getRequest(), name, value);
+                }
+                if (replaced) {
+                    listener.attributeReplaced(event);
+                } else {
+                    listener.attributeAdded(event);
+                }
+            } catch (Throwable t) {
+                context.getLogger().error(sm.getString("con.reqB.attributeEvent"), t);
+                // Error valve will pick this execption up and display it to user
+                attributes.put( ServletRequestImpl.EXCEPTION_ATTR, t );
+            }
+        }
     }
 
 
-    /**
-     * Return the set of Cookies received with this Request.
-     */
-    public Cookie[] getCookies() {
-
-        if (!cookiesParsed)
-            parseCookies();
-
-        return cookies;
-
-    }
+    // --------------------------------------------- HttpServletRequest Methods
 
 
     /**
-     * Set the set of cookies recieved with this Request.
+     * Set the authentication type used for this request, if any; otherwise
+     * set the type to <code>null</code>.  Typical values are "BASIC",
+     * "DIGEST", or "SSL".
+     *
+     * @param type The authentication type used
      */
-    public void setCookies(Cookie[] cookies) {
-
-        this.cookies = cookies;
-
+    public void setAuthType(String type) {
+        this.authType = type;
     }
 
 
     /**
-     * Return the value of the specified date header, if any; otherwise
-     * return -1.
+     * Overrides the name of the character encoding used in the body of
+     * this request.  This method must be called prior to reading request
+     * parameters or reading input using <code>getReader()</code>.
      *
-     * @param name Name of the requested date header
+     * @param enc The character encoding to be used
      *
-     * @exception IllegalArgumentException if the specified header value
-     *  cannot be converted to a date
+     * @exception UnsupportedEncodingException if the specified encoding
+     *  is not supported
+     *
+     * @since Servlet 2.3
      */
-    public long getDateHeader(String name) {
+    public void setCharacterEncoding(String enc)
+        throws UnsupportedEncodingException {
 
-        String value = getHeader(name);
-        if (value == null)
-            return (-1L);
+        // Ensure that the specified encoding is valid
+        byte buffer[] = new byte[1];
+        buffer[0] = (byte) 'a';
+        String dummy = new String(buffer, enc);
 
-        // Attempt to convert the date header in a variety of formats
-        long result = FastHttpDateFormat.parseDate(value, formats);
-        if (result != (-1L)) {
-            return result;
-        }
-        throw new IllegalArgumentException(value);
+        // Save the validated encoding
+        con.reqB.setCharacterEncoding(enc);
 
     }
 
 
+    public void setConnection(Http11Connection con) {
+        this.con = con;
+        con.reqB.messageWriter.setConnection(con);
+        inputBuffer.setChannel(con);
+    }
+
+
     /**
-     * Return the first value of the specified header, if any; otherwise,
-     * return <code>null</code>
+     * Set the content length associated with this Request.
      *
-     * @param name Name of the requested header
+     * @param length The new content length
      */
-    public String getHeader(String name) {
-        return coyoteRequest.getHeader(name);
+    public void setContentLength(int length) {
+        // Not used
     }
 
 
     /**
-     * Return all of the values of the specified header, if any; otherwise,
-     * return an empty enumeration.
+     * Set the content type (and optionally the character encoding)
+     * associated with this Request.  For example,
+     * <code>text/html; charset=ISO-8859-4</code>.
      *
-     * @param name Name of the requested header
+     * @param type The new content type
      */
-    public Enumeration getHeaders(String name) {
-        return coyoteRequest.getMimeHeaders().values(name);
+    public void setContentType(String type) {
+        // Not used
     }
 
 
     /**
-     * Return the names of all headers received with this request.
+     * 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 <code>getContextPath()</code>,
+     * and thus enables parsing of the request URI.
+     *
+     * @param context The newly associated Context
      */
-    public Enumeration getHeaderNames() {
-        return coyoteRequest.getMimeHeaders().names();
+    public void setContext(ServletContextImpl context) {
+        this.context = context;
     }
 
 
     /**
-     * Return the value of the specified header as an integer, or -1 if there
-     * is no such header for this request.
-     *
-     * @param name Name of the requested header
+     * Set the context path for this Request.  This will normally be called
+     * when the associated Context is mapping the Request to a particular
+     * Wrapper.
      *
-     * @exception IllegalArgumentException if the specified header value
-     *  cannot be converted to an integer
+     * @param path The context path
      */
-    public int getIntHeader(String name) {
+    public void setContextPath(String path) {
 
-        String value = getHeader(name);
-        if (value == null) {
-            return (-1);
+        if (path == null) {
+            mappingData.contextPath.setString("");
         } else {
-            return (Integer.parseInt(value));
+            mappingData.contextPath.setString(path);
         }
 
     }
 
 
     /**
-     * Return the HTTP request method used in this Request.
+     * Set the set of cookies recieved with this Request.
      */
-    public String getMethod() {
-        return coyoteRequest.method().toString();
-    }
+    public void setCookies(Cookie[] cookies) {
 
+        this.cookies = cookies;
 
-    /**
-     * Return the path information associated with this Request.
-     */
-    public String getPathInfo() {
-        return (mappingData.pathInfo.toString());
     }
 
 
     /**
-     * Get the path info.
+     * Set the decoded request URI.
      * 
-     * @return the path info
+     * @param uri The decoded request URI
      */
-    public MessageBytes getPathInfoMB() {
-        return (mappingData.pathInfo);
+    public void setDecodedRequestURI(String uri) {
+        // Not used
     }
 
 
     /**
-     * Return the extra path information for this request, translated
-     * to a real path.
+     * Set the HTTP request method used for this Request.
+     *
+     * @param method The request method
      */
-    public String getPathTranslated() {
-
-        if (context == null)
-            return (null);
-
-        if (getPathInfo() == null) {
-            return (null);
-        } else {
-            return (context.getServletContext().getRealPath(getPathInfo()));
-        }
-
+    public void setMethod(String method) {
+        // Not used
     }
 
 
     /**
-     * Return the query string associated with this request.
+     * Set the path information for this Request.  This will normally be called
+     * when the associated Context is mapping the Request to a particular
+     * Wrapper.
+     *
+     * @param path The path information
      */
-    public String getQueryString() {
-        String queryString = coyoteRequest.queryString().toString();
-        if (queryString == null || queryString.equals("")) {
-            return (null);
-        } else {
-            return queryString;
-        }
+    public void setPathInfo(String path) {
+        mappingData.pathInfo.setString(path);
     }
 
 
     /**
-     * Return the name of the remote user that has been authenticated
-     * for this Request.
+     * Set the protocol name and version associated with this Request.
+     *
+     * @param protocol Protocol name and version
      */
-    public String getRemoteUser() {
+    public void setProtocol(String protocol) {
+        // Not used
+    }
 
-        if (userPrincipal != null) {
-            return (userPrincipal.getName());
-        } else {
-            return (null);
-        }
 
+    /**
+     * Set the query string for this Request.  This will normally be called
+     * by the HTTP Connector, when it parses the request headers.
+     *
+     * @param query The query string
+     */
+    public void setQueryString(String query) {
+        // Not used
     }
 
 
     /**
-     * Get the request path.
-     * 
-     * @return the request path
+     * Set the IP address of the remote client associated with this Request.
+     *
+     * @param remoteAddr The remote IP address
      */
-    public MessageBytes getRequestPathMB() {
-        return (mappingData.requestPath);
+    public void setRemoteAddr(String remoteAddr) {
+        // Not used
     }
 
 
     /**
-     * Return the session identifier included in this request, if any.
+     * Set the fully qualified name of the remote client associated with this
+     * Request.
+     *
+     * @param remoteHost The remote host name
      */
-    public String getRequestedSessionId() {
-        return (requestedSessionId);
+    public void setRemoteHost(String remoteHost) {
+        // Not used
     }
 
 
     /**
-     * Return the request URI for this request.
+     * Set a flag indicating whether or not the requested session ID for this
+     * request came in through a cookie.  This is normally called by the
+     * HTTP Connector, when it parses the request headers.
+     *
+     * @param flag The new flag
      */
-    public String getRequestURI() {
-        return coyoteRequest.requestURI().toString();
+    public void setRequestedSessionCookie(boolean flag) {
+
+        this.requestedSessionCookie = flag;
+
     }
 
 
     /**
-     * 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.
-     * <p>
-     * Because this method returns a <code>StringBuffer</code>,
-     * not a <code>String</code>, you can modify the URL easily,
-     * for example, to append query parameters.
-     * <p>
-     * This method is useful for creating redirect messages and
-     * for reporting errors.
+     * Set the requested session ID for this request.  This is normally called
+     * by the HTTP Connector, when it parses the request headers.
      *
-     * @return A <code>StringBuffer</code> object containing the
-     *  reconstructed URL
+     * @param id The new session id
      */
-    public StringBuffer getRequestURL() {
+    public void setRequestedSessionId(String id) {
 
-        StringBuffer url = new StringBuffer();
-        String scheme = getScheme();
-        int port = getServerPort();
-        if (port < 0)
-            port = 80; // Work around java.net.URL bug
+        this.requestedSessionId = id;
 
-        url.append(scheme);
-        url.append("://");
-        url.append(getServerName());
-        if ((scheme.equals("http") && (port != 80))
-            || (scheme.equals("https") && (port != 443))) {
-            url.append(':');
-            url.append(port);
-        }
-        url.append(getRequestURI());
+    }
+
+
+    /**
+     * Set a flag indicating whether or not the requested session ID for this
+     * request came in through a URL.  This is normally called by the
+     * HTTP Connector, when it parses the request headers.
+     *
+     * @param flag The new flag
+     */
+    public void setRequestedSessionURL(boolean flag) {
 
-        return (url);
+        this.requestedSessionURL = flag;
 
     }
 
 
     /**
-     * Return the portion of the request URI used to select the servlet
-     * that will process this request.
+     * Set the unparsed request URI for this Request.  This will normally be
+     * called by the HTTP Connector, when it parses the request headers.
+     *
+     * @param uri The request URI
      */
-    public String getServletPath() {
-        return (mappingData.wrapperPath.toString());
+    public void setRequestURI(String uri) {
+        // Not used
     }
 
 
     /**
-     * Get the servlet path.
-     * 
-     * @return the servlet path
+     * Set the Response with which this Request is associated.
+     *
+     * @param response The new associated response
      */
-    public MessageBytes getServletPathMB() {
-        return (mappingData.wrapperPath);
+    public void setResponse(ServletResponseImpl response) {
+        this.response = response;
     }
 
 
     /**
-     * Return the session associated with this Request, creating one
-     * if necessary.
+     * Set the name of the scheme associated with this request.  Typical values
+     * are <code>http</code>, <code>https</code>, and <code>ftp</code>.
+     *
+     * @param scheme The scheme
      */
-    public HttpSession getSession() {
-        HttpSessionImpl session = doGetSession(true);
-        if (session != null) {
-            return session.getSession();
-        } else {
-            return null;
-        }
+    public void setScheme(String scheme) {
+        // Not used
     }
 
 
     /**
-     * Return the session associated with this Request, creating one
-     * if necessary and requested.
+     * Set the value to be returned by <code>isSecure()</code>
+     * for this Request.

[... 769 lines stripped ...]


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message