You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2002/12/05 15:07:56 UTC

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/environment ForwardRedirector.java

cziegeler    2002/12/05 06:07:56

  Modified:    src/java/org/apache/cocoon/environment/wrapper Tag:
                        cocoon_2_0_3_branch EnvironmentWrapper.java
               src/java/org/apache/cocoon/environment/http Tag:
                        cocoon_2_0_3_branch HttpRequest.java
                        HttpContext.java HttpResponse.java
               src/java/org/apache/cocoon/environment Tag:
                        cocoon_2_0_3_branch ForwardRedirector.java
  Log:
  Minor performance improvement and securing instance variables
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.11.2.3  +9 -39     xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java
  
  Index: EnvironmentWrapper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/wrapper/EnvironmentWrapper.java,v
  retrieving revision 1.11.2.2
  retrieving revision 1.11.2.3
  diff -u -r1.11.2.2 -r1.11.2.3
  --- EnvironmentWrapper.java	4 Aug 2002 04:11:53 -0000	1.11.2.2
  +++ EnvironmentWrapper.java	5 Dec 2002 14:07:56 -0000	1.11.2.3
  @@ -84,28 +84,28 @@
       protected Environment environment;
   
       /** The object model */
  -    private Map objectModel;
  +    protected Map objectModel;
   
       /** The redirect url */
  -    private String redirectURL;
  +    protected String redirectURL;
   
       /** The request object */
  -    private Request request;
  +    protected Request request;
   
       /** The last context */
  -    private URL lastContext;
  +    protected URL lastContext;
   
       /** The last prefix */
  -    private String lastPrefix;
  +    protected String lastPrefix;
   
       /** The last uri */
  -    private String lastURI;
  +    protected String lastURI;
   
       /** The stream to output to */
  -    private OutputStream outputStream;
  +    protected OutputStream outputStream;
   
       /** The processor used */
  -    private Processor processor;
  +    protected Processor processor;
   
       /**
        * Constructs an EnvironmentWrapper object from a Request
  @@ -291,35 +291,5 @@
           this.setURIPrefix(this.lastPrefix);
           this.uris = this.lastURI;
           return this.processor;
  -    }
  -
  -    /**
  -     * Lookup an attribute in this instance, and if not found search it
  -     * in the wrapped environment.
  -     *
  -     * @param name a <code>String</code>, the name of the attribute to
  -     * look for
  -     * @return an <code>Object</code>, the value of the attribute or
  -     * null if no such attribute was found.
  -     */
  -    public Object getAttribute(String name)
  -    {
  -        Object value = super.getAttribute(name);
  -        if (value == null)
  -            value = environment.getAttribute(name);
  -
  -        return value;
  -    }
  -
  -    /**
  -     * Remove attribute from the current instance, as well as from the
  -     * wrapped environment.
  -     *
  -     * @param name a <code>String</code> value
  -     */
  -    public void removeAttribute(String name)
  -    {
  -        super.removeAttribute(name);
  -        environment.removeAttribute(name);
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.5   +18 -11    xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpRequest.java
  
  Index: HttpRequest.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpRequest.java,v
  retrieving revision 1.6.2.4
  retrieving revision 1.6.2.5
  diff -u -r1.6.2.4 -r1.6.2.5
  --- HttpRequest.java	21 Nov 2002 15:06:49 -0000	1.6.2.4
  +++ HttpRequest.java	5 Dec 2002 14:07:56 -0000	1.6.2.5
  @@ -71,24 +71,28 @@
    * @version CVS $Id$
    */
   
  -public class HttpRequest implements Request {
  +public final class HttpRequest implements Request {
   
       /** The real HttpServletRequest object */
  -    private HttpServletRequest req = null;
  +    private final HttpServletRequest req;
   
       /** The HttpEnvironment object */
  -    private HttpEnvironment env = null;
  +    private final HttpEnvironment env;
   
       /** The character encoding of parameters */
  -    private String form_encoding = null;
  +    private String form_encoding;
   
       /** The default form encoding of the servlet container */
  -    private String container_encoding = null;
  +    private String container_encoding;
       
  +    /** The current session */
  +    private HttpSession session;
  +
       private final RequestFactory requestFactory;
   
  +    
       /**
  -     * Creates a HttpServletRequest based on a real HttpServletRequest object
  +     * Creates a HttpRequest based on a real HttpServletRequest object
        */
       protected HttpRequest(HttpServletRequest req, HttpEnvironment env, RequestFactory requestFactory) {
           super();
  @@ -220,10 +224,13 @@
       }
   
       public Session getSession(boolean create) {
  -        javax.servlet.http.HttpSession session = this.req.getSession(create);
  -        if(session != null)
  -            return new HttpSession(session);
  -        return null;
  +        if ( null == this.session ) {
  +            javax.servlet.http.HttpSession serverSession = this.req.getSession(create);
  +            if( null != serverSession ) {
  +                this.session = new HttpSession( serverSession );
  +            }
  +        }
  +        return this.session;
       }
   
       public Session getSession() {
  
  
  
  1.7.2.2   +3 -3      xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpContext.java
  
  Index: HttpContext.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpContext.java,v
  retrieving revision 1.7.2.1
  retrieving revision 1.7.2.2
  diff -u -r1.7.2.1 -r1.7.2.2
  --- HttpContext.java	21 Nov 2002 15:06:49 -0000	1.7.2.1
  +++ HttpContext.java	5 Dec 2002 14:07:56 -0000	1.7.2.2
  @@ -66,10 +66,10 @@
    * @version CVS $Id$
    */
   
  -public class HttpContext implements Context {
  +public final class HttpContext implements Context {
   
       /** The ServletContext */
  -    private ServletContext servletContext = null;
  +    private final ServletContext servletContext;
   
       /**
        * Constructs a HttpContext object from a ServletContext object
  
  
  
  1.4.2.1   +3 -4      xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpResponse.java
  
  Index: HttpResponse.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpResponse.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- HttpResponse.java	22 Feb 2002 07:03:50 -0000	1.4
  +++ HttpResponse.java	5 Dec 2002 14:07:56 -0000	1.4.2.1
  @@ -68,16 +68,15 @@
    * @version CVS $Id$
    */
   
  -public class HttpResponse implements Response {
  +public final class HttpResponse implements Response {
   
       /** The real HttpServletResponse object */
  -    private HttpServletResponse res = null;
  +    private final HttpServletResponse res;
   
       /**
        * Creates a HttpServletResponse based on a real HttpServletResponse object
        */
       protected HttpResponse (HttpServletResponse res) {
  -        super ();
           this.res = res;
       }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +2 -2      xml-cocoon2/src/java/org/apache/cocoon/environment/ForwardRedirector.java
  
  Index: ForwardRedirector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/ForwardRedirector.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- ForwardRedirector.java	28 Mar 2002 08:45:10 -0000	1.1
  +++ ForwardRedirector.java	5 Dec 2002 14:07:56 -0000	1.1.2.1
  @@ -232,7 +232,7 @@
        * Local extension of EnvironmentWrapper to propagate otherwise blocked
        * methods to the actual environment.
        */
  -    private class ForwardEnvironmentWrapper extends EnvironmentWrapper {
  +    private final class ForwardEnvironmentWrapper extends EnvironmentWrapper {
           
           public ForwardEnvironmentWrapper(Environment env,
                                 String      requestURI,
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org