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

Martin Grigorov commented on WICKET-5909:
-----------------------------------------

I'm suggesting a different solution in branch 'WICKET-5909'.
Now #getResourceStream() will use the current session locale/style if there is 
no explicitly specified ones in PackageResource's constructor.
IMO this should be the default behavior and there shouldn't be a need to have 
#getCacheableResourseStream() that always uses the session's locale/style.

The test case is a bit broken - there is no bound session. A temporary Session 
is created for the request serving the page, but the request for the 
PackageResource doesn't create any session, even temporary, and thus the style 
is null.

While writing the explanation I realized that #getCacheableResourceStream() 
does exactly what I believe should be the expected behavior. I just pushed a 
new commit that delegates #getResoureStream() to #getCacheableResourceStream(). 
All tests pass!

I've modified few tests because WicketTester simulates an USA user 
(Accept-Language: en-us) and thus the test loads package1_en.txt version now. 

> Session style is not taken into account when loading mounted resources.
> -----------------------------------------------------------------------
>
>                 Key: WICKET-5909
>                 URL: https://issues.apache.org/jira/browse/WICKET-5909
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.0.0-M5, 6.19.0
>            Reporter: Sergiy Barlabanov
>         Attachments: style-bug.zip, wicket.patch
>
>
> Session#getStyle is not considered when a mounted package resource is loaded. 
> Wicket loads the default one.
> If the resource is not mounted, everything works fine and Wicket delivers the 
> correct resource file.
> Quickstart is attached. There are two CSS files: styled.css and 
> styled_orange.css. The corresponding package resource is mounted. The session 
> style is set to orange in WicketApplication#newSession. Expected behavior is 
> that styled_orange.css is delivered to a browser. Instead styled.css is 
> delivered.
> There is a workaround: see WorkaroundResourceStreamLocator.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to