I wouldn't recommend creating a wicket tag for this. That is exactly what
wicket doesn't encourage to do. An alternative could be a simple servlet
which forwards to wanted resource based on theme parameter...

Alex 


AppleGrew wrote:
> 
> Hi alex
> Thanks for the respose.
> I have thought of a scheme. I have clubed the css into groups with
> names as - themeName-all.css, eg. Classic-all.css, jazzy-all.css, etc.
> I will make sure wicket put correct css name in htmls.
> Can anyone point me as how to extend wiket:link tag or creat my own tag.
> 
> On 4/8/10, Alex Objelean <[email protected]> wrote:
>>
>> Wro is responsible for resource cashing. That means that all requests for
>> merged resource will be served with the same response. If you need
>> something
>> dynamic, like theming .. you should serve those outside of wro request.
>> You
>> can split your resources in two:
>> 1) Static unchanged resources (to be served by wro filter)
>> 2) Dynamic, theme dependent resources - served by stream locator
>>
>> Hope this helps!
>> Alex
>>
>>
>> AppleGrew wrote:
>>>
>>> Hi Alex n All,
>>>
>>> I managed to get this working. It was failing because of missing Apache
>>> Commons IO. Now I am stuck at another place. JS are fine, but the CSS
>>> files
>>> are chosen as per user's theme. When I was serving the CSS files via my
>>> stream locator, it picked up the correct file based on the theme name.
>>> Now
>>> since the WRO filter is before Wicket filter there seems to be no way to
>>> send this information to it.
>>>
>>> Note to achieve themability in my app, I have put the files in WEB-INF.
>>> Htmls, CSS and images are segregated into folders with theme's name. My
>>> stream locator fetches the correct Html and CSS based on theme name.
>>>
>>> Any suggestions how can I achieve this using WRO or can I integrate
>>> WRO-like
>>> minification of JS and CSS right into Wicket?
>>>
>>> Regards,
>>> Apple Grew
>>> my blog @ http://blog.applegrew.com/
>>>
>>>
>>> On Wed, Apr 7, 2010 at 10:21 PM, Alex Objelean
>>> <[email protected]>wrote:
>>>
>>>>
>>>> Actually you don't have to access the resources. The wro filter  just
>>>> handles
>>>> the request for static resources, there no wicket specific integration.
>>>> All
>>>> you have to do, is to define the location of your resources in wro.xml
>>>> (group descriptor). The location of resources can be virtually
>>>> anything:
>>>> external url, relative to servlet context, classpath or file resources
>>>> (http://code.google.com/p/wro4j/wiki/ResourceTypes).
>>>>
>>>> I pretty sure there is no way to 'ask' wicket to gzip and minimize
>>>> external
>>>> resources, because wicket doesn't control them.
>>>>
>>>> Alex
>>>>
>>>>
>>>> AppleGrew wrote:
>>>> >
>>>> > Checked it out. This is good, but I am not sure how to integrate this
>>>> with
>>>> > Wicket. Currently it seems that WRO's url is being override by
>>>> > WicketFilter,
>>>> > so I am not being able to access WRO resources.
>>>> >
>>>> > BTW going back to original problem. I tired to debug the Wicket code
>>>> and
>>>> > it
>>>> > seems for shared resources the SharedResourceRequestTraget simply
>>>> invokes
>>>> > PackageResource, while for non globally shared resources
>>>> > JavascriptPackageResource is invoked. JavascriptPackageResource 
>>>> seems
>>>> to
>>>> > be
>>>> > responsible for gzipping and minizing JS code. Not sure how do I
>>>> 'ask'
>>>> > Wicket to do the same for globally resources.
>>>> >
>>>> > Regards,
>>>> > Apple Grew
>>>> > my blog @ http://blog.applegrew.com/
>>>> >
>>>> >
>>>> > On Wed, Apr 7, 2010 at 8:20 PM, Alex Objelean
>>>> > <[email protected]>wrote:
>>>> >
>>>> >>
>>>> >> You could take a look at wro4j: http://code.google.com/p/wro4j/ . It
>>>> >> helps
>>>> >> you keep you javascripts (and css) organized in a single location,
>>>> merge
>>>> >> and
>>>> >> minimize them. It is also very easy configurable
>>>> >> (http://code.google.com/p/wro4j/wiki/GettingStarted) and extensible
>>>> >> (allow
>>>> >> provide your own implementation of js or css minification
>>>> algorithm).
>>>> >> Also
>>>> >> it provides a maven plugin (
>>>> >> http://code.google.com/p/wro4j/wiki/MavenPlugin)
>>>> >> for build time merging and minification. You can see a complete list
>>>> of
>>>> >> features here: http://code.google.com/p/wro4j/wiki/Features
>>>> >>
>>>> >> Alex
>>>> >>
>>>> >>
>>>> >> AppleGrew wrote:
>>>> >> >
>>>> >> > Hi All,
>>>> >> >
>>>> >> > I have put all my JS files in WEB-INF. To let Wicket find them I
>>>> have
>>>> >> > created my own ResourceStreamLocator. The locator on getting class
>>>> >> scope
>>>> >> > as
>>>> >> > Application simply locates the JS files from 'WEB-INF/js'. The
>>>> problem
>>>> >> is
>>>> >> > how do I enable Wicket's built-in Javascript compression?
>>>> >> >
>>>> >> > I tried the following code with a form:-
>>>> >> >
>>>> >>
>>>> add(JavascriptPackageResource.getHeaderContribution(ApplicationCore.class,
>>>> >> > "js/form.js"));
>>>> >> >
>>>> >> > I can still see the white spaces in the JS code when I try to
>>>> access
>>>> >> them
>>>> >> > from my browser. Pls guide.
>>>> >> >
>>>> >> > Regards,
>>>> >> > Apple Grew
>>>> >> > my blog @ http://blog.applegrew.com/
>>>> >> >
>>>> >> >
>>>> >>
>>>> >> --
>>>> >> View this message in context:
>>>> >>
>>>> http://old.nabble.com/Javascript-Compression-not-working.-tp28164115p28166133.html
>>>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>> >>
>>>> >>
>>>> >>
>>>> ---------------------------------------------------------------------
>>>> >> To unsubscribe, e-mail: [email protected]
>>>> >> For additional commands, e-mail: [email protected]
>>>> >>
>>>> >>
>>>> >
>>>> >
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/Javascript-Compression-not-working.-tp28164115p28167755.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Javascript-Compression-not-working.-tp28164115p28174756.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
> 
> -- 
> Sent from my mobile device
> 
> Regards,
> Apple Grew
> my blog @ http://blog.applegrew.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Javascript-Compression-not-working.-tp28164115p28181899.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to