You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Christian Haselbach (JIRA)" <de...@tapestry.apache.org> on 2007/05/15 11:41:16 UTC

[jira] Created: (TAPESTRY-1462) LinkFactoryImpl caches context path and servlet path

LinkFactoryImpl caches context path and servlet path
----------------------------------------------------

                 Key: TAPESTRY-1462
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1462
             Project: Tapestry
          Issue Type: Bug
    Affects Versions: 4.1, 4.0
            Reporter: Christian Haselbach
            Priority: Minor


The class org.apache.tapestry.services.impl.LinkFactoryImpl caches the context path and the servlet path, two values that can differ for every request.
The class has the web request injected and should use the values from there.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (TAPESTRY-1462) LinkFactoryImpl caches context path and servlet path

Posted by "Christian Haselbach (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-1462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12495927 ] 

Christian Haselbach commented on TAPESTRY-1462:
-----------------------------------------------

Workaround if you need to construct the link according to the correct context path of the request (and not the very first request that ever happened since the start of the application):
Create a new class which is a copy of LinkFactoryImpl and replace the method constructLink():
---
    public ILink constructLink(IEngineService service, boolean post, Map parameters,
            boolean stateful)
    {
        finalizeParameters(service, parameters);

        IEngine engine = _requestCycle.getEngine();

        ServiceEncoding serviceEncoding = createServiceEncoding(parameters);

        // Give persistent property strategies a chance to store extra data
        // into the link.

        if (stateful)
            _persistenceStrategySource.addParametersForPersistentProperties(serviceEncoding, post);

        String contextPath = _request.getContextPath();
        String fullServletPath = contextPath + serviceEncoding.getServletPath();

        return new EngineServiceLink(_requestCycle, fullServletPath, engine.getOutputEncoding(),
                _codec, _request, parameters, stateful);
    }
---
Furthermore, remove the method finalizeParameters(), because it uses a class that is not public (ImplMessages).

Then register it in your hivemodule.xml:
  <implementation service-id="tapestry.url.LinkFactory">
  <invoke-factory service-id="hivemind.BuilderFactory" model="singleton" >
    <construct class="your.path.AlternativeLinkFactoryImpl" >
      <set-object property="dataSqueezer" value="infrastructure:dataSqueezer" /> 
      <set-configuration property="contributions" configuration-id="tapestry.url.ServiceEncoders" /> 
      <set-object property="servletPath" value="app-property:org.apache.tapestry.servlet-path" /> 
      <set-object property="contextPath" value="infrastructure:contextPath" /> 
      <set-object property="request" value="infrastructure:request" /> 
      <set-object property="requestCycle" value="infrastructure:requestCycle" /> 
      <set-service property="persistenceStrategySource" service-id="tapestry.persist.PropertyPersistenceStrategySource" />
    </construct>
  </invoke-factory>
  </implementation>


> LinkFactoryImpl caches context path and servlet path
> ----------------------------------------------------
>
>                 Key: TAPESTRY-1462
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1462
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 4.0, 4.1
>            Reporter: Christian Haselbach
>            Priority: Minor
>
> The class org.apache.tapestry.services.impl.LinkFactoryImpl caches the context path and the servlet path, two values that can differ for every request.
> The class has the web request injected and should use the values from there.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (TAPESTRY-1462) LinkFactoryImpl caches context path and servlet path

Posted by "Jesse Kuhnert (JIRA)" <de...@tapestry.apache.org>.
     [ https://issues.apache.org/jira/browse/TAPESTRY-1462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesse Kuhnert resolved TAPESTRY-1462.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.1.2
         Assignee: Jesse Kuhnert

Context path is request each time - though servlet path is still cached as that value isn't as straightforward.

> LinkFactoryImpl caches context path and servlet path
> ----------------------------------------------------
>
>                 Key: TAPESTRY-1462
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1462
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 4.0, 4.1
>            Reporter: Christian Haselbach
>         Assigned To: Jesse Kuhnert
>            Priority: Minor
>             Fix For: 4.1.2
>
>
> The class org.apache.tapestry.services.impl.LinkFactoryImpl caches the context path and the servlet path, two values that can differ for every request.
> The class has the web request injected and should use the values from there.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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