You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2002/03/28 16:35:49 UTC

cvs commit: jakarta-cactus/framework/src/java/share/org/apache/cactus/server AbstractHttpServletRequestWrapper.java

vmassol     02/03/28 07:35:49

  Modified:    framework/src/java/share/org/apache/cactus/server
                        AbstractHttpServletRequestWrapper.java
  Log:
  some refactorings
  
  Revision  Changes    Path
  1.2       +40 -27    jakarta-cactus/framework/src/java/share/org/apache/cactus/server/AbstractHttpServletRequestWrapper.java
  
  Index: AbstractHttpServletRequestWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/server/AbstractHttpServletRequestWrapper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractHttpServletRequestWrapper.java	1 Mar 2002 00:43:46 -0000	1.1
  +++ AbstractHttpServletRequestWrapper.java	28 Mar 2002 15:35:49 -0000	1.2
  @@ -78,7 +78,7 @@
    *
    * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
    *
  - * @version $Id: AbstractHttpServletRequestWrapper.java,v 1.1 2002/03/01 00:43:46 vmassol Exp $
  + * @version $Id: AbstractHttpServletRequestWrapper.java,v 1.2 2002/03/28 15:35:49 vmassol Exp $
    */
   public abstract class AbstractHttpServletRequestWrapper
           implements HttpServletRequest
  @@ -132,13 +132,13 @@
        */
       public String getContextPath()
       {
  -        String result = this.request.getContextPath();
  +        String result;
   
  -        if (this.url != null) {
  -            if (this.url.getContextPath() != null) {
  -                result = this.url.getContextPath();
  -                LOGGER.debug("Using simulated context : [" + result + "]");
  -            }
  +        if ((this.url != null) && (this.url.getContextPath() != null)) {
  +            result = this.url.getContextPath();
  +            LOGGER.debug("Using simulated context : [" + result + "]");
  +        } else {
  +            result = this.request.getContextPath();
           }
   
           return result;
  @@ -150,11 +150,13 @@
        */
       public String getPathInfo()
       {
  -        String result = this.request.getPathInfo();
  +        String result;
   
           if (this.url != null) {
               result = this.url.getPathInfo();
               LOGGER.debug("Using simulated PathInfo : [" + result + "]");
  +        } else {
  +            result = this.request.getPathInfo();
           }
           return result;
       }
  @@ -165,15 +167,16 @@
        */
       public String getServerName()
       {
  -        String result = this.request.getServerName();
  +        String result;
   
  -        if (this.url != null) {
  -            if (this.url.getServerName() != null) {
  -                result = this.url.getHost();
  -                LOGGER.debug("Using simulated server name : [" + result +
  -                    "]");
  -            }
  +        if ((this.url != null) && (this.url.getServerName() != null)) {
  +            result = this.url.getHost();
  +            LOGGER.debug("Using simulated server name : [" + result +
  +                "]");
  +        } else {
  +            result = this.request.getServerName();
           }
  +
           return result;
       }
   
  @@ -184,11 +187,13 @@
        */
       public int getServerPort()
       {
  -        int result = this.request.getServerPort();
  +        int result;
   
           if (this.url != null) {
               result = (this.url.getPort() == -1) ? 80 : this.url.getPort();
               LOGGER.debug("Using simulated server port : [" + result + "]");
  +        } else {
  +            result = this.request.getServerPort();
           }
   
           return result;
  @@ -200,7 +205,7 @@
        */
       public String getRequestURI()
       {
  -        String result = this.request.getRequestURI();
  +        String result;
   
           if (this.url != null) {
   
  @@ -209,6 +214,8 @@
                   ((getPathInfo() == null) ? "" : getPathInfo());
   
               LOGGER.debug("Using simulated request URI : [" + result + "]");
  +        } else {
  +            result = this.request.getRequestURI();
           }
   
           return result;
  @@ -220,12 +227,14 @@
        */
       public String getServletPath()
       {
  -        String result = this.request.getServletPath();
  +        String result;
   
           if (this.url != null) {
               result = this.url.getServletPath();
               LOGGER.debug("Using simulated servlet path : [" + result +
                   "]");
  +        } else {
  +            result = this.request.getServletPath();
           }
   
           return result;
  @@ -274,13 +283,16 @@
        */
       public String getQueryString()
       {
  -        String result = this.request.getQueryString();
  +        String result;
   
           if (this.url != null) {
               result = this.url.getQueryString();
               LOGGER.debug("Using simulated query string : [" + result +
                   "]");
  +        } else {
  +            result = this.request.getQueryString();
           }
  +
           return result;
       }
   
  @@ -652,14 +664,6 @@
       }
   
       /**
  -     * @see HttpServletRequest#getProtocol()
  -     */
  -    public String getProtocol()
  -    {
  -        return this.request.getProtocol();
  -    }
  -
  -    /**
        * @see HttpServletRequest#getRequestedSessionId()
        */
       public String getRequestedSessionId()
  @@ -674,4 +678,13 @@
       {
           return this.request.getCookies();
       }
  +
  +    /**
  +     * @see HttpServletRequest#getProtocol()
  +     */
  +    public String getProtocol()
  +    {
  +        return this.request.getProtocol();
  +    }
  +
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>