Save This Page
Home » glassfish-v2ur2-b04-src » javax » servlet » http » [javadoc | source]
    1   
    2   
    3   /*
    4    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    5    * 
    6    * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    7    * 
    8    * Portions Copyright Apache Software Foundation.
    9    * 
   10    * The contents of this file are subject to the terms of either the GNU
   11    * General Public License Version 2 only ("GPL") or the Common Development
   12    * and Distribution License("CDDL") (collectively, the "License").  You
   13    * may not use this file except in compliance with the License. You can obtain
   14    * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
   15    * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
   16    * language governing permissions and limitations under the License.
   17    * 
   18    * When distributing the software, include this License Header Notice in each
   19    * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
   20    * Sun designates this particular file as subject to the "Classpath" exception
   21    * as provided by Sun in the GPL Version 2 section of the License file that
   22    * accompanied this code.  If applicable, add the following below the License
   23    * Header, with the fields enclosed by brackets [] replaced by your own
   24    * identifying information: "Portions Copyrighted [year]
   25    * [name of copyright owner]"
   26    * 
   27    * Contributor(s):
   28    * 
   29    * If you wish your version of this file to be governed by only the CDDL or
   30    * only the GPL Version 2, indicate your decision by adding "[Contributor]
   31    * elects to include this software in this distribution under the [CDDL or GPL
   32    * Version 2] license."  If you don't indicate a single choice of license, a
   33    * recipient has the option to distribute your version of this file under
   34    * either the CDDL, the GPL Version 2 or to extend the choice of license to
   35    * its licensees as provided above.  However, if you add GPL Version 2 code
   36    * and therefore, elected the GPL Version 2 license, then the option applies
   37    * only if the new code is made subject to such option by the copyright
   38    * holder.
   39    */
   40   
   41   package javax.servlet.http;
   42   
   43   import javax.servlet.ServletRequestWrapper;
   44   import java.util.Enumeration;
   45   
   46   /**
   47    * 
   48    * Provides a convenient implementation of the HttpServletRequest interface that
   49    * can be subclassed by developers wishing to adapt the request to a Servlet.
   50    * This class implements the Wrapper or Decorator pattern. Methods default to
   51    * calling through to the wrapped request object.
   52    * 
   53    *
   54    * @see 	javax.servlet.http.HttpServletRequest
   55     * @since	v 2.3
   56    *
   57    */
   58   
   59   
   60   public class HttpServletRequestWrapper extends ServletRequestWrapper implements HttpServletRequest {
   61   
   62   	/** 
   63   	* Constructs a request object wrapping the given request.
   64   	* @throws java.lang.IllegalArgumentException if the request is null
   65   	*/
   66       public HttpServletRequestWrapper(HttpServletRequest request) {
   67   	    super(request);
   68       }
   69       
   70       private HttpServletRequest _getHttpServletRequest() {
   71   	return (HttpServletRequest) super.getRequest();
   72       }
   73   
   74       /**
   75        * The default behavior of this method is to return getAuthType()
   76        * on the wrapped request object.
   77        */
   78   
   79       public String getAuthType() {
   80   	return this._getHttpServletRequest().getAuthType();
   81       }
   82      
   83       /**
   84        * The default behavior of this method is to return getCookies()
   85        * on the wrapped request object.
   86        */
   87       public Cookie[] getCookies() {
   88   	return this._getHttpServletRequest().getCookies();
   89       }
   90   
   91       /**
   92        * The default behavior of this method is to return getDateHeader(String name)
   93        * on the wrapped request object.
   94        */
   95       public long getDateHeader(String name) {
   96   	return this._getHttpServletRequest().getDateHeader(name);
   97       }
   98           	
   99       /**
  100        * The default behavior of this method is to return getHeader(String name)
  101        * on the wrapped request object.
  102        */
  103       public String getHeader(String name) {
  104   	return this._getHttpServletRequest().getHeader(name);
  105       }
  106       
  107       /**
  108        * The default behavior of this method is to return getHeaders(String name)
  109        * on the wrapped request object.
  110        */
  111       public Enumeration getHeaders(String name) {
  112   	return this._getHttpServletRequest().getHeaders(name);
  113       }  
  114   
  115       /**
  116        * The default behavior of this method is to return getHeaderNames()
  117        * on the wrapped request object.
  118        */
  119     
  120       public Enumeration getHeaderNames() {
  121   	return this._getHttpServletRequest().getHeaderNames();
  122       }
  123       
  124       /**
  125        * The default behavior of this method is to return getIntHeader(String name)
  126        * on the wrapped request object.
  127        */
  128   
  129        public int getIntHeader(String name) {
  130   	return this._getHttpServletRequest().getIntHeader(name);
  131       }
  132       
  133       /**
  134        * The default behavior of this method is to return getMethod()
  135        * on the wrapped request object.
  136        */
  137       public String getMethod() {
  138   	return this._getHttpServletRequest().getMethod();
  139       }
  140       
  141       /**
  142        * The default behavior of this method is to return getPathInfo()
  143        * on the wrapped request object.
  144        */
  145       public String getPathInfo() {
  146   	return this._getHttpServletRequest().getPathInfo();
  147       }
  148   
  149       /**
  150        * The default behavior of this method is to return getPathTranslated()
  151        * on the wrapped request object.
  152        */
  153   
  154        public String getPathTranslated() {
  155   	return this._getHttpServletRequest().getPathTranslated();
  156       }
  157   
  158       /**
  159        * The default behavior of this method is to return getContextPath()
  160        * on the wrapped request object.
  161        */
  162       public String getContextPath() {
  163   	return this._getHttpServletRequest().getContextPath();
  164       }
  165       
  166       /**
  167        * The default behavior of this method is to return getQueryString()
  168        * on the wrapped request object.
  169        */
  170       public String getQueryString() {
  171   	return this._getHttpServletRequest().getQueryString();
  172       }
  173       
  174       /**
  175        * The default behavior of this method is to return getRemoteUser()
  176        * on the wrapped request object.
  177        */
  178       public String getRemoteUser() {
  179   	return this._getHttpServletRequest().getRemoteUser();
  180       }
  181       
  182    
  183       /**
  184        * The default behavior of this method is to return isUserInRole(String role)
  185        * on the wrapped request object.
  186        */
  187       public boolean isUserInRole(String role) {
  188   	return this._getHttpServletRequest().isUserInRole(role);
  189       }
  190       
  191       
  192       
  193       /**
  194        * The default behavior of this method is to return getUserPrincipal()
  195        * on the wrapped request object.
  196        */
  197       public java.security.Principal getUserPrincipal() {
  198   	return this._getHttpServletRequest().getUserPrincipal();
  199       }
  200       
  201      
  202       /**
  203        * The default behavior of this method is to return getRequestedSessionId()
  204        * on the wrapped request object.
  205        */
  206       public String getRequestedSessionId() {
  207   	return this._getHttpServletRequest().getRequestedSessionId();
  208       }
  209       
  210       /**
  211        * The default behavior of this method is to return getRequestURI()
  212        * on the wrapped request object.
  213        */
  214       public String getRequestURI() {
  215   	return this._getHttpServletRequest().getRequestURI();
  216       }
  217   	/**
  218        * The default behavior of this method is to return getRequestURL()
  219        * on the wrapped request object.
  220        */
  221       public StringBuffer getRequestURL() {
  222   	return this._getHttpServletRequest().getRequestURL();
  223       }
  224   	
  225       
  226       /**
  227        * The default behavior of this method is to return getServletPath()
  228        * on the wrapped request object.
  229        */
  230       public String getServletPath() {
  231   	return this._getHttpServletRequest().getServletPath();
  232       }
  233       
  234       
  235       /**
  236        * The default behavior of this method is to return getSession(boolean create)
  237        * on the wrapped request object.
  238        */
  239       public HttpSession getSession(boolean create) {
  240   	return this._getHttpServletRequest().getSession(create);
  241       }
  242       
  243       /**
  244        * The default behavior of this method is to return getSession()
  245        * on the wrapped request object.
  246        */
  247       public HttpSession getSession() {
  248   	return this._getHttpServletRequest().getSession();
  249       }
  250       
  251       /**
  252        * The default behavior of this method is to return isRequestedSessionIdValid()
  253        * on the wrapped request object.
  254        */ 
  255   
  256       public boolean isRequestedSessionIdValid() {
  257   	return this._getHttpServletRequest().isRequestedSessionIdValid();
  258       }
  259        
  260       
  261       /**
  262        * The default behavior of this method is to return isRequestedSessionIdFromCookie()
  263        * on the wrapped request object.
  264        */
  265       public boolean isRequestedSessionIdFromCookie() {
  266   	return this._getHttpServletRequest().isRequestedSessionIdFromCookie();
  267       }
  268       
  269       	  /**
  270        * The default behavior of this method is to return isRequestedSessionIdFromURL()
  271        * on the wrapped request object.
  272        */ 
  273       public boolean isRequestedSessionIdFromURL() {
  274   	return this._getHttpServletRequest().isRequestedSessionIdFromURL();
  275       }
  276       
  277       /**
  278        * The default behavior of this method is to return isRequestedSessionIdFromUrl()
  279        * on the wrapped request object.
  280        */
  281       public boolean isRequestedSessionIdFromUrl() {
  282   	return this._getHttpServletRequest().isRequestedSessionIdFromUrl();
  283       }
  284   
  285   
  286       
  287   }

Save This Page
Home » glassfish-v2ur2-b04-src » javax » servlet » http » [javadoc | source]