extend PackageResourceReference and override its #getName() to read
the name from the request path/parameters
mountResource("/global", new MyPRR())On Thu, Sep 6, 2012 at 7:57 PM, Alec Swan <[email protected]> wrote: > In 1.4 I had the following classes in com.myco.app.res package: > > GlobalJavascriptResourceReference extends JavaScriptResourceReference > GlobalCompressedResourceReference extends PackageResourceReference > GlobalResourceScope > > And Application had the following code: > getSharedResources().putClassAlias(GlobalResourceScope.class, "global") > > The caller would add resources as follows: > new GlobalJavascriptResourceReference(GlobalResourceScope.class, > "js/common.js"); > new GlobalCompressedResourceReference(GlobalResourceScope.class, > "css/styles.css"); > > How should I port this to 1.5 so that I can still access > http://../global/js/common.js and http://../global/js/styles.css? > > Thanks, > > Alec > > On Tue, Sep 4, 2012 at 5:10 PM, Martin Grigorov <[email protected]> wrote: >> On Tue, Sep 4, 2012 at 11:17 PM, Alec Swan <[email protected]> wrote: >>> Well, mountPackage did not work for me either. >>> >>> Basically, what I want to do is access ALL resources in >>> com.myco.app.res package with "global" URL prefix. For example, access >>> a JavaScript file as global/events.js instead of >>> ../wicket/resource/com.myco.app.res.GlobalResourceScope/events.js URL. >>> In 1.4 it was simple with >>> putClassAlias(com.myco.app.res.GlobalResourceScope, "global"). >>> >>> How can I do this with 1.5? >> >> Why #mountResource() didn't work for you ? >> >>> >>> Thanks, >>> >>> Alec >>> >>> On Tue, Sep 4, 2012 at 10:59 AM, Alec Swan <[email protected]> wrote: >>>> Tom, >>>> >>>> I have com.myco.app.res.GlobalResourceScope.class and events.js in the >>>> same package. So, putClassAlias(GlobalResourceScope.class, "global") >>>> in 1.4 would allow me to access http://../app/global/events.js in the >>>> browser. >>>> >>>> It seems like in 1.5 this is similar to mountPackage(String, Class<? >>>> extends Page>) which means I have to change GlobalResourceScope class >>>> to extend Page, right? Why does it need to be a Page? >>>> >>>> Thanks, >>>> >>>> Alec >>>> >>>> On Tue, Sep 4, 2012 at 9:42 AM, Thomas Götz <[email protected]> wrote: >>>>> I didn't get your usecase exactly yet, but maybe this will help you: >>>>> http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ >>>>> >>>>> Cheers, >>>>> -Tom >>>>> >>>>> >>>>> On 04.09.2012, at 17:33, Alec Swan <[email protected]> wrote: >>>>> >>>>>> I saw the link explaining how to migrate >>>>>> "SharedResources#putClassAlias(GlobalResourceScope.class, "global")" >>>>>> before but was found it confusing because "global" and "images" >>>>>> aliases 1.4 version were replaced with "imgres" in 1.5 example. >>>>>> >>>>>> All I need to do is use "global" in place of GlobalResourceScope.class >>>>>> in the URLs. How do I do this in 1.5? >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [email protected] >>>>> For additional commands, e-mail: [email protected] >>>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >> >> >> >> -- >> Martin Grigorov >> jWeekend >> Training, Consulting, Development >> http://jWeekend.com >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
