Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /*
    * JBoss, Home of Professional Open Source.
    * Copyright 2012 Red Hat, Inc., and individual contributors
    * as indicated by the @author tags.
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
    *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.catalina.connector;
  
  
  import static org.jboss.web.CatalinaMessages.MESSAGES;
  
  import java.io.File;
  import java.util.HashMap;
  import java.util.Locale;
  import java.util.Map;
  import java.util.Random;
  import java.util.TreeMap;
  
  
Wrapper object for the Coyote request.

Author(s):
Remy Maucherat
Craig R. McClanahan
Version:
$Revision: 2040 $ $Date: 2012-06-07 15:48:42 +0200 (Thu, 07 Jun 2012) $
 
 
 public class Request
     implements HttpServletRequest {
 
 
     protected static final boolean SESSION_ID_CHECK = 
         Boolean.valueOf(System.getProperty("org.apache.catalina.connector.Request.SESSION_ID_CHECK""true")).booleanValue();
 
 
     protected static final boolean WRAPPED_RESPONSE_IN_LOGIN = 
         || Boolean.valueOf(System.getProperty("org.apache.catalina.connector.Request.WRAPPED_RESPONSE_IN_LOGIN""false")).booleanValue();
 
     
     protected static final boolean CHECK_ASYNC = 
         || Boolean.valueOf(System.getProperty("org.apache.catalina.connector.Request.CHECK_ASYNC""true")).booleanValue();
 
 
     protected static final boolean USE_PRINCIPAL_FROM_SESSION = 
         Boolean.valueOf(System.getProperty("org.apache.catalina.connector.Request.USE_PRINCIPAL_FROM_SESSION""false")).booleanValue();
 
 
     protected static final boolean LOCAL_RANDOM = 
         Boolean.valueOf(System.getProperty("org.apache.catalina.connector.Request.LOCAL_RANDOM", (.....) ? "false" : "true")).booleanValue();
 
 
     protected static final boolean SEED_WITH_NEXT_BYTES = 
         Boolean.valueOf(System.getProperty("org.apache.catalina.connector.Request.SEED_WITH_NEXT_BYTES""true")).booleanValue();
 
 
     protected static final boolean THROW_POST_TOO_LARGE =
         Boolean.valueOf(System.getProperty("org.apache.catalina.connector.Request.THROW_POST_TOO_LARGE""false")).booleanValue();
 
 
     // ----------------------------------------------------------- Constructors
 
 
     static {
         // Ensure that classes are loaded for SM
         new StringCache.ByteEntry();
         new StringCache.CharEntry();
         new EncodingToCharset();
     }
 
     public Request() {
 
         [0].setTimeZone();
         [1].setTimeZone();
         [2].setTimeZone();
         
     }
 
 
     // ------------------------------------------------------------- Properties
 

    
Coyote request.
 
     protected org.apache.coyote.Request coyoteRequest;

    
Set the Coyote request.

Parameters:
coyoteRequest The Coyote request
 
     public void setCoyoteRequest(org.apache.coyote.Request coyoteRequest) {
         this. = coyoteRequest;
         .setRequest(coyoteRequest);
     }

    
Get the Coyote request.
 
     public org.apache.coyote.Request getCoyoteRequest() {
         return (this.);
     }
 
 
     // ----------------------------------------------------- Variables
 
 
     protected static final TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");


    
The set of cookies associated with this Request.
 
     protected Cookie[] cookies = null;


    
The set of SimpleDateFormat formats to use in getDateHeader(). 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".),
         new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz".),
         new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy".)
     };


    
The default Locale if none are specified.
 
     protected static Locale defaultLocale = Locale.getDefault();


    
The attributes associated with this Request, keyed by attribute name.
 
     protected HashMap attributes = new HashMap();


    
List of read only attributes for this Request.
 
     private HashMap readOnlyAttributes = new HashMap();


    
The preferred Locales assocaited with this Request.
 
     protected ArrayList locales = new ArrayList();


    
Internal notes associated with this request by Catalina components and event listeners.
 
     private transient HashMap notes = new HashMap();


    
Servlet 3.0 asynchronous mode context (also used as a flag - when not null, we're in asynchronous mode).
 
     protected AsyncContextImpl asyncContext = null;
    
    
    
Authentication type.
 
     protected String authType = null;

    
    
Async timeout.
 
     protected long asyncTimeout = -1;
    
    
    
Async listeners.
 
         new LinkedHashMap<AsyncListenerAsyncListenerRegistration>();
    
    
    
Associated event.
 
     protected HttpEventImpl event = null;
    

    
Event mode flag
 
     protected boolean eventMode = false;
    
    
    
The current dispatcher type.
 
     protected Object dispatcherType = null;


    
The associated input buffer.
 
     protected InputBuffer inputBuffer = new InputBuffer(this);


    
ServletInputStream.
 
     protected CoyoteInputStream inputStream = 
         new CoyoteInputStream();


    
Reader.
 
     protected CoyoteReader reader = new CoyoteReader();


    
Using stream flag.
 
     protected boolean usingInputStream = false;


    
Using writer flag.
 
     protected boolean usingReader = false;


    
Application input stream.
 
     protected ServletInputStream applicationInputStream = null;


    
Application reader.
 
     protected BufferedReader applicationReader = null;


    
User principal.
 
     protected Principal userPrincipal = null;


    
Session parsed flag.
 
     protected boolean sessionParsed = false;


    
Request parameters parsed flag.
 
     protected boolean parametersParsed = false;


    
Cookies parsed flag.
 
     protected boolean cookiesParsed = false;


    
Secure flag.
 
     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;

    
    
Parts associated with the request.
 
     protected Map<StringPartparts = null;
    

    
Hash map used in the getParametersMap method.
 
     protected ParameterMap parameterMap = new ParameterMap();


    
The currently active session for this request.
 
     protected Session session = null;


    
The current request dispatcher path.
 
     protected Object requestDispatcherPath = null;


    
Was the requested session ID received in a cookie?
 
     protected boolean requestedSessionCookie = false;


    
The requested session ID (if any) for this request.
 
     protected String requestedSessionId = null;


    
Was the requested session ID received in a URL?
 
     protected boolean requestedSessionURL = false;


    
Parse locales.
 
     protected boolean localesParsed = false;


    
The string parser we will use for parsing request lines.
 
     private StringParser parser = new StringParser();


    
Local port
 
     protected int localPort = -1;

    
Remote address.
 
     protected String remoteAddr = null;


    
Remote host.
 
     protected String remoteHost = null;

    
    
Remote port
 
     protected int remotePort = -1;
    
    
Local address
 
     protected String localAddr = null;

    
    
Local address
 
     protected String localName = null;

    
    
Can call startAsync.
 
     protected boolean canStartAsync = true;
    

    
Get SSL attributes.
 
     protected boolean sslAttributes = false;
    

    
Random generator.
 
     protected Random random = null;

    
    
Async listener instances.
 
     protected LinkedList<AsyncListenerasyncListenerInstances = new LinkedList<AsyncListener>();
    

    
Upgrade handler.
 
     protected HttpUpgradeHandler upgradeHandler = null;
 
 
     // --------------------------------------------------------- Public Methods
 

    
Release all object references, and initialize instance variables, in preparation for reuse of this object.
 
     public void recycle() {
 
         if ( != null &&  != null) {
             for (AsyncListener listener : ) {
                 try {
                     .getInstanceManager().destroyInstance(listener);
                 } catch (Throwable t) {
                     .getLogger().error(.preDestroyException(), t);
                 }
             }
             .clear();
         }
 
          = null;
          = null;
 
          = null;
          = null;
 
          = false;
         if ( != null) {
             .clear();
              = null;
         }
          = null;
 
          = false;
          = null;
          = -1;
          = true;
         .clear();
          = null;
         .recycle();
          = false;
          = false;
          = null;
          = null;
          = null;
          = null;
          = false;
          = false;
          = false;
         .clear();
          = false;
          = false;
          = null;
          = null;
          = -1;
          = -1;
          = null;
          = null;
          = -1;
         .clear();
 
         .clear();
         .clear();
          = null;
          = null;
 
         if ( != null) {
             .endAccess();
         }
          = null;
          = false;
          = null;
          = false;
 
              = new ParameterMap();
         } else {
             .setLocked(false);
             .clear();
         }
 
         .recycle();
 
             if ( != null) {
                 .clear();
                  = null;
             }
             if ( != null) {
                 .clear();
                  = null;
             }
             if ( != null) {
                 .clear();
                  = null;
             }
         }
 
     }


    
Clear output stream.
 
     public void clearInputStream() {
         if ( != null) {
             .clear();
              = null;
         }
     }
    

    
Clear cached encoders (to save memory for event or async requests).
 
     public void clearEncoders() {
         .clearEncoders();
     }
    

    
Read bytes into the low level buffer.
 
     public int read()
         throws IOException {
         return (.realReadBytes(null, 0, 0));
     }
    

    
Return true if the EOF has been reached.
 
     public boolean isEof() {
         return (.isEof());
     }
    

    
Return true if bytes are available.
 
     public boolean isReadable() {
         return (.available() > 0);
     }
 
     
     // -------------------------------------------------------- Request Methods
 

    
Associated Catalina connector.
 
     protected Connector connector;

    
Return the Connector through which this Request was received.
 
     public Connector getConnector() {
         return (this.);
     }

    
Set the Connector through which this Request was received.

Parameters:
connector The new connector
 
     public void setConnector(Connector connector) {
         this. = connector;
         if () {
             if () {
                 byte[] seed = new byte[16];
                 connector.getService().getRandom().nextBytes(seed);
                  = new SecureRandom(seed);
             } else {
                  = new SecureRandom(connector.getService().getRandom().generateSeed(16));
             }
         } else {
              = connector.getService().getRandom();
         }
     }


    
Associated context.
 
     protected Context context = null;

    
Return the Context within which this Request is being processed.
 
     public Context getContext() {
         return (this.);
     }


    
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 getContextPath(), and thus enables parsing of the request URI.

Parameters:
context The newly associated Context
 
     public void setContext(Context context) {
         this. = context;
     }


    
Return the Random.
 
     public Random getRandom() {
         return (this.);
     }

    
Filter chains associated with the request.
 
     protected ArrayList<ApplicationFilterChainfilterChains = new ArrayList<ApplicationFilterChain>();
    
    
    
Number of filter chains used.
 
     protected int currentFilterChain = -1;
    
    
    
Get filter chain associated with the request.
 
         if ( >= 0 &&  < .size()) {
             return .get();
         } else {
             return null;
         }
     }


    
Set filter chain associated with the request.

Parameters:
filterChain new filter chain
 
     public void setFilterChain(ApplicationFilterChain filterChain) {
         if ( >= 0 &&  < .size()) {
             .set(filterChain);
         } else {
             .add(filterChain);
         }
     }


    
Set filter chain associated with the request.

Parameters:
filterChain new filter chain
 
     public void nextFilterChain() {
         ++;
     }


    
Set filter chain associated with the request.

Parameters:
filterChain new filter chain
 
     public void releaseFilterChain() {
         --;
     }


    
Return the Host within which this Request is being processed.
 
     public Host getHost() {
         return ((Host.);
     }


    
Set the Host within which this Request is being processed. This must be called as soon as the appropriate Host is identified, and before the Request is passed to a context.

Parameters:
host The newly associated Host
 
     public void setHost(Host host) {
         . = host;
     }


    
Descriptive information about this Request implementation.
 
     protected static final String info =
         "org.apache.coyote.catalina.CoyoteRequest/1.0";

    
Return descriptive information about this Request implementation and the corresponding version number, in the format <description>/<version>.
 
     public String getInfo() {
         return ();
     }


    
Mapping data.
 
     protected MappingData mappingData = new MappingData();

    
Return mapping data.
 
     public MappingData getMappingData() {
         return ();
     }


    
The facade associated with this request.
 
     protected RequestFacade facade = null;

    
Return the ServletRequest for which this object is the facade. This method must be implemented by a subclass.
 
     public HttpServletRequest getRequest() {
         if ( == null) {
              = new RequestFacade(this);
         } 
         return ();
     }


    
Alias for AsyncContext inner class.
 
     public HttpServletRequest getRequestFacade() {
         return getRequest();
     }

    
The response with which this request is associated.
 
     protected org.apache.catalina.connector.Response response = null;

    
Return the Response with which this Request is associated.
 
         return (this.);
     }

    
Set the Response with which this Request is associated.

Parameters:
response The new associated response
 
     public void setResponse(org.apache.catalina.connector.Response response) {
         this. = response;
     }

    
Alias for AsyncContext inner class.
 
         return getResponse().getResponse();
     }

    
Return the input stream associated with this Request.
 
     public InputStream getStream() {
         if ( == null) {
              = new CoyoteInputStream();
         }
         return ;
     }

    
URI byte to char converter (not recycled).
 
     protected B2CConverter URIConverter = null;

    
Return the URI converter.
 
     protected B2CConverter getURIConverter() {
         return ;
     }

    
Set the URI converter.

Parameters:
URIConverter the new URI connverter
 
     protected void setURIConverter(B2CConverter URIConverter) {
         this. = URIConverter;
     }


    
Associated wrapper.
 
     protected Wrapper wrapper = null;

    
Return the Wrapper within which this Request is being processed.
 
     public Wrapper getWrapper() {
         return (this.);
     }


    
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.

Parameters:
wrapper The newly associated Wrapper
 
     public void setWrapper(Wrapper wrapper) {
         this. = wrapper;
     }
 
 
     public boolean getCanStartAsync() {
         return ;
     }
 
     public void setCanStartAsync(boolean canStartAsync) {
         this. = canStartAsync;
     }
 
     // ------------------------------------------------- Request Public Methods
 

    
Create and return a ServletInputStream to read the content associated with this Request.

Throws:
java.io.IOException if an input/output error occurs
 
         throws IOException {
         if ( == null) {
              = new CoyoteInputStream();
         }
         return ;
     }


    
Perform whatever actions are required to flush and close the input stream or reader, in a single operation.

Throws:
java.io.IOException if an input/output error occurs
 
     public void finishRequest() throws IOException {
         // The reader and input stream don't need to be closed
     }


    
Return the object bound with the specified name to the internal notes for this request, or null if no such binding exists.

Parameters:
name Name of the note to be returned
 
     public Object getNote(String name) {
         return (.get(name));
     }


    
Return an Iterator containing the String names of all notes bindings that exist for this request.
 
     public Iterator getNoteNames() {
         return (.keySet().iterator());
     }


    
Remove any object bound to the specified name in the internal notes for this request.

Parameters:
name Name of the note to be removed
 
     public void removeNote(String name) {
         .remove(name);
     }


    
Bind an object to a specified name in the internal notes associated with this request, replacing any existing binding for this name.

Parameters:
name Name to which the object should be bound
value Object to be bound to the specified name
    public void setNote(String nameObject value) {
        .put(namevalue);
    }


    
Set the content length associated with this Request.

Parameters:
length The new content length
    public void setContentLength(int length) {
        // Not used
    }


    
Set the content type (and optionally the character encoding) associated with this Request. For example, text/html; charset=ISO-8859-4.

Parameters:
type The new content type
    public void setContentType(String type) {
        // Not used
    }


    
Set the protocol name and version associated with this Request.

Parameters:
protocol Protocol name and version
    public void setProtocol(String protocol) {
        // Not used
    }


    
Set the IP address of the remote client associated with this Request.

Parameters:
remoteAddr The remote IP address
    public void setRemoteAddr(String remoteAddr) {
        this. = remoteAddr;
    }


    
Set the fully qualified name of the remote client associated with this Request.

Parameters:
remoteHost The remote host name
    public void setRemoteHost(String remoteHost) {
        this. = remoteHost;
    }


    
Set the name of the scheme associated with this request. Typical values are http, https, and ftp.

Parameters:
scheme The scheme
    public void setScheme(String scheme) {
        // Not used
    }


    
Set the value to be returned by isSecure() for this Request.

Parameters:
secure The new isSecure value
    public void setSecure(boolean secure) {
        this. = secure;
    }


    
Set the name of the server (virtual host) to process this request.

Parameters:
name The server name
    public void setServerName(String name) {
        .serverName().setString(name);
    }


    
Set the port number of the server to process this request.

Parameters:
port The server port
    public void setServerPort(int port) {
        .setServerPort(port);
    }
    // ------------------------------------------------- ServletRequest Methods


    
Return the specified request attribute if it exists; otherwise, return null.

Parameters:
name Name of the request attribute to return
    public Object getAttribute(String name) {
        if (name.equals(.)) {
            return ( == null
                ? .
                : ;
        } else if (name.equals(.)) {
            return ( == null
                ? getRequestPathMB().toString()
                : .toString();
        }
        Object attr=.get(name);
        if(attr!=null)
            return(attr);
        attr =  .getAttribute(name);
        if(attr != null)
            return attr;
        if( ! && isSSLAttribute(name) ) {
             = true;
                                 );
            attr = .getAttribute(.);
            ifattr != null) {
                .put(.attr);
            }
            attr = .getAttribute(.);
            if(attr != null) {
                .put(.attr);
            }
            attr = .getAttribute(.);
            if(attr != null) {
                .put(.attr);
            }
            attr = .getAttribute(.);
            if(attr != null) {
                .put(.attr);
            }
            attr = .get(name);
        }
        return attr;
    }
    
        if ((certs == null) || (certs.length < 1)) {
                    );
            if (certs != null) {
                .put(.certs);
            }
        }
        return certs;
    }
    

    
Test if a given name is one of the special Servlet-spec SSL attributes.
    static boolean isSSLAttribute(String name) {
        return ..equals(name) ||
            ..equals(name) ||
            ..equals(name)  ||
            ..equals(name);
    }

    
Return the names of all request attributes for this Request, or an empty Enumeration if there are none.
    public Enumeration getAttributeNames() {
        if (isSecure()) {
            getAttribute(.);
        }
        return new Enumerator(.keySet(), true);
    }


    
Return the character encoding for this Request.
    public String getCharacterEncoding() {
      return (.getCharacterEncoding());
    }


    
Return the content length for this Request.
    public int getContentLength() {
        return (.getContentLength());
    }


    
Return the content type for this Request.
    public String getContentType() {
        return (.getContentType());
    }


    
Return the servlet input stream for this Request. The default implementation returns a servlet input stream created by createInputStream().

Throws:
java.lang.IllegalStateException if getReader() has already been called for this request
java.io.IOException if an input/output error occurs
    public ServletInputStream getInputStream() throws IOException {
        if ()
            throw .readerAlreadyUsed();
        if ( != null) {
            return ;
        }
         = true;
        if ( == null) {
             = new CoyoteInputStream();
        }
        return ;
    }
    public void setInputStream(ServletInputStream inputStream) {
         = inputStream;
    }


    
Return the preferred Locale that the client will accept content in, based on the value for the first Accept-Language header that was encountered. If the request did not specify a preferred language, the server's default Locale is returned.
    public Locale getLocale() {
        if (!)
            parseLocales();
        if (.size() > 0) {
            return ((Locale.get(0));
        } else {
            return ();
        }
    }


    
Return the set of preferred Locales that the client will accept content in, based on the values for any Accept-Language headers that were encountered. If the request did not specify a preferred language, the server's default Locale is returned.
    public Enumeration getLocales() {
        if (!)
            parseLocales();
        if (.size() > 0)
            return (new Enumerator());
        ArrayList results = new ArrayList();
        results.add();
        return (new Enumerator(results));
    }


    
Return the value of the specified request parameter, if any; otherwise, return null. If there is more than one value defined, return only the first one.

Parameters:
name Name of the desired request parameter
    public String getParameter(String name) {
        if (!)
            parseParameters();
        return .getParameters().getParameter(name);
    }



    
Returns a Map of the parameters of this request. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.

Returns:
A Map containing parameter names as keys and parameter values as map values.
    public Map getParameterMap() {
        if (.isLocked())
            return ;
        Enumeration enumeration = getParameterNames();
        while (enumeration.hasMoreElements()) {
            String name = enumeration.nextElement().toString();
            String[] values = getParameterValues(name);
            .put(namevalues);
        }
        .setLocked(true);
        return ;
    }


    
Return the names of all defined request parameters for this request.
    public Enumeration getParameterNames() {
        if (!)
            parseParameters();
    }


    
Return the defined values for the specified request parameter, if any; otherwise, return null.

Parameters:
name Name of the desired request parameter
    public String[] getParameterValues(String name) {
        if (!)
            parseParameters();
        return .getParameters().getParameterValues(name);
    }


    
Return the protocol and version used to make this Request.
    public String getProtocol() {
        return .protocol().toString();
    }


    
Read the Reader wrapping the input stream for this Request. The default implementation wraps a BufferedReader around the servlet input stream returned by createInputStream().

Throws:
java.lang.IllegalStateException if getInputStream() has already been called for this request
java.io.IOException if an input/output error occurs
    public BufferedReader getReader() throws IOException {
        if ()
            throw .inputStreamAlreadyUsed();
        if ( != null) {
            return ;
        }
         = true;
        .checkConverter();
        if ( == null) {
             = new CoyoteReader();
        }
        return ;
    }

    
    
Replaces the reader with an application provided one.

Parameters:
reader
    public void setReader(BufferedReader reader) {
         = reader;
    }


    
Return the real path of the specified virtual path.

Deprecated:
As of version 2.1 of the Java Servlet API, use ServletContext.getRealPath().
Parameters:
path Path to be translated
    public String getRealPath(String path) {
        if ( == null)
            return (null);
        ServletContext servletContext = .getServletContext();
        if (servletContext == null)
            return (null);
        else {
            try {
                return (servletContext.getRealPath(path));
            } catch (IllegalArgumentException e) {
                return (null);
            }
        }
    }


    
Return the remote IP address making this Request.
    public String getRemoteAddr() {
        if ( == null) {
            .action
                (.);
             = .remoteAddr().toString();
        }
        return ;
    }


    
Return the remote host name making this Request.
    public String getRemoteHost() {
        if ( == null) {
            if (!.getEnableLookups()) {
                 = getRemoteAddr();
            } else {
                .action
                    (.);
                 = .remoteHost().toString();
            }
        }
        return ;
    }

    
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
    
    public int getRemotePort(){
        if ( == -1) {
            .action
                (.);
             = .getRemotePort();
        }
        return ;    
    }

    
Returns the host name of the Internet Protocol (IP) interface on which the request was received.
    public String getLocalName(){
        if ( == null) {
            .action
                (.);
             = .localName().toString();
        }
        return ;
    }

    
Returns the Internet Protocol (IP) address of the interface on which the request was received.
       
    public String getLocalAddr(){
        if ( == null) {
            .action
                (.);
             = .localAddr().toString();
        }
        return ;    
    }


    
Returns the Internet Protocol (IP) port number of the interface on which the request was received.
    public int getLocalPort(){
        if ( == -1){
            .action
                (.);
             = .getLocalPort();
        }
        return ;
    }
    
    
Return a RequestDispatcher that wraps the resource at the specified path, which may be interpreted as relative to the current request path.

Parameters:
path Path of the resource to be wrapped
        if ( == null)
            return (null);
        // If the path is already context-relative, just pass it through
        if (path == null)
            return (null);
        else if (path.startsWith("/"))
            return (.getServletContext().getRequestDispatcher(path));
        // Convert a request-relative path to a context-relative one
        if (servletPath == null)
            servletPath = getServletPath();
        // Add the path info, if there is any
        String pathInfo = getPathInfo();
        String requestPath = null;
        if (pathInfo == null) {
            requestPath = servletPath;
        } else {
            requestPath = servletPath + pathInfo;
        }
        int pos = requestPath.lastIndexOf('/');
        String relative = null;
        if (pos >= 0) {
            relative = requestPath.substring(0, pos + 1) + path;
        } else {
            relative = requestPath + path;
        }
        return (.getServletContext().getRequestDispatcher(relative));
    }


    
Return the scheme used to make this Request.
    public String getScheme() {
        return (.scheme().toString());
    }


    
Return the server name responding to this Request.
    public String getServerName() {
        return (.serverName().toString());
    }


    
Return the server port responding to this Request.
    public int getServerPort() {
        return (.getServerPort());
    }


    
Was this request received on a secure connection?
    public boolean isSecure() {
        return ();
    }


    
Remove the specified request attribute if it exists.

Parameters:
name Name of the request attribute to remove
    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 (.containsKey(name)) {
            return;
        }
        // Pass special attributes to the native layer
        if (name.startsWith("org.apache.tomcat.")) {
            .getAttributes().remove(name);
        }
        found = .containsKey(name);
        if (found) {
            value = .get(name);
            .remove(name);
        } else {
            return;
        }
        
        if ( == null)
            return;
        
        // Notify interested application event listeners
        Object listeners[] = .getApplicationEventListeners();
        if ((listeners == null) || (listeners.length == 0))
            return;
        ServletRequestAttributeEvent event =
                                           getRequest(), namevalue);
        for (int i = 0; i < listeners.lengthi++) {
            if (!(listeners[iinstanceof ServletRequestAttributeListener))
                continue;
            ServletRequestAttributeListener listener =
                (ServletRequestAttributeListenerlisteners[i];
            try {
                listener.attributeRemoved(event);
            } catch (Throwable t) {
                .getLogger().error(.attributesEventListenerException(), t);
                // Error valve will pick this execption up and display it to user
                .put(.t);
            }
        }
    }


    
Set the specified request attribute to the specified value.

Parameters:
name Name of the request attribute to set
value The associated value
    public void setAttribute(String nameObject value) {
        // Name cannot be null