You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by si...@apache.org on 2002/04/15 12:45:32 UTC

cvs commit: jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/context ChainedContext.java ViewContext.java

sidler      02/04/15 03:45:32

  Modified:    struts/src/java/org/apache/velocity/tools/struts
                        LinkTool.java
               view/src/java/org/apache/velocity/tools/view/context
                        ChainedContext.java ViewContext.java
  Added:       struts/examples/struts/WEB-INF/lib
                        velocity-tools-view-0.6.jar
               struts/lib velocity-tools-view-0.6.jar
               tools/lib velocity-tools-view-0.6.jar
  Removed:     struts/examples/struts/WEB-INF/lib
                        velocity-tools-struts-0.7.jar
                        velocity-tools-view-0.4.jar
               struts/lib velocity-tools-view-0.4.jar
               tools/lib velocity-tools-view-0.4.jar
  Log:
  Modified VelStruts LinkTool such that it encodes the session ID into
  the returned URL if cookies are not supported by the web client.
  
  This enhancement required that  ViewContext and ChainedContext are
  augmented to return the HttpServletResponse as well.
  
  Revision  Changes    Path
  1.1                  jakarta-velocity-tools/struts/examples/struts/WEB-INF/lib/velocity-tools-view-0.6.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-velocity-tools/struts/lib/velocity-tools-view-0.6.jar
  
  	<<Binary file>>
  
  
  1.4       +17 -5     jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/struts/LinkTool.java
  
  Index: LinkTool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/struts/LinkTool.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LinkTool.java	2 Apr 2002 16:46:30 -0000	1.3
  +++ LinkTool.java	15 Apr 2002 10:45:32 -0000	1.4
  @@ -59,6 +59,7 @@
   import java.net.URLEncoder;
   
   import javax.servlet.http.HttpServletRequest;
  +import javax.servlet.http.HttpServletResponse;
   import javax.servlet.http.HttpSession;
   import javax.servlet.ServletContext;
   
  @@ -85,7 +86,7 @@
    * @author <a href="mailto:sidler@teamup.com">Gabe Sidler</a>
    * @author <a href="mailto:nathan@esha.com">Nathan Bubna</a>
    *
  - * @version $Id: LinkTool.java,v 1.3 2002/04/02 16:46:30 sidler Exp $
  + * @version $Id: LinkTool.java,v 1.4 2002/04/15 10:45:32 sidler Exp $
    * 
    */
   public class LinkTool extends LogEnabledContextToolImpl 
  @@ -101,13 +102,19 @@
   
   
       /**
  -     * A reference to the HtttpServletRequest.
  +     * A reference to the HttpServletRequest.
        */ 
       protected HttpServletRequest request;
       
   
       /**
  -     * A reference to the HtttpSession.
  +     * A reference to the HttpServletResponse.
  +     */ 
  +    protected HttpServletResponse response;
  +    
  +
  +    /**
  +     * A reference to the HttpSession.
        */ 
       protected HttpSession session;
   
  @@ -135,6 +142,7 @@
       public LinkTool()
       {
           request = null;
  +		response = null;
           session = null;
           application = null;
           
  @@ -150,6 +158,7 @@
       private LinkTool(ViewContext context)
       {
           this.request = context.getRequest();
  +		this.response = context.getResponse();
           this.application = context.getServletContext();    
   
           this.uri = null;
  @@ -168,6 +177,7 @@
       private LinkTool(LinkTool that, QueryPair pair)
       {
           this.request = that.request;
  +		this.response = that.response;
           this.application = that.application;    
           this.uri = that.uri;
           if (that.queryData != null)
  @@ -195,6 +205,7 @@
       private LinkTool(LinkTool that, String uri)
       {
           this.request = that.request;
  +		this.response = that.response;
           this.application = that.application;    
           //set to new uri
           this.uri = uri;
  @@ -477,8 +488,9 @@
               }
               out.append(query);
           }
  -
  -        return out.toString();
  +        // encode session ID into URL if sessions are used but cookies are
  +        // not supported
  +        return response.encodeURL(out.toString());
       }
   
   
  
  
  
  1.1                  jakarta-velocity-tools/tools/lib/velocity-tools-view-0.6.jar
  
  	<<Binary file>>
  
  
  1.4       +10 -1     jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/context/ChainedContext.java
  
  Index: ChainedContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/context/ChainedContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ChainedContext.java	2 Apr 2002 16:46:31 -0000	1.3
  +++ ChainedContext.java	15 Apr 2002 10:45:32 -0000	1.4
  @@ -99,7 +99,7 @@
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
    * @author <a href="mailto:sidler@teamup.com">Gabe Sidler</a>
    *
  - * @version $Id: ChainedContext.java,v 1.3 2002/04/02 16:46:31 sidler Exp $ 
  + * @version $Id: ChainedContext.java,v 1.4 2002/04/15 10:45:32 sidler Exp $ 
    */
   public class ChainedContext extends VelocityContext implements ViewContext
   {
  @@ -250,6 +250,15 @@
       public HttpServletRequest getRequest()
       {
           return request;
  +    }
  +
  +
  +    /**
  +     * <p>Returns the current servlet response.</p>
  +     */
  +    public HttpServletResponse getResponse()
  +    {
  +        return response;
       }
   
   
  
  
  
  1.3       +8 -1      jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/context/ViewContext.java
  
  Index: ViewContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/context/ViewContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ViewContext.java	2 Apr 2002 16:46:31 -0000	1.2
  +++ ViewContext.java	15 Apr 2002 10:45:32 -0000	1.3
  @@ -57,6 +57,7 @@
   import org.apache.velocity.context.Context;
   
   import javax.servlet.http.HttpServletRequest;
  +import javax.servlet.http.HttpServletResponse;
   import javax.servlet.ServletContext;
   
   
  @@ -74,7 +75,7 @@
    * @author <a href="mailto:sidler@teamup.com">Gabe Sidler</a>
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
    *
  - * @version $Id: ViewContext.java,v 1.2 2002/04/02 16:46:31 sidler Exp $ 
  + * @version $Id: ViewContext.java,v 1.3 2002/04/15 10:45:32 sidler Exp $ 
    */
   public interface ViewContext
   {
  @@ -82,6 +83,12 @@
        * <p>Returns the instance of {@link HttpServletRequest} for this request.</p>
        */
       public HttpServletRequest getRequest();
  +
  +
  +    /**
  +     * <p>Returns the instance of {@link HttpServletResponse} for this request.</p>
  +     */
  +    public HttpServletResponse getResponse();
   
   
       /**
  
  
  

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


Re: cvs commit: jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/context ChainedContext.java ViewContext.java

Posted by Gabriel Sidler <si...@teamup.ch>.
Daniel Rall wrote:

> The indentation is messed up in LogEnabledContextToolImpl.


Dan, I found some problems in class LinkTool, but not the class
you mention. LogEnabledContextToolImpl wasn't touched in the
quoted commit.

I guess you ment the problem I fixed. Thanks for the feedback.

Gabe




> 
> sidler@apache.org writes:
> 
> 
>>sidler      02/04/15 03:45:32
>>
>>  Modified:    struts/src/java/org/apache/velocity/tools/struts
>>                        LinkTool.java
>>               view/src/java/org/apache/velocity/tools/view/context
>>                        ChainedContext.java ViewContext.java
>>  Added:       struts/examples/struts/WEB-INF/lib
>>                        velocity-tools-view-0.6.jar
>>               struts/lib velocity-tools-view-0.6.jar
>>               tools/lib velocity-tools-view-0.6.jar
>>  Removed:     struts/examples/struts/WEB-INF/lib
>>                        velocity-tools-struts-0.7.jar
>>                        velocity-tools-view-0.4.jar
>>               struts/lib velocity-tools-view-0.4.jar
>>               tools/lib velocity-tools-view-0.4.jar
>>  Log:
>>  Modified VelStruts LinkTool such that it encodes the session ID into
>>  the returned URL if cookies are not supported by the web client.
>>  


--
Gabriel Sidler
Software Engineer, Eivycom GmbH, Zurich, Switzerland


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


Re: cvs commit: jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/context ChainedContext.java ViewContext.java

Posted by Daniel Rall <dl...@finemaltcoding.com>.
The indentation is messed up in LogEnabledContextToolImpl.

sidler@apache.org writes:

> sidler      02/04/15 03:45:32
>
>   Modified:    struts/src/java/org/apache/velocity/tools/struts
>                         LinkTool.java
>                view/src/java/org/apache/velocity/tools/view/context
>                         ChainedContext.java ViewContext.java
>   Added:       struts/examples/struts/WEB-INF/lib
>                         velocity-tools-view-0.6.jar
>                struts/lib velocity-tools-view-0.6.jar
>                tools/lib velocity-tools-view-0.6.jar
>   Removed:     struts/examples/struts/WEB-INF/lib
>                         velocity-tools-struts-0.7.jar
>                         velocity-tools-view-0.4.jar
>                struts/lib velocity-tools-view-0.4.jar
>                tools/lib velocity-tools-view-0.4.jar
>   Log:
>   Modified VelStruts LinkTool such that it encodes the session ID into
>   the returned URL if cookies are not supported by the web client.
>   
>   This enhancement required that  ViewContext and ChainedContext are
>   augmented to return the HttpServletResponse as well.
>   
>   Revision  Changes    Path
>   1.1                  jakarta-velocity-tools/struts/examples/struts/WEB-INF/lib/velocity-tools-view-0.6.jar
>   
>   	<<Binary file>>
>   
>   
>   1.1                  jakarta-velocity-tools/struts/lib/velocity-tools-view-0.6.jar
>   
>   	<<Binary file>>
>   
>   
>   1.4       +17 -5     jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/struts/LinkTool.java
>   
>   Index: LinkTool.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-velocity-tools/struts/src/java/org/apache/velocity/tools/struts/LinkTool.java,v
>   retrieving revision 1.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- LinkTool.java	2 Apr 2002 16:46:30 -0000	1.3
>   +++ LinkTool.java	15 Apr 2002 10:45:32 -0000	1.4
>   @@ -59,6 +59,7 @@
>    import java.net.URLEncoder;
>    
>    import javax.servlet.http.HttpServletRequest;
>   +import javax.servlet.http.HttpServletResponse;
>    import javax.servlet.http.HttpSession;
>    import javax.servlet.ServletContext;
>    
>   @@ -85,7 +86,7 @@
>     * @author <a href="mailto:sidler@teamup.com">Gabe Sidler</a>
>     * @author <a href="mailto:nathan@esha.com">Nathan Bubna</a>
>     *
>   - * @version $Id: LinkTool.java,v 1.3 2002/04/02 16:46:30 sidler Exp $
>   + * @version $Id: LinkTool.java,v 1.4 2002/04/15 10:45:32 sidler Exp $
>     * 
>     */
>    public class LinkTool extends LogEnabledContextToolImpl 
>   @@ -101,13 +102,19 @@
>    
>    
>        /**
>   -     * A reference to the HtttpServletRequest.
>   +     * A reference to the HttpServletRequest.
>         */ 
>        protected HttpServletRequest request;
>        
>    
>        /**
>   -     * A reference to the HtttpSession.
>   +     * A reference to the HttpServletResponse.
>   +     */ 
>   +    protected HttpServletResponse response;
>   +    
>   +
>   +    /**
>   +     * A reference to the HttpSession.
>         */ 
>        protected HttpSession session;
>    
>   @@ -135,6 +142,7 @@
>        public LinkTool()
>        {
>            request = null;
>   +		response = null;
>            session = null;
>            application = null;
>            
>   @@ -150,6 +158,7 @@
>        private LinkTool(ViewContext context)
>        {
>            this.request = context.getRequest();
>   +		this.response = context.getResponse();
>            this.application = context.getServletContext();    
>    
>            this.uri = null;
>   @@ -168,6 +177,7 @@
>        private LinkTool(LinkTool that, QueryPair pair)
>        {
>            this.request = that.request;
>   +		this.response = that.response;
>            this.application = that.application;    
>            this.uri = that.uri;
>            if (that.queryData != null)
>   @@ -195,6 +205,7 @@
>        private LinkTool(LinkTool that, String uri)
>        {
>            this.request = that.request;
>   +		this.response = that.response;
>            this.application = that.application;    
>            //set to new uri
>            this.uri = uri;
>   @@ -477,8 +488,9 @@
>                }
>                out.append(query);
>            }
>   -
>   -        return out.toString();
>   +        // encode session ID into URL if sessions are used but cookies are
>   +        // not supported
>   +        return response.encodeURL(out.toString());
>        }
>    
>    
>   
>   
>   
>   1.1                  jakarta-velocity-tools/tools/lib/velocity-tools-view-0.6.jar
>   
>   	<<Binary file>>
>   
>   
>   1.4       +10 -1     jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/context/ChainedContext.java
>   
>   Index: ChainedContext.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/context/ChainedContext.java,v
>   retrieving revision 1.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- ChainedContext.java	2 Apr 2002 16:46:31 -0000	1.3
>   +++ ChainedContext.java	15 Apr 2002 10:45:32 -0000	1.4
>   @@ -99,7 +99,7 @@
>     * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
>     * @author <a href="mailto:sidler@teamup.com">Gabe Sidler</a>
>     *
>   - * @version $Id: ChainedContext.java,v 1.3 2002/04/02 16:46:31 sidler Exp $ 
>   + * @version $Id: ChainedContext.java,v 1.4 2002/04/15 10:45:32 sidler Exp $ 
>     */
>    public class ChainedContext extends VelocityContext implements ViewContext
>    {
>   @@ -250,6 +250,15 @@
>        public HttpServletRequest getRequest()
>        {
>            return request;
>   +    }
>   +
>   +
>   +    /**
>   +     * <p>Returns the current servlet response.</p>
>   +     */
>   +    public HttpServletResponse getResponse()
>   +    {
>   +        return response;
>        }
>    
>    
>   
>   
>   
>   1.3       +8 -1      jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/context/ViewContext.java
>   
>   Index: ViewContext.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-velocity-tools/view/src/java/org/apache/velocity/tools/view/context/ViewContext.java,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- ViewContext.java	2 Apr 2002 16:46:31 -0000	1.2
>   +++ ViewContext.java	15 Apr 2002 10:45:32 -0000	1.3
>   @@ -57,6 +57,7 @@
>    import org.apache.velocity.context.Context;
>    
>    import javax.servlet.http.HttpServletRequest;
>   +import javax.servlet.http.HttpServletResponse;
>    import javax.servlet.ServletContext;
>    
>    
>   @@ -74,7 +75,7 @@
>     * @author <a href="mailto:sidler@teamup.com">Gabe Sidler</a>
>     * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
>     *
>   - * @version $Id: ViewContext.java,v 1.2 2002/04/02 16:46:31 sidler Exp $ 
>   + * @version $Id: ViewContext.java,v 1.3 2002/04/15 10:45:32 sidler Exp $ 
>     */
>    public interface ViewContext
>    {
>   @@ -82,6 +83,12 @@
>         * <p>Returns the instance of {@link HttpServletRequest} for this request.</p>
>         */
>        public HttpServletRequest getRequest();
>   +
>   +
>   +    /**
>   +     * <p>Returns the instance of {@link HttpServletResponse} for this request.</p>
>   +     */
>   +    public HttpServletResponse getResponse();
>    
>    
>        /**
>   
>   
>   
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

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