You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "János Cserép (JIRA)" <ji...@apache.org> on 2007/06/09 19:00:25 UTC

[jira] Created: (WICKET-631) Resource.getParameters() empty when resource is mounted

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


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.


[jira] Commented: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "János Cserép (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508188 ] 

János Cserép commented on WICKET-631:
-------------------------------------

I think I've found the line that causes this problem. In Resource.java:

finally
		{
			// Really really really make sure parameters are cleared
			parameters.set(null);
		}

is called in onResourceRequested(). This is called in the PROCESS_EVENTS step.

So in the RESPOND step my application doesn't see the parameters anymore.

If the page is not mounted then Resource.getParameters() can still access the parameters through RequestCycle.get().getRequest().getParameters(), but when the resource is mounted, this fails.

Can someone check out why you really really really have to make sure that the parameters are cleared in the PROCESS_EVENTS step?

Thanks,

janos

> 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.


[jira] Commented: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509559 ] 

Johan Compagner commented on WICKET-631:
----------------------------------------

what do you exactly do in the response phase that you also need there the params?

> 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.


[jira] Commented: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "János Cserép (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509560 ] 

János Cserép commented on WICKET-631:
-------------------------------------

getResourceState is called only in the response phase. That's where I would like to access parameters and set up a ResourceState object:

 protected DynamicWebResource.ResourceState getResourceState() {
        final Long id;
        try {
            id = getParameters().getLong("id");
        } catch (StringValueConversionException ex) {
            return null;
        }
        final int variant = getParameters().getInt("variant", 0);
        
        return new DynamicWebResource.ResourceState() {
         ...
        }
}

In 1.2.6 this works, in 1.3.0 it doesn't. 

> 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.


[jira] Commented: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503197 ] 

Eelco Hillenius commented on WICKET-631:
----------------------------------------

Could you help us create a unit test for this (so it should currently fail)? That'll make it easier for us to fix, and when we have that unit test, we can be sure it stays fixed.

> 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
>
> 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.


[jira] Updated: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alastair Maw updated WICKET-631:
--------------------------------

    Fix Version/s: 1.3.0-beta3

> 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.


[jira] Issue Comment Edited: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "János Cserép (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508188 ] 

János Cserép edited comment on WICKET-631 at 6/26/07 7:57 AM:
--------------------------------------------------------------

I think I've found the line that causes this problem. In Resource.java:

finally
		{
			// Really really really make sure parameters are cleared
			parameters.set(null);
		}

is called in the end of onResourceRequested(). This method gets called in the PROCESS_EVENTS step.

The code before this is:

cycle.setRequestTarget(new ResourceStreamRequestTarget(resourceStream));

Which sets a new RequestTarget but doesn't yet call my custom DynamicWebResource's getResourceState method (where I'm calling getParameters())

When the lifecycle of the request continues we enter into the RESPOND step which eventually calls my subclassed DynamicWebResource and it's getResourceStream method. At this time the Resource's threadlocal for parameters is already null.

If the page is not mounted then Resource.getParameters() can still access the parameters through RequestCycle.get().getRequest().getParameters(), but when the resource is mounted, this fails.

Can someone check out why you really really really have to make sure that the parameters are cleared in the PROCESS_EVENTS step? I guess you didn't want to have objects lying around in the ThreadLocal, but that should really be moved after the resource finished assembling the response to the request.

Is calling Resource.getParameters() illegal from the getResourceState method of DynamicWebResource? 

The hack in Resource.getParameters which falls back to the RequestCycle is also quite ugly and I think should be reconsidered (I haven't found the code snippet which clears that when the request is finished)

Thanks,

janos


 was:
I think I've found the line that causes this problem. In Resource.java:

finally
		{
			// Really really really make sure parameters are cleared
			parameters.set(null);
		}

is called in the end of onResourceRequested(). This is called in the PROCESS_EVENTS step.

The code before this is:

cycle.setRequestTarget(new ResourceStreamRequestTarget(resourceStream));

Which sets a new RequestTarget but doesn't yet call my custom DynamicWebResource's getResourceState method (where I'm calling getParameters())

When the lifecycle of the request continues we enter into the RESPOND step which eventually calls my subclassed DynamicWebResource and it's getResourceStream method. At this time the Resource's threadlocal for parameters is already null.

If the page is not mounted then Resource.getParameters() can still access the parameters through RequestCycle.get().getRequest().getParameters(), but when the resource is mounted, this fails.

Can someone check out why you really really really have to make sure that the parameters are cleared in the PROCESS_EVENTS step? I guess you didn't want to have objects lying around in the ThreadLocal, but that should really be moved after the resource finished assembling the response to the request.

Is calling Resource.getParameters() illegal from the getResourceState method of DynamicWebResource? 

The hack in Resource.getParameters which falls back to the RequestCycle is also quite ugly and I think should be reconsidered (I haven't found the code snippet which clears that when the request is finished)

Thanks,

janos

> 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.


[jira] Commented: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503198 ] 

Eelco Hillenius commented on WICKET-631:
----------------------------------------

Just look at the test cases in Wicket for an idea how to do this, and you could attach the Java source to this issue. Would be a great help!

> 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
>
> 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.


[jira] Issue Comment Edited: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "János Cserép (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508188 ] 

János Cserép edited comment on WICKET-631 at 6/26/07 7:35 AM:
--------------------------------------------------------------

I think I've found the line that causes this problem. In Resource.java:

finally
		{
			// Really really really make sure parameters are cleared
			parameters.set(null);
		}

is called in onResourceRequested(). This is called in the PROCESS_EVENTS step.

So in the RESPOND step my application doesn't see the parameters anymore.

If the page is not mounted then Resource.getParameters() can still access the parameters through RequestCycle.get().getRequest().getParameters(), but when the resource is mounted, this fails.

Can someone check out why you really really really have to make sure that the parameters are cleared in the PROCESS_EVENTS step? I guess you didn't want to have objects lying around in the ThreadLocal, but that should really be moved after the resource finished assembling the response to the request.

Thanks,

janos


 was:
I think I've found the line that causes this problem. In Resource.java:

finally
		{
			// Really really really make sure parameters are cleared
			parameters.set(null);
		}

is called in onResourceRequested(). This is called in the PROCESS_EVENTS step.

So in the RESPOND step my application doesn't see the parameters anymore.

If the page is not mounted then Resource.getParameters() can still access the parameters through RequestCycle.get().getRequest().getParameters(), but when the resource is mounted, this fails.

Can someone check out why you really really really have to make sure that the parameters are cleared in the PROCESS_EVENTS step?

Thanks,

janos

> 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.


[jira] Issue Comment Edited: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "János Cserép (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508188 ] 

János Cserép edited comment on WICKET-631 at 6/26/07 7:51 AM:
--------------------------------------------------------------

I think I've found the line that causes this problem. In Resource.java:

finally
		{
			// Really really really make sure parameters are cleared
			parameters.set(null);
		}

is called in the end of onResourceRequested(). This is called in the PROCESS_EVENTS step.

The code before this is:

cycle.setRequestTarget(new ResourceStreamRequestTarget(resourceStream));

Which sets a new RequestTarget but doesn't yet call my custom DynamicWebResource's getResourceState method (where I'm calling getParameters())

When the lifecycle of the request continues we enter into the RESPOND step which eventually calls my subclassed DynamicWebResource and it's getResourceStream method. At this time the Resource's threadlocal for parameters is already null.

If the page is not mounted then Resource.getParameters() can still access the parameters through RequestCycle.get().getRequest().getParameters(), but when the resource is mounted, this fails.

Can someone check out why you really really really have to make sure that the parameters are cleared in the PROCESS_EVENTS step? I guess you didn't want to have objects lying around in the ThreadLocal, but that should really be moved after the resource finished assembling the response to the request.

Is calling Resource.getParameters() illegal from the getResourceState method of DynamicWebResource? 

The hack in Resource.getParameters which falls back to the RequestCycle is also quite ugly and I think should be reconsidered (I haven't found the code snippet which clears that when the request is finished)

Thanks,

janos


 was:
I think I've found the line that causes this problem. In Resource.java:

finally
		{
			// Really really really make sure parameters are cleared
			parameters.set(null);
		}

is called in onResourceRequested(). This is called in the PROCESS_EVENTS step.

So in the RESPOND step my application doesn't see the parameters anymore.

If the page is not mounted then Resource.getParameters() can still access the parameters through RequestCycle.get().getRequest().getParameters(), but when the resource is mounted, this fails.

Can someone check out why you really really really have to make sure that the parameters are cleared in the PROCESS_EVENTS step? I guess you didn't want to have objects lying around in the ThreadLocal, but that should really be moved after the resource finished assembling the response to the request.

Thanks,

janos

> 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.


[jira] Commented: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "János Cserép (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508205 ] 

János Cserép commented on WICKET-631:
-------------------------------------

checked: if I delete the finally block from Resource.onResourceRequested then getParameters() works when called from getResourceState()

I think Resource should have another method that could be called from ResourceStreamRequestTarget's detach or respond method which would clear the parameter threadlocal after the resource handled the request...





> 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.


[jira] Commented: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503199 ] 

Eelco Hillenius commented on WICKET-631:
----------------------------------------

Alternatively, and easier method might be to add an example to Wicket examples that displays your use case and (optionally) write a unit test using jwebunit like you can find in the wicket-examples project. That'll give people another example of what they can do with Wicket, and it's also a bit more a blackbox test (as you're doing actual requests rather than mock requests) compared to the unit tests like they can be found in core.

> 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
>
> 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.


[jira] Commented: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "János Cserép (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503187 ] 

János Cserép commented on WICKET-631:
-------------------------------------

Resource.getParameters() just calls:

RequestCycle.get().getRequest().getParameterMap()

I see the hack for WICKET-400 in BookmarkablePageRequestTarget.java that puts in the parameters into the map when the request target is a bookmarkable page. 

Anybody feels like helping me out with this? I cannot go live with new features until this is resolved (my rss feeds won't work without a fix)

Thanks:)

> 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
>
> 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.


[jira] Commented: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "János Cserép (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509688 ] 

János Cserép commented on WICKET-631:
-------------------------------------

Karl,

Thanks for the workaround, I haven't used setHeaders before and would have never noticed that the parameters threadlocal is not null at the time it is called. I'm using the workaround with www.szeretgom.hu right now with 1.3.0-beta2 :)

> 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.


[jira] Commented: (WICKET-631) Resource.getParameters() empty when resource is mounted

Posted by "Karl M. Davis (JIRA)" <ji...@apache.org>.
    [ 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.