You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/01/29 17:45:15 UTC

cvs commit: jakarta-tapestry/framework/src/test/org/apache/tapestry/engine/state TestSessionScopeManager.java

hlship      2005/01/29 08:45:15

  Modified:    framework/src/java/org/apache/tapestry/services/impl
                        InfrastructureObjectProvider.java
                        InfrastructureImpl.java TemplateSourceImpl.java
               framework/src/descriptor/META-INF tapestry.request.xml
                        tapestry.persist.xml tapestry.asset.xml
                        tapestry.services.xml tapestry.parse.xml
                        hivemodule.xml tapestry.url.xml tapestry.page.xml
                        tapestry.state.xml
               framework/src/java/org/apache/tapestry/resolver
                        AbstractSpecificationResolver.java
                        PageSpecificationResolverImpl.java
                        ComponentSpecificationResolverImpl.java
               framework/src/java/org/apache/tapestry/engine/state
                        SessionScopeManager.java
               framework/src/java/org/apache/tapestry/record
                        SessionPropertyPersistenceStrategy.java
               framework/src/java/org/apache/tapestry/services
                        Infrastructure.java
               framework/src/java/org/apache/tapestry/pageload
                        PageLoader.java
               framework/src/test/org/apache/tapestry/record
                        TestSessionPropertyPersistenceStrategy.java
               framework/src/test/org/apache/tapestry/engine/state
                        TestSessionScopeManager.java
  Log:
  Make the infrastructure: object provider prefix cache results for efficiency.
  Add additional properties to Infrastructure.
  
  Revision  Changes    Path
  1.5       +20 -2     jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/InfrastructureObjectProvider.java
  
  Index: InfrastructureObjectProvider.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/InfrastructureObjectProvider.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- InfrastructureObjectProvider.java	5 Jan 2005 23:16:57 -0000	1.4
  +++ InfrastructureObjectProvider.java	29 Jan 2005 16:45:14 -0000	1.5
  @@ -14,6 +14,9 @@
   
   package org.apache.tapestry.services.impl;
   
  +import java.util.HashMap;
  +import java.util.Map;
  +
   import org.apache.hivemind.ErrorLog;
   import org.apache.hivemind.Location;
   import org.apache.hivemind.internal.Module;
  @@ -36,8 +39,23 @@
   
       private Infrastructure _infrastructure;
   
  -    public Object provideObject(Module contributingModule, Class propertyType, String locator,
  -            Location location)
  +    private Map _cache = new HashMap();
  +
  +    public synchronized Object provideObject(Module contributingModule, Class propertyType,
  +            String locator, Location location)
  +    {
  +        Object result = _cache.get(locator);
  +
  +        if (result == null)
  +        {
  +            result = readProperty(locator, location);
  +            _cache.put(locator, result);
  +        }
  +
  +        return result;
  +    }
  +
  +    Object readProperty(String locator, Location location)
       {
           try
           {
  
  
  
  1.15      +59 -0     jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/InfrastructureImpl.java
  
  Index: InfrastructureImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/InfrastructureImpl.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- InfrastructureImpl.java	28 Jan 2005 21:07:16 -0000	1.14
  +++ InfrastructureImpl.java	29 Jan 2005 16:45:14 -0000	1.15
  @@ -14,7 +14,13 @@
   
   package org.apache.tapestry.services.impl;
   
  +import javax.servlet.ServletContext;
  +import javax.servlet.http.HttpServletRequest;
  +import javax.servlet.http.HttpServletResponse;
  +
   import org.apache.hivemind.ClassResolver;
  +import org.apache.hivemind.Resource;
  +import org.apache.hivemind.util.ContextResource;
   import org.apache.tapestry.engine.IPageSource;
   import org.apache.tapestry.engine.IPropertySource;
   import org.apache.tapestry.engine.IScriptSource;
  @@ -75,6 +81,14 @@
   
       private ApplicationStateManager _applicationStateManager;
   
  +    private HttpServletRequest _request;
  +
  +    private HttpServletResponse _response;
  +    
  +    private ServletContext _context;
  +
  +    private String _applicationId;
  +
       public IScriptSource getScriptSource()
       {
           return _scriptSource;
  @@ -245,4 +259,49 @@
       {
           _applicationStateManager = applicationStateManager;
       }
  +
  +    public HttpServletRequest getRequest()
  +    {
  +        return _request;
  +    }
  +
  +    public void setRequest(HttpServletRequest request)
  +    {
  +        _request = request;
  +    }
  +
  +    public HttpServletResponse getResponse()
  +    {
  +        return _response;
  +    }
  +
  +    public void setResponse(HttpServletResponse response)
  +    {
  +        _response = response;
  +    }
  +
  +    public String getContextPath()
  +    {
  +        return _request.getContextPath();
  +    }
  +
  +    public String getApplicationId()
  +    {
  +        return _applicationId;
  +    }
  +
  +    public void setApplicationId(String applicationId)
  +    {
  +        _applicationId = applicationId;
  +    }
  +    
  +    public void setContext(ServletContext context)
  +    {
  +        _context = context;
  +    }
  +    
  +    public Resource getContextRoot()
  +    {
  +        return new ContextResource(_context, "/");
  +    }
   }
  \ No newline at end of file
  
  
  
  1.7       +6 -29     jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/TemplateSourceImpl.java
  
  Index: TemplateSourceImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/TemplateSourceImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TemplateSourceImpl.java	6 Jan 2005 02:17:11 -0000	1.6
  +++ TemplateSourceImpl.java	29 Jan 2005 16:45:14 -0000	1.7
  @@ -84,7 +84,7 @@
   
       /** @since 2.2 */
   
  -    private Resource _applicationRoot;
  +    private Resource _contextRoot;
   
       /** @since 3.0 */
   
  @@ -94,25 +94,11 @@
   
       private IPropertySource _applicationPropertySource;
   
  -    /** @since 3.1 */
  -
  -    private ServletContext _context;
  -
  -    /** @since 3.1 */
  -
  -    private HttpServletRequest _request;
   
       /** @since 3.1 */
   
       private ComponentSpecificationResolver _componentSpecificationResolver;
   
  -    public void initializeService()
  -    {
  -        String servletPath = _request.getServletPath();
  -
  -        _applicationRoot = new ContextResource(_context, servletPath);
  -    }
  -
       /**
        * Clears the template cache. This is used during debugging.
        */
  @@ -232,7 +218,7 @@
           if (_log.isDebugEnabled())
               _log.debug("Checking for " + templateBaseName + " in application root");
   
  -        Resource baseLocation = _applicationRoot.getRelativeResource(templateBaseName);
  +        Resource baseLocation = _contextRoot.getRelativeResource(templateBaseName);
           Resource localizedLocation = baseLocation.getLocalization(locale);
   
           if (localizedLocation == null)
  @@ -516,23 +502,14 @@
   
       /** @since 3.1 */
   
  -    public void setContext(ServletContext context)
  -    {
  -        _context = context;
  -    }
  -
  -    /** @since 3.1 */
  -
  -    public void setRequest(HttpServletRequest request)
  +    public void setComponentSpecificationResolver(ComponentSpecificationResolver resolver)
       {
  -        _request = request;
  +        _componentSpecificationResolver = resolver;
       }
   
       /** @since 3.1 */
  -
  -    public void setComponentSpecificationResolver(ComponentSpecificationResolver resolver)
  +    public void setContextRoot(Resource contextRoot)
       {
  -        _componentSpecificationResolver = resolver;
  +        _contextRoot = contextRoot;
       }
  -
   }
  \ No newline at end of file
  
  
  
  1.10      +4 -4      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.request.xml
  
  Index: tapestry.request.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.request.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- tapestry.request.xml	29 Jan 2005 01:03:16 -0000	1.9
  +++ tapestry.request.xml	29 Jan 2005 16:45:14 -0000	1.10
  @@ -38,7 +38,7 @@
       
       <invoke-factory model="threaded">
         <construct class="org.apache.tapestry.services.impl.RequestLocaleManagerImpl">
  -        <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
  +        <set-object property="request" value="infrastructure:request"/>
           <set-service property="cookieSource" service-id="CookieSource"/>
         </construct>
       </invoke-factory>
  @@ -50,8 +50,8 @@
       
       <invoke-factory>
         <construct class="org.apache.tapestry.services.impl.CookieSourceImpl">
  -        <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
  -        <set-service property="response" service-id="tapestry.globals.HttpServletResponse"/>
  +        <set-object property="request" value="infrastructure:request"/>
  +        <set-object property="response" value="infrastructure:response"/>
         </construct>
       </invoke-factory>    
     </service-point>  
  @@ -134,7 +134,7 @@
       
       <invoke-factory>
         <construct class="org.apache.tapestry.services.impl.AbsoluteURLBuilderImpl">
  -        <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
  +        <set-object property="request" value="infrastructure:request"/>
         </construct>
       </invoke-factory>
       
  
  
  
  1.2       +2 -2      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.persist.xml
  
  Index: tapestry.persist.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.persist.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- tapestry.persist.xml	8 Jan 2005 19:52:20 -0000	1.1
  +++ tapestry.persist.xml	29 Jan 2005 16:45:14 -0000	1.2
  @@ -51,8 +51,8 @@
       
       <invoke-factory>
         <construct class="org.apache.tapestry.record.SessionPropertyPersistenceStrategy">
  -        <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
  -        <set-object property="applicationName" value="service-property:tapestry.globals.ApplicationGlobals:servletName"/>
  +        <set-object property="request" value="infrastructure:request"/>
  +        <set-object property="applicationId" value="infrastructure:applicationId"/>
         </construct>
       </invoke-factory>
       
  
  
  
  1.5       +1 -1      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.asset.xml
  
  Index: tapestry.asset.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.asset.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- tapestry.asset.xml	28 Jan 2005 21:07:15 -0000	1.4
  +++ tapestry.asset.xml	29 Jan 2005 16:45:14 -0000	1.5
  @@ -63,7 +63,7 @@
       <invoke-factory>
         <construct class="org.apache.tapestry.asset.ContextAssetFactory">
           <set-service property="servletContext" service-id="tapestry.globals.ServletContext"/>
  -        <set-object property="contextPath" value="service-property:tapestry.globals.HttpServletRequest:contextPath"/>
  +        <set-object property="contextPath" value="infrastructure:contextPath"/>
         </construct>
       </invoke-factory>
       
  
  
  
  1.10      +4 -4      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.services.xml
  
  Index: tapestry.services.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.services.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- tapestry.services.xml	27 Jan 2005 22:54:34 -0000	1.9
  +++ tapestry.services.xml	29 Jan 2005 16:45:14 -0000	1.10
  @@ -82,8 +82,8 @@
       <invoke-factory model="primitive">
         <construct class="org.apache.tapestry.engine.RestartService">
           <set-service property="builder" service-id="tapestry.request.AbsoluteURLBuilder"/>
  -        <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
  -        <set-service property="response" service-id="tapestry.globals.HttpServletResponse"/>
  +        <set-object property="request" value="infrastructure:request"/>
  +        <set-object property="response" value="infrastructure:response"/>
           <set-object property="servletPath" value="app-property:org.apache.tapestry.servlet-path"/>
         </construct>
       </invoke-factory>
  @@ -102,7 +102,7 @@
       <invoke-factory model="primitive">
         <construct class="org.apache.tapestry.engine.ActionService">
           <set-object property="responseRenderer" value="infrastructure:responseRenderer"/>
  -        <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
  +        <set-object property="request" value="infrastructure:request"/>
           <set-object property="linkFactory" value="infrastructure:linkFactory"/>
         </construct>
       </invoke-factory>
  @@ -112,7 +112,7 @@
       <invoke-factory model="primitive">
         <construct class="org.apache.tapestry.engine.DirectService">
           <set-object property="responseRenderer" value="infrastructure:responseRenderer"/>
  -        <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
  +        <set-object property="request" value="infrastructure:request"/>
         </construct>
       </invoke-factory>
     </service-point>
  
  
  
  1.8       +1 -2      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.parse.xml
  
  Index: tapestry.parse.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.parse.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- tapestry.parse.xml	6 Jan 2005 02:17:26 -0000	1.7
  +++ tapestry.parse.xml	29 Jan 2005 16:45:14 -0000	1.8
  @@ -78,8 +78,7 @@
           <set-object property="applicationPropertySource" 
                          value="infrastructure:applicationPropertySource"/>
           <set-service property="delegate" service-id="TemplateSourceDelegate"/>
  -        <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
  -        <set-object property="context" value="service-property:tapestry.globals.ApplicationGlobals:context"/>
  +        <set-object property="contextRoot" value="infrastructure:contextRoot"/>
           <set-service property="componentSpecificationResolver" service-id="tapestry.page.ComponentSpecificationResolver"/>
           <event-listener service-id="tapestry.ResetEventCoordinator"/>
         </construct>
  
  
  
  1.20      +6 -2      jakarta-tapestry/framework/src/descriptor/META-INF/hivemodule.xml
  
  Index: hivemodule.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/hivemodule.xml,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- hivemodule.xml	28 Jan 2005 21:07:15 -0000	1.19
  +++ hivemodule.xml	29 Jan 2005 16:45:14 -0000	1.20
  @@ -52,7 +52,7 @@
       A kind of "clearing house" of other services. The Infrastructure is provided to the
       IEngine instance via the InvokeEngineTerminator service (using an HttpServletRequest
       attribute).  The engine can then get the other services it depends upon.
  -    The infrastructure: object provider interface allows access to the properties
  +    The infrastructure: object provider allows access to the properties
       of this service.
       
       <invoke-factory>
  @@ -73,6 +73,10 @@
           <set-service property="linkFactory" service-id="tapestry.url.LinkFactory"/>
           <set-service property="requestCycleFactory" service-id="tapestry.request.RequestCycleFactory"/>
           <set-service property="applicationStateManager" service-id="tapestry.state.ApplicationStateManager"/>
  +        <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
  +        <set-service property="response" service-id="tapestry.globals.HttpServletResponse"/>
  +        <set-object property="applicationId" value="service-property:tapestry.globals.ApplicationGlobals:servletName"/>
  +        <set-object property="context" value="service-property:tapestry.globals.ApplicationGlobals:context"/>
         </construct>
       </invoke-factory>
       
  @@ -166,7 +170,7 @@
       
       <invoke-factory>
         <construct class="org.apache.tapestry.services.impl.RequestExceptionReporterImpl">
  -        <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
  +        <set-object property="request" value="infrastructure:request"/>
         </construct>
       </invoke-factory>
     </service-point>
  
  
  
  1.7       +1 -1      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.url.xml
  
  Index: tapestry.url.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.url.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- tapestry.url.xml	27 Jan 2005 22:54:34 -0000	1.6
  +++ tapestry.url.xml	29 Jan 2005 16:45:14 -0000	1.7
  @@ -28,7 +28,7 @@
           <set-object property="dataSqueezer" value="infrastructure:dataSqueezer"/>
           <set-configuration property="contributions" configuration-id="ServiceEncoders"/>
           <set-object property="servletPath" value="app-property:org.apache.tapestry.servlet-path"/>
  -        <set-object property="contextPath" value="service-property:tapestry.globals.HttpServletRequest:contextPath"/>
  +        <set-object property="contextPath" value="infrastructure:contextPath"/>
         </construct>
       </invoke-factory>
       
  
  
  
  1.10      +4 -5      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.page.xml
  
  Index: tapestry.page.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.page.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- tapestry.page.xml	6 Jan 2005 02:17:26 -0000	1.9
  +++ tapestry.page.xml	29 Jan 2005 16:45:14 -0000	1.10
  @@ -39,7 +39,6 @@
           <set-service property="componentResolver" service-id="ComponentSpecificationResolver"/>      
           <set-service property="bindingSource" service-id="tapestry.bindings.BindingSource"/>
           <set-service property="componentTemplateLoader" service-id="ComponentTemplateLoader"/>
  -        <set-object property="context" value="service-property:tapestry.globals.ApplicationGlobals:context"/>
           <set-service property="establishDefaultParameterValuesVisitor"
             service-id="EstablishDefaultParameterValuesVisitor"/>
           <set-object property="defaultPageClassName"
  @@ -80,8 +79,8 @@
         <construct class="org.apache.tapestry.resolver.PageSpecificationResolverImpl">
           <set-object property="specificationSource" value="infrastructure:specificationSource"/>
           <set-service property="delegate" service-id="SpecificationResolverDelegate"/>
  -        <set-object property="servletName" value="service-property:tapestry.globals.ApplicationGlobals:servletName"/>
  -        <set-object property="context" value="service-property:tapestry.globals.ApplicationGlobals:context"/>
  +        <set-object property="applicationId" value="infrastructure:applicationId"/>
  +        <set-object property="contextRoot" value="infrastructure:contextRoot"/>
         </construct>
       </invoke-factory>
       
  @@ -102,8 +101,8 @@
         <construct class="org.apache.tapestry.resolver.ComponentSpecificationResolverImpl">
           <set-object property="specificationSource" value="infrastructure:specificationSource"/>
           <set-service property="delegate" service-id="SpecificationResolverDelegate"/>
  -        <set-object property="servletName" value="service-property:tapestry.globals.ApplicationGlobals:servletName"/>
  -        <set-object property="context" value="service-property:tapestry.globals.ApplicationGlobals:context"/>
  +        <set-object property="applicationId" value="infrastructure:applicationId"/>
  +        <set-object property="contextRoot" value="infrastructure:contextRoot"/>
         </construct>
       </invoke-factory>    
     </service-point>
  
  
  
  1.2       +2 -2      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.state.xml
  
  Index: tapestry.state.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.state.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- tapestry.state.xml	28 Jan 2005 21:07:15 -0000	1.1
  +++ tapestry.state.xml	29 Jan 2005 16:45:14 -0000	1.2
  @@ -169,8 +169,8 @@
       
       <invoke-factory>
         <construct class="org.apache.tapestry.engine.state.SessionScopeManager">
  -        <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
  -        <set-object property="applicationName" value="service-property:tapestry.globals.ApplicationGlobals:servletName"/>
  +        <set-object property="request" value="infrastructure:request"/>
  +        <set-object property="applicationName" value="infrastructure:applicationId"/>
         </construct>
       </invoke-factory>
     </service-point>
  
  
  
  1.7       +49 -62    jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/AbstractSpecificationResolver.java
  
  Index: AbstractSpecificationResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/AbstractSpecificationResolver.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractSpecificationResolver.java	6 Jan 2005 02:17:32 -0000	1.6
  +++ AbstractSpecificationResolver.java	29 Jan 2005 16:45:14 -0000	1.7
  @@ -23,13 +23,12 @@
   import org.apache.tapestry.spec.IComponentSpecification;
   
   /**
  - *  Base class for resolving a {@link org.apache.tapestry.spec.IComponentSpecification}
  - *  for a particular page or component, within a specified 
  - *  {@link org.apache.tapestry.INamespace}.  In some cases, a search is necessary.
  - *
  - *  @author Howard Lewis Ship
  - *  @since 3.0
  - *
  + * Base class for resolving a {@link org.apache.tapestry.spec.IComponentSpecification}for a
  + * particular page or component, within a specified {@link org.apache.tapestry.INamespace}. In some
  + * cases, a search is necessary.
  + * 
  + * @author Howard Lewis Ship
  + * @since 3.0
    */
   
   public class AbstractSpecificationResolver
  @@ -42,31 +41,31 @@
   
       /** Set by container */
       private ISpecificationSource _specificationSource;
  +
       private ISpecificationResolverDelegate _delegate;
  -    private String _servletName;
  -    private ServletContext _context;
   
  -    /** Initializes in initializeService() */
  -    private Resource _applicationRootLocation;
  +    private String _applicationId;
  +
  +    private Resource _contextRoot;
  +
  +    /** Initialized in initializeService() */
  +
       private Resource _webInfLocation;
  +
       private Resource _webInfAppLocation;
   
       public void initializeService()
       {
  -        _applicationRootLocation = new ContextResource(_context, "/");
  -
  -        _webInfLocation = _applicationRootLocation.getRelativeResource("WEB-INF/");
  +        _webInfLocation = _contextRoot.getRelativeResource("WEB-INF/");
   
  -        _webInfAppLocation = _webInfLocation.getRelativeResource(_servletName + "/");
  +        _webInfAppLocation = _webInfLocation.getRelativeResource(_applicationId + "/");
       }
   
       /**
  -     *  Returns the {@link ISpecificationResolverDelegate} instance registered
  -     *  in the application specification as extension
  -     *  {@link Tapestry#SPECIFICATION_RESOLVER_DELEGATE_EXTENSION_NAME},
  -     *  or null if no such extension exists.
  -     * 
  -     **/
  +     * Returns the {@link ISpecificationResolverDelegate}instance registered in the application
  +     * specification as extension {@link Tapestry#SPECIFICATION_RESOLVER_DELEGATE_EXTENSION_NAME},
  +     * or null if no such extension exists.
  +     */
   
       public ISpecificationResolverDelegate getDelegate()
       {
  @@ -74,20 +73,22 @@
       }
   
       /**
  -     *  Returns the location of the servlet, within the
  -     *  servlet context.
  -     * 
  -     **/
  +     * Returns the location of the servlet, within the servlet context.
  +     */
   
  -    protected Resource getApplicationRootLocation()
  +    protected Resource getContextRoot()
       {
  -        return _applicationRootLocation;
  +        return _contextRoot;
  +    }
  +
  +    public void setContextRoot(Resource contextRoot)
  +    {
  +        _contextRoot = contextRoot;
       }
   
       /**
  -     *  Invoked in subclasses to identify the resolved namespace.
  -     * 
  -     **/
  +     * Invoked in subclasses to identify the resolved namespace.
  +     */
   
       protected void setNamespace(INamespace namespace)
       {
  @@ -95,9 +96,8 @@
       }
   
       /**
  -     *  Returns the resolve namespace.
  -     * 
  -     **/
  +     * Returns the resolve namespace.
  +     */
   
       public INamespace getNamespace()
       {
  @@ -105,9 +105,8 @@
       }
   
       /**
  -     *  Returns the specification source for the running application.
  -     * 
  -     **/
  +     * Returns the specification source for the running application.
  +     */
   
       protected ISpecificationSource getSpecificationSource()
       {
  @@ -115,9 +114,8 @@
       }
   
       /**
  -     *  Returns the location of /WEB-INF/, in the servlet context.
  -     * 
  -     **/
  +     * Returns the location of /WEB-INF/, in the servlet context.
  +     */
   
       protected Resource getWebInfLocation()
       {
  @@ -125,10 +123,9 @@
       }
   
       /**
  -     *  Returns the location of the application-specific subdirectory, under
  -     *  /WEB-INF/, in the servlet context.
  -     * 
  -     **/
  +     * Returns the location of the application-specific subdirectory, under /WEB-INF/, in the
  +     * servlet context.
  +     */
   
       protected Resource getWebInfAppLocation()
       {
  @@ -136,9 +133,8 @@
       }
   
       /**
  -     *  Returns the resolved specification.
  -     * 
  -     **/
  +     * Returns the resolved specification.
  +     */
   
       public IComponentSpecification getSpecification()
       {
  @@ -146,10 +142,8 @@
       }
   
       /**
  -     *  Invoked in subclass to set the final specification the initial
  -     *  inputs are resolved to.
  -     * 
  -     **/
  +     * Invoked in subclass to set the final specification the initial inputs are resolved to.
  +     */
   
       protected void setSpecification(IComponentSpecification specification)
       {
  @@ -157,9 +151,8 @@
       }
   
       /**
  -     *  Clears the namespace and specification properties.
  -     * 
  -     **/
  +     * Clears the namespace and specification properties.
  +     */
   
       protected void reset()
       {
  @@ -174,15 +167,9 @@
       }
   
       /** @since 3.1 */
  -    public void setContext(ServletContext context)
  -    {
  -        _context = context;
  -    }
  -
  -    /** @since 3.1 */
  -    public void setServletName(String name)
  +    public void setApplicationId(String applicationId)
       {
  -        _servletName = name;
  +        _applicationId = applicationId;
       }
   
       /** @since 3.1 */
  @@ -191,4 +178,4 @@
           _specificationSource = source;
       }
   
  -}
  +}
  \ No newline at end of file
  
  
  
  1.4       +2 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/PageSpecificationResolverImpl.java
  
  Index: PageSpecificationResolverImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/PageSpecificationResolverImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PageSpecificationResolverImpl.java	6 Jan 2005 02:17:32 -0000	1.3
  +++ PageSpecificationResolverImpl.java	29 Jan 2005 16:45:14 -0000	1.4
  @@ -171,7 +171,7 @@
               if (found(getWebInfLocation().getRelativeResource(expectedName)))
                   return;
   
  -            if (found(getApplicationRootLocation().getRelativeResource(expectedName)))
  +            if (found(getContextRoot().getRelativeResource(expectedName)))
                   return;
   
               // The wierd one ... where we see if there's a template in the application root location.
  @@ -179,7 +179,7 @@
               String templateName = _simpleName + "." + getTemplateExtension();
   
               Resource templateResource =
  -                getApplicationRootLocation().getRelativeResource(templateName);
  +                getContextRoot().getRelativeResource(templateName);
   
               if (templateResource.getResourceURL() != null)
               {
  
  
  
  1.4       +1 -1      jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/ComponentSpecificationResolverImpl.java
  
  Index: ComponentSpecificationResolverImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/ComponentSpecificationResolverImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ComponentSpecificationResolverImpl.java	6 Jan 2005 02:17:31 -0000	1.3
  +++ ComponentSpecificationResolverImpl.java	29 Jan 2005 16:45:14 -0000	1.4
  @@ -194,7 +194,7 @@
               if (found(getWebInfLocation().getRelativeResource(expectedName)))
                   return;
   
  -            if (found(getApplicationRootLocation().getRelativeResource(expectedName)))
  +            if (found(getContextRoot().getRelativeResource(expectedName)))
                   return;
           }
   
  
  
  
  1.2       +4 -4      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/state/SessionScopeManager.java
  
  Index: SessionScopeManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/state/SessionScopeManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SessionScopeManager.java	28 Jan 2005 21:07:14 -0000	1.1
  +++ SessionScopeManager.java	29 Jan 2005 16:45:15 -0000	1.2
  @@ -28,11 +28,11 @@
   {
       private HttpServletRequest _request;
   
  -    private String _applicationName;
  +    private String _applicationId;
   
       private String buildKey(String objectName)
       {
  -        return "state:" + _applicationName + ":" + objectName;
  +        return "state:" + _applicationId + ":" + objectName;
       }
   
       /**
  @@ -81,9 +81,9 @@
               session.setAttribute(key, stateObject);
       }
   
  -    public void setApplicationName(String applicationName)
  +    public void setApplicationId(String applicationName)
       {
  -        _applicationName = applicationName;
  +        _applicationId = applicationName;
       }
   
       public void setRequest(HttpServletRequest request)
  
  
  
  1.2       +6 -6      jakarta-tapestry/framework/src/java/org/apache/tapestry/record/SessionPropertyPersistenceStrategy.java
  
  Index: SessionPropertyPersistenceStrategy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/record/SessionPropertyPersistenceStrategy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SessionPropertyPersistenceStrategy.java	8 Jan 2005 19:52:20 -0000	1.1
  +++ SessionPropertyPersistenceStrategy.java	29 Jan 2005 16:45:15 -0000	1.2
  @@ -39,7 +39,7 @@
       // to keep things straight if multiple Tapestry apps are deployed
       // in the same WAR.
   
  -    private String _applicationName;
  +    private String _applicationId;
   
       private HttpServletRequest _request;
   
  @@ -54,7 +54,7 @@
   
           StringBuffer buffer = new StringBuffer();
   
  -        buffer.append(_applicationName);
  +        buffer.append(_applicationId);
           buffer.append(",");
           buffer.append(pageName);
   
  @@ -86,7 +86,7 @@
   
           Collection result = new ArrayList();
   
  -        String prefix = _applicationName + "," + pageName + ",";
  +        String prefix = _applicationId + "," + pageName + ",";
   
           Enumeration e = session.getAttributeNames();
           while (e.hasMoreElements())
  @@ -126,7 +126,7 @@
           if (session == null)
               return;
   
  -        String prefix = _applicationName + "," + pageName + ",";
  +        String prefix = _applicationId + "," + pageName + ",";
   
           Enumeration e = session.getAttributeNames();
           while (e.hasMoreElements())
  @@ -138,9 +138,9 @@
           }
       }
   
  -    public void setApplicationName(String applicationName)
  +    public void setApplicationId(String applicationName)
       {
  -        _applicationName = applicationName;
  +        _applicationId = applicationName;
       }
   
       public void setRequest(HttpServletRequest request)
  
  
  
  1.15      +42 -3     jakarta-tapestry/framework/src/java/org/apache/tapestry/services/Infrastructure.java
  
  Index: Infrastructure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/Infrastructure.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Infrastructure.java	28 Jan 2005 21:07:14 -0000	1.14
  +++ Infrastructure.java	29 Jan 2005 16:45:15 -0000	1.15
  @@ -14,7 +14,11 @@
   
   package org.apache.tapestry.services;
   
  +import javax.servlet.http.HttpServletRequest;
  +import javax.servlet.http.HttpServletResponse;
  +
   import org.apache.hivemind.ClassResolver;
  +import org.apache.hivemind.Resource;
   import org.apache.tapestry.engine.IPageSource;
   import org.apache.tapestry.engine.IPropertySource;
   import org.apache.tapestry.engine.IScriptSource;
  @@ -132,12 +136,47 @@
        */
   
       public RequestCycleFactory getRequestCycleFactory();
  +
  +    /**
  +     * Accesses application state objects (Visit and Global from Tapestry 3.0, but now more can be
  +     * created).
  +     */
  +
  +    public ApplicationStateManager getApplicationStateManager();
  +
  +    /**
  +     * Returns the request for the current request.
  +     */
  +
  +    public HttpServletRequest getRequest();
  +
  +    /**
  +     * Returns the response for the current request.
  +     */
  +
  +    public HttpServletResponse getResponse();
  +
  +    /**
  +     * Returns the context path, which identifies the application within the application server.
  +     * Context path should be used as a prefix for any URLs generated. The context path may be the
  +     * empty string, and will not end in a slash (servlet paths should start with a slash).
  +     */
  +
  +    public String getContextPath();
  +
  +    /**
  +     * Returns the application's id; a unique name that is incorporated into various session
  +     * attribute keys and into certain paths when searching for resources. For a servlet-based
  +     * Tapestry application, the id is the name of the servlet.
  +     */
  +
  +    public String getApplicationId();
       
       /**
  -     * Accesses application state objects (Visit and Global from Tapestry 3.0, but now
  -     * more can be created).
  +     * Returns the root context resource, which is the  starting point when looking for
  +     * resources within the application.
        * 
        */
       
  -    public ApplicationStateManager getApplicationStateManager();
  +    public Resource getContextRoot();
   }
  \ No newline at end of file
  
  
  
  1.15      +0 -11     jakarta-tapestry/framework/src/java/org/apache/tapestry/pageload/PageLoader.java
  
  Index: PageLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/pageload/PageLoader.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PageLoader.java	29 Jan 2005 01:03:17 -0000	1.14
  +++ PageLoader.java	29 Jan 2005 16:45:15 -0000	1.15
  @@ -75,10 +75,6 @@
   
       /** @since 3.1 */
   
  -    private ServletContext _context;
  -
  -    /** @since 3.1 */
  -
       private String _defaultPageClassName;
   
       /** @since 3.1 */
  @@ -729,13 +725,6 @@
   
       /** @since 3.1 */
   
  -    public void setContext(ServletContext context)
  -    {
  -        _context = context;
  -    }
  -
  -    /** @since 3.1 */
  -
       public void setDefaultPageClassName(String string)
       {
           _defaultPageClassName = string;
  
  
  
  1.2       +7 -7      jakarta-tapestry/framework/src/test/org/apache/tapestry/record/TestSessionPropertyPersistenceStrategy.java
  
  Index: TestSessionPropertyPersistenceStrategy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/record/TestSessionPropertyPersistenceStrategy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestSessionPropertyPersistenceStrategy.java	8 Jan 2005 19:52:21 -0000	1.1
  +++ TestSessionPropertyPersistenceStrategy.java	29 Jan 2005 16:45:15 -0000	1.2
  @@ -94,7 +94,7 @@
   
           SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
   
  -        s.setApplicationName("myapp");
  +        s.setApplicationId("myapp");
           s.setRequest(request);
   
           s.store("Home", null, "foo", value);
  @@ -113,7 +113,7 @@
   
           SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
   
  -        s.setApplicationName("myapp");
  +        s.setApplicationId("myapp");
           s.setRequest(request);
   
           s.store("Help", null, "bar", null);
  @@ -134,7 +134,7 @@
   
           SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
   
  -        s.setApplicationName("gloop");
  +        s.setApplicationId("gloop");
           s.setRequest(request);
   
           s.store("Nerf", "zip.zap", "spaz", value);
  @@ -165,7 +165,7 @@
   
           SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
           s.setRequest(request);
  -        s.setApplicationName("myapp");
  +        s.setApplicationId("myapp");
   
           Collection actual = s.getStoredChanges("Help", null);
   
  @@ -184,7 +184,7 @@
   
           SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
           s.setRequest(request);
  -        s.setApplicationName("myapp");
  +        s.setApplicationId("myapp");
   
           Collection actual = s.getStoredChanges("Help", null);
   
  @@ -209,7 +209,7 @@
   
           SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
           s.setRequest(request);
  -        s.setApplicationName("myapp");
  +        s.setApplicationId("myapp");
   
           Collection actual = s.getStoredChanges("Help", null);
   
  @@ -261,7 +261,7 @@
   
           SessionPropertyPersistenceStrategy s = new SessionPropertyPersistenceStrategy();
           s.setRequest(request);
  -        s.setApplicationName("myapp");
  +        s.setApplicationId("myapp");
   
           s.discardStoredChanges("Home", null);
   
  
  
  
  1.2       +6 -6      jakarta-tapestry/framework/src/test/org/apache/tapestry/engine/state/TestSessionScopeManager.java
  
  Index: TestSessionScopeManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/engine/state/TestSessionScopeManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestSessionScopeManager.java	28 Jan 2005 21:07:15 -0000	1.1
  +++ TestSessionScopeManager.java	29 Jan 2005 16:45:15 -0000	1.2
  @@ -95,7 +95,7 @@
   
           SessionScopeManager m = new SessionScopeManager();
           m.setRequest(request);
  -        m.setApplicationName("myapp");
  +        m.setApplicationId("myapp");
   
           assertEquals(false, m.exists("fred"));
   
  @@ -111,7 +111,7 @@
   
           SessionScopeManager m = new SessionScopeManager();
           m.setRequest(request);
  -        m.setApplicationName("testapp");
  +        m.setApplicationId("testapp");
   
           assertEquals(true, m.exists("fred"));
   
  @@ -128,7 +128,7 @@
   
           SessionScopeManager m = new SessionScopeManager();
           m.setRequest(request);
  -        m.setApplicationName("testapp");
  +        m.setApplicationId("testapp");
   
           assertSame(stateObject, m.get("fred", null));
   
  @@ -154,7 +154,7 @@
   
           SessionScopeManager m = new SessionScopeManager();
           m.setRequest(request);
  -        m.setApplicationName("myapp");
  +        m.setApplicationId("myapp");
   
           assertSame(stateObject, m.get("fred", factory));
   
  @@ -176,7 +176,7 @@
   
           SessionScopeManager m = new SessionScopeManager();
           m.setRequest(request);
  -        m.setApplicationName("myapp");
  +        m.setApplicationId("myapp");
   
           m.store("fred", stateObject);
   
  @@ -196,7 +196,7 @@
   
           SessionScopeManager m = new SessionScopeManager();
           m.setRequest(request);
  -        m.setApplicationName("myapp");
  +        m.setApplicationId("myapp");
   
           m.store("fred", null);
   
  
  
  

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