[ 
https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509503
 ] 

Karl M. Davis commented on WICKET-631:
--------------------------------------

I just wanted to confirm this bug.  I sent out a long email to the listserv a 
minute ago that covers an easy way to hack around it, but I'll repeat the 
relevant portions here for the record:

In my DynamicWebResource class, I added a "cachedParams" ThreadLocal and cache 
the parameter ValueMap during setHeaders(WebResponse) in it, because the 
parameters get wiped out before getResourceState() is called.  Here's the code 
for that in case anyone needs it:

public class SomeResource extends DynamicWebResource
{
        private static ThreadLocal<ValueMap> cachedParams;

        ...

        /**
         * @see 
org.apache.wicket.markup.html.DynamicWebResource#setHeaders(org.apache.wicket.protocol.http.WebResponse)
         */
        @Override
        protected void setHeaders(WebResponse response)
        {
                super.setHeaders(response);
                cachedParams.set(getParameters());
        }

        ...
        
        /**
         * @see 
org.apache.wicket.markup.html.DynamicWebResource#getResourceState()
         */
        @Override
        protected ResourceState getResourceState()
        {
                ValueMap params = cachedParams.get();
                ...
        }
}


> Resource.getParameters() empty when resource is mounted
> -------------------------------------------------------
>
>                 Key: WICKET-631
>                 URL: https://issues.apache.org/jira/browse/WICKET-631
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>         Environment: wicket 1.3.0-incubating-SNAPSHOT running on Glassfish 
> and JDK 1.6.0
>            Reporter: János Cserép
>             Fix For: 1.3.0-beta3
>
>
> After migrating my application from 1.2.6 to 1.3.0-incubating-SNAPSHOT 
> mounted shared resources (rss feeds, uploaded images) stopped working.
> DynamicWebResource.getParameters().getXXX() returns with null if the resource 
> is mounted via Application.mountSharedResource but it works fine when the 
> resource is not mounted.

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

Reply via email to