wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: ResourceReference for resource in webapp dir
Date Mon, 06 Feb 2012 15:08:25 GMT
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.

On Mon, Feb 6, 2012 at 4:51 PM, Bertrand Guay-Paquet
<bernie@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
>> <bernie@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-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message