[prev in list] [next in list] [prev in thread] [next in thread] 

List:       turbine-dev
Subject:    cvs commit: jakarta-turbine-2/proposals/henning/jsp-tags/src/java/org/apache/turbine/services/jsp Js
From:       henning () apache ! org
Date:       2003-08-26 9:10:49
[Download RAW message or body]

henning     2003/08/26 02:10:49

  Added:       proposals/henning/jsp-tags/src/java/org/apache/turbine/modules/screens
                        BaseJspScreen.java.patch
               proposals/henning/jsp-tags/src/java/org/apache/turbine/services/jsp
                        JspService.java.patch TurbineJspService.java.patch
  Log:
  Missed the "patch" files.
  
  Revision  Changes    Path
  1.1                  \
jakarta-turbine-2/proposals/henning/jsp-tags/src/java/org/apache/turbine/modules/screens/BaseJspScreen.java.patch
  
  Index: BaseJspScreen.java.patch
  ===================================================================
  Index: BaseJspScreen.java
  ===================================================================
  RCS file: /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/modules/screens/BaseJspScreen.java,v
  retrieving revision 1.1.1.1
  diff -u -r1.1.1.1 BaseJspScreen.java
  --- BaseJspScreen.java	16 Aug 2001 05:08:37 -0000	1.1.1.1
  +++ BaseJspScreen.java	11 Feb 2003 14:14:32 -0000
  @@ -82,9 +82,6 @@
       public ConcreteElement buildTemplate( RunData data )
           throws Exception
       {
  -        // set up any data in beans, etc
  -        doBuildTemplate(data);
  -
           // get the name of the JSP we want to use
           String templateName = TurbineTemplate.getScreenTemplateName(
               data.getTemplateInfo().getScreenTemplate() );
  
  
  
  1.1                  \
jakarta-turbine-2/proposals/henning/jsp-tags/src/java/org/apache/turbine/services/jsp/JspService.java.patch
  
  Index: JspService.java.patch
  ===================================================================
  Index: JspService.java
  ===================================================================
  RCS file: /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/services/jsp/JspService.java,v
  retrieving revision 1.3
  diff -u -r1.3 JspService.java
  --- JspService.java	11 Jan 2003 18:42:33 -0000	1.3
  +++ JspService.java	11 Feb 2003 14:18:55 -0000
  @@ -57,12 +57,13 @@
   import org.apache.turbine.services.Service;
   import org.apache.turbine.util.RunData;
   import org.apache.turbine.util.TurbineException;
  -
  +import org.apache.velocity.context.Context;
   
   /**
    * Implementations of the JspService interface.
    *
    * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
  + * @author <a href="mailto:gabrielm@itcsoluciones.com">Gabriel A. Moreno</a>
    */
   public interface JspService extends Service 
   {
  @@ -72,9 +73,14 @@
       static final String RUNDATA = "rundata";
       /** The key used to store an instance of JspLink in the request */
       static final String LINK = "link";
  +    /** The key used to store an instance of Context in the request */
  +    static final String CONTEXT_INSTANCE = "context";
  +    /** The key used to store an instance of Context in RunData */
  +    static final String CONTEXT = "JSP_CONTEXT";
       
       /**
  -     * Adds some useful objects to the request, so they are available to the JSP.
  +     * Adds some useful objects to the request, so they are available
  +     * to the JSP.
        */    
       void addDefaultObjects(RunData data);
   
  @@ -105,4 +111,19 @@
        */
       String getRelativeTemplateName(String template);
   
  +    /**
  +     * Create an empty WebContext object.
  +     *
  +     * @return An empty WebContext object.
  +     */
  +    Context getContext();
  +
  +    /**
  +     * Create a Context from the RunData object.
  +     *
  +     * @param data The Turbine RunData object.
  +     * @return A clone of the Context
  +     */
  +    Context getContext(RunData data);
  +    
   }
  
  
  
  1.1                  \
jakarta-turbine-2/proposals/henning/jsp-tags/src/java/org/apache/turbine/services/jsp/TurbineJspService.java.patch
  
  Index: TurbineJspService.java.patch
  ===================================================================
  Index: TurbineJspService.java
  ===================================================================
  RCS file: /home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/services/jsp/TurbineJspService.java,v
  retrieving revision 1.8
  diff -u -r1.8 TurbineJspService.java
  --- TurbineJspService.java	13 Jan 2003 21:14:29 -0000	1.8
  +++ TurbineJspService.java	11 Feb 2003 14:43:37 -0000
  @@ -67,6 +67,8 @@
   import org.apache.turbine.services.template.TurbineTemplate;
   import org.apache.turbine.util.RunData;
   import org.apache.turbine.util.TurbineException;
  +import org.apache.velocity.context.Context;
  +import org.apache.velocity.VelocityContext;
   
   
   /**
  @@ -76,6 +78,7 @@
    * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  + * @author <a href="mailto:gabrielm@itcsoluciones.com">Gabriel A. Moreno</a>
    */
   public class TurbineJspService extends BaseTemplateEngineService
       implements JspService
  @@ -137,6 +140,7 @@
           HttpServletRequest req = data.getRequest();
           req.setAttribute(LINK, new JspLink(data));
           req.setAttribute(RUNDATA, data);
  +        req.setAttribute(CONTEXT_INSTANCE, getContext(data));
       }
   
       /**
  @@ -307,4 +311,40 @@
           }
           return null;
       }
  +
  +    /**
  +     * Create a Context object that also contains the globalContext.
  +     *
  +     * @return A Context object.
  +     */
  +    public Context getContext()
  +    {
  +        return new VelocityContext(/*globalContext*/);
  +    }
  +
  +    /**
  +     * Create a Context from the RunData object.  
  +     *
  +     * @param data The Turbine RunData object.
  +     * @return A clone of the WebContext needed by Velocity.
  +     */
  +    public Context getContext(RunData data)
  +    {
  +        /*
  +         * Attempt to get it from the data first.  If it doesn't
  +         * exist, create it and then stuff it into the data.
  +         */
  +        Context context = (Context)
  +            data.getTemplateInfo().getTemplateContext(JspService.CONTEXT);
  +
  +        if (context == null)
  +        {
  +            context = getContext();
  +
  +            data.getTemplateInfo().setTemplateContext(
  +                JspService.CONTEXT, context);
  +        }
  +        return context;
  +    }
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic