Hi all,
I'm working on Jawr, a java library, which handle the bundling and
compressing process for web resources. ( https://jawr.dev.java.net/ )
I would like to know the best way to integrate Jawr in Wicket.
In fact, Jawr generates a custom URL for a specific resource bundle.
For example, if you have a reference in your page like:
<script type="text/javascript" src="/js/bundle/msg.js" ></script>
This will generates in production mode something like :
<script type="text/javascript"
src="/mywebapp/gzip_324521/js/myBundle.js" ></script>
and in debug mode :
<script type="text/javascript" src="/mywebapp/js/myScript1.js" />
<script type="text/javascript" src="/mywebapp/js/myScript2.js" />
<script type="text/javascript" src="/mywebapp/js/myScript3.js" />
The first way of doing it was to create a dedicated component, which
was provided by one of our contributor.
So in the wicket page, we had something like:
<script wicket:id="bundle1" type="text/javascript"
src="/js/myBundle.js" ></script>
And in our page, we have :
...
add(new JawrJavascriptReference("bundle1"));
This works fine, but I would like to know if there is not an easier
way to put it in place.
I'm probably biased as I'm much more used to request based frameworks,
but I would like to reference my bundle in my html page like :
<wicket:jawr>
<script type="text/javascript" src="/js/myBundle1.js" ></script>
<script type="text/javascript" src="/js/myBundle2.js" ></script>
</wicket:jawr>
and for image references :
<wicket:jawr>
<img src="/img/appIcons/application.png"/>
</wicket:jawr>
To achieve this, I thought to implement a new IComponentResolver, but
it seems to be not advised to do so as it's a core functionality of
wicket...
Another way to do it for Javascript and CSS resources would be to
create an IHeaderContributor, which I find cleaner than a
webMarkupContainer (no reference need to be define in the HTML page)
but I need to have access to the request, and I didn't find a way to
retrieve it.
So I would like to know, what is the best way to implement it.
Any thoughts or advises?
Thanks in advance.
Cheers,
Ibrahim Chaehoi
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]