On Mon, Feb 6, 2012 at 3:08 PM, Martin Grigorov <mgrigo...@apache.org>wrote:
> Hi, > > I'd not invest in AbstractResourceDependentResourceReference. > This has been re-implemented in Wicket 6.0 and this class is no more there. > > For your case I can recommend you to take a look at Wro4j. > With this library you can merge all resources which depend on each > other at build time. For production you can even minimize them. > Hi Martin, Assuming I decide not to use wro4j and I want to stick to using Wickets iRequestMapper, is it possible for me to achieve a mapping for resources that I have in webapp dir such as: com.company.Dashboard -> /dashboard Such that if I have a js file in webapp/js/dashboard.js, I can simply map it to resolve to /dashboard/js/dashboard.js instead of /com.company.Dashboard/dashboard.js? While digging further into Wicket ResourceReference/Resourcestream/IRequestMapper/IRequestHandler architecture, I noticed that ResourceReference is designed such that a scope always returns Java package as part of the url to the resource. Using Resourcereference/IRequestMapper, is it possible for me to achieve the scenario I described above? Thanks > > On Mon, Feb 6, 2012 at 4:51 PM, Bertrand Guay-Paquet > <ber...@step.polymtl.ca> wrote: > > Hi, > > > > Thanks for your reply. I'll try to explain why I require this. > > > > I want to use a ResRef to implement dependent resources based on > > AbstractResourceDependentResourceReference. Essentially, when a resource > > A.js is added to the response, I want B.js to be also automatically > added. > > > > A.js and B.js are both located in the webapp dir instead of being package > > resources. This is why I wanted to make a ResRef point to the webapp dir > > directly. > > > > I don't have much experience with Wicket resources so maybe what I > requested > > originally is the wrong tool for the task. > > > > > > On 04/02/2012 5:07 AM, Martin Grigorov wrote: > >> > >> Hi, > >> > >> I didn't understand why you want to use ResRef but if this is your > >> requirement then the easiest will be to create your own IRequestMapper > >> that handles only your own IRequestHandler that works with your ResRef > >> impl. > >> IRequestMapper#mapHandler(IRequestHandler) is the one responsible to > >> create Url when RequestCycle#urlFor() is used. > >> Also take a look at > >> org.apache.wicket.util.string.UrlUtils#rewriteToContextRelative() > >> > >> On Fri, Feb 3, 2012 at 5:40 PM, Bertrand Guay-Paquet > >> <ber...@step.polymtl.ca> wrote: > >>> > >>> Hi, > >>> > >>> I have the following code in my base page: > >>> > >>> public void renderHead(IHeaderResponse response) { > >>> // scripts/jquery-1.7.1.min.js is in webapp dir > >>> response.renderJavaScriptReference("scripts/jquery-1.7.1.min.js"); > >>> } > >>> > >>> How can I transform this direct URL to a ResourceReference? > >>> > >>> PackageResourceReference is not a good fit because I don't want to > store > >>> the > >>> .js in a Java package since it is used by non-wicket pages. > >>> > >>> With ContextRelativeResource, Wicket reads the actual resource and > sends > >>> the > >>> result instead of simply pointing to a URL. > >>> > >>> AbstractResource with its newResourceResponse() abstract method > requires > >>> to > >>> return the actual ResourceResponse which won't allow for a simple URL. > >>> > >>> So from what I gather, I would have to fallback to implementing an > >>> IResource's respond(Attributes attributes) method. I looked at the > >>> implementation in AbstractResource but I'm confused about what to do > with > >>> headers since I only want a URL. > >>> > >>> So, does this functionality already exist? If not, do you have a few > >>> pointers to steer me in the right direction? > >>> > >>> Thanks, > >>> Bertrand > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > >>> For additional commands, e-mail: users-h...@wicket.apache.org > >>> > >> > >> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > -- > Martin Grigorov > jWeekend > Training, Consulting, Development > http://jWeekend.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Odeyemi 'Kayode O. http://www.sinati.com. t: @charyorde