Home » apache-tomcat-6.0.26-src » javax » servlet » http » [javadoc | source]

    1   /*
    2   * Licensed to the Apache Software Foundation (ASF) under one or more
    3   * contributor license agreements.  See the NOTICE file distributed with
    4   * this work for additional information regarding copyright ownership.
    5   * The ASF licenses this file to You under the Apache License, Version 2.0
    6   * (the "License"); you may not use this file except in compliance with
    7   * the License.  You may obtain a copy of the License at
    8   *
    9   *     http://www.apache.org/licenses/LICENSE-2.0
   10   *
   11   * Unless required by applicable law or agreed to in writing, software
   12   * distributed under the License is distributed on an "AS IS" BASIS,
   13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14   * See the License for the specific language governing permissions and
   15   * limitations under the License.
   16   */
   17   package javax.servlet.http;
   18   
   19   import javax.servlet.ServletRequestWrapper;
   20   import java.util.Enumeration;
   21   
   22   /**
   23    * 
   24    * Provides a convenient implementation of the HttpServletRequest interface that
   25    * can be subclassed by developers wishing to adapt the request to a Servlet.
   26    * This class implements the Wrapper or Decorator pattern. Methods default to
   27    * calling through to the wrapped request object.
   28    * 
   29    *
   30    * @see 	javax.servlet.http.HttpServletRequest
   31     * @since	v 2.3
   32    *
   33    */
   34   
   35   
   36   public class HttpServletRequestWrapper extends ServletRequestWrapper implements HttpServletRequest {
   37   
   38   	/** 
   39   	* Constructs a request object wrapping the given request.
   40   	* @throws java.lang.IllegalArgumentException if the request is null
   41   	*/
   42       public HttpServletRequestWrapper(HttpServletRequest request) {
   43   	    super(request);
   44       }
   45       
   46       private HttpServletRequest _getHttpServletRequest() {
   47   	return (HttpServletRequest) super.getRequest();
   48       }
   49   
   50       /**
   51        * The default behavior of this method is to return getAuthType()
   52        * on the wrapped request object.
   53        */
   54   
   55       public String getAuthType() {
   56   	return this._getHttpServletRequest().getAuthType();
   57       }
   58      
   59       /**
   60        * The default behavior of this method is to return getCookies()
   61        * on the wrapped request object.
   62        */
   63       public Cookie[] getCookies() {
   64   	return this._getHttpServletRequest().getCookies();
   65       }
   66   
   67       /**
   68        * The default behavior of this method is to return getDateHeader(String name)
   69        * on the wrapped request object.
   70        */
   71       public long getDateHeader(String name) {
   72   	return this._getHttpServletRequest().getDateHeader(name);
   73       }
   74           	
   75       /**
   76        * The default behavior of this method is to return getHeader(String name)
   77        * on the wrapped request object.
   78        */
   79       public String getHeader(String name) {
   80   	return this._getHttpServletRequest().getHeader(name);
   81       }
   82       
   83       /**
   84        * The default behavior of this method is to return getHeaders(String name)
   85        * on the wrapped request object.
   86        */
   87       public Enumeration getHeaders(String name) {
   88   	return this._getHttpServletRequest().getHeaders(name);
   89       }  
   90   
   91       /**
   92        * The default behavior of this method is to return getHeaderNames()
   93        * on the wrapped request object.
   94        */
   95     
   96       public Enumeration getHeaderNames() {
   97   	return this._getHttpServletRequest().getHeaderNames();
   98       }
   99       
  100       /**
  101        * The default behavior of this method is to return getIntHeader(String name)
  102        * on the wrapped request object.
  103        */
  104   
  105        public int getIntHeader(String name) {
  106   	return this._getHttpServletRequest().getIntHeader(name);
  107       }
  108       
  109       /**
  110        * The default behavior of this method is to return getMethod()
  111        * on the wrapped request object.
  112        */
  113       public String getMethod() {
  114   	return this._getHttpServletRequest().getMethod();
  115       }
  116       
  117       /**
  118        * The default behavior of this method is to return getPathInfo()
  119        * on the wrapped request object.
  120        */
  121       public String getPathInfo() {
  122   	return this._getHttpServletRequest().getPathInfo();
  123       }
  124   
  125       /**
  126        * The default behavior of this method is to return getPathTranslated()
  127        * on the wrapped request object.
  128        */
  129   
  130        public String getPathTranslated() {
  131   	return this._getHttpServletRequest().getPathTranslated();
  132       }
  133   
  134       /**
  135        * The default behavior of this method is to return getContextPath()
  136        * on the wrapped request object.
  137        */
  138       public String getContextPath() {
  139   	return this._getHttpServletRequest().getContextPath();
  140       }
  141       
  142       /**
  143        * The default behavior of this method is to return getQueryString()
  144        * on the wrapped request object.
  145        */
  146       public String getQueryString() {
  147   	return this._getHttpServletRequest().getQueryString();
  148       }
  149       
  150       /**
  151        * The default behavior of this method is to return getRemoteUser()
  152        * on the wrapped request object.
  153        */
  154       public String getRemoteUser() {
  155   	return this._getHttpServletRequest().getRemoteUser();
  156       }
  157       
  158    
  159       /**
  160        * The default behavior of this method is to return isUserInRole(String role)
  161        * on the wrapped request object.
  162        */
  163       public boolean isUserInRole(String role) {
  164   	return this._getHttpServletRequest().isUserInRole(role);
  165       }
  166       
  167       
  168       
  169       /**
  170        * The default behavior of this method is to return getUserPrincipal()
  171        * on the wrapped request object.
  172        */
  173       public java.security.Principal getUserPrincipal() {
  174   	return this._getHttpServletRequest().getUserPrincipal();
  175       }
  176       
  177      
  178       /**
  179        * The default behavior of this method is to return getRequestedSessionId()
  180        * on the wrapped request object.
  181        */
  182       public String getRequestedSessionId() {
  183   	return this._getHttpServletRequest().getRequestedSessionId();
  184       }
  185       
  186       /**
  187        * The default behavior of this method is to return getRequestURI()
  188        * on the wrapped request object.
  189        */
  190       public String getRequestURI() {
  191   	return this._getHttpServletRequest().getRequestURI();
  192       }
  193   	/**
  194        * The default behavior of this method is to return getRequestURL()
  195        * on the wrapped request object.
  196        */
  197       public StringBuffer getRequestURL() {
  198   	return this._getHttpServletRequest().getRequestURL();
  199       }
  200   	
  201       
  202       /**
  203        * The default behavior of this method is to return getServletPath()
  204        * on the wrapped request object.
  205        */
  206       public String getServletPath() {
  207   	return this._getHttpServletRequest().getServletPath();
  208       }
  209       
  210       
  211       /**
  212        * The default behavior of this method is to return getSession(boolean create)
  213        * on the wrapped request object.
  214        */
  215       public HttpSession getSession(boolean create) {
  216   	return this._getHttpServletRequest().getSession(create);
  217       }
  218       
  219       /**
  220        * The default behavior of this method is to return getSession()
  221        * on the wrapped request object.
  222        */
  223       public HttpSession getSession() {
  224   	return this._getHttpServletRequest().getSession();
  225       }
  226       
  227       /**
  228        * The default behavior of this method is to return isRequestedSessionIdValid()
  229        * on the wrapped request object.
  230        */ 
  231   
  232       public boolean isRequestedSessionIdValid() {
  233   	return this._getHttpServletRequest().isRequestedSessionIdValid();
  234       }
  235        
  236       
  237       /**
  238        * The default behavior of this method is to return isRequestedSessionIdFromCookie()
  239        * on the wrapped request object.
  240        */
  241       public boolean isRequestedSessionIdFromCookie() {
  242   	return this._getHttpServletRequest().isRequestedSessionIdFromCookie();
  243       }
  244       
  245       	  /**
  246        * The default behavior of this method is to return isRequestedSessionIdFromURL()
  247        * on the wrapped request object.
  248        */ 
  249       public boolean isRequestedSessionIdFromURL() {
  250   	return this._getHttpServletRequest().isRequestedSessionIdFromURL();
  251       }
  252       
  253       /**
  254        * The default behavior of this method is to return isRequestedSessionIdFromUrl()
  255        * on the wrapped request object.
  256        */
  257       public boolean isRequestedSessionIdFromUrl() {
  258   	return this._getHttpServletRequest().isRequestedSessionIdFromUrl();
  259       }
  260   
  261   
  262       
  263   }

Home » apache-tomcat-6.0.26-src » javax » servlet » http » [javadoc | source]