Ah, yes that works.  I can now reference my resources too.

Now, sorry to be a pain about this, but I would like to get it hooked up to
something like the FilenameWithVersionResourceCachingStrategy .  I am not
seeing how to do this.   The caching strategies demand something which
implements IStaticCacheableResource, and it doesn’t appear
that resources like this which take PageParameters can implement that
(there is no
unique cache key or resource stream).

Bng



On 12/11/14, 3:14 PM, "Martin Grigorov" <mgrigo...@apache.org> wrote:

>Hi,
>
>If the paths are arbitrary like /img/a/b/c and/img/d/e/f/g/h then just
>mount at "/img". The rest will be available as indexed parameters in
>Attributes#getParameters().
>See PageParameters#getIndexedCount() and #get(int)
>To construct an url you should use #set(int, String)
>
>Martin Grigorov
>Wicket Training and Consulting
>https://twitter.com/mtgrigorov
>
>On Thu, Dec 11, 2014 at 8:42 PM, Boris Goldowsky <bgoldow...@cast.org>
>wrote:
>
>> Thanks for this.  I’m trying replacing the mapper with an extension of
>> AbstractResource and an extension of ResourceReference, as suggested in
>> that post, and then using something like
>>         application.mountResource(“/img/${path}”, new
>> MyResourceReference(…))
>> and it is indeed much easier to set the caching headers flexibly that
>>way.
>>
>> If the directory has subdirectories, though, the mount doesn’t work.
>>Only
>> the first path segment up to the first / is passed to the Resource as
>>the
>> path.  Is there a way to rewrite that mountResource invocation so that
>>the
>> entire path after /img/ is passed through to the resource?  It would be
>> nice if there were a variant of ${} / #{} that was more greedy.
>>
>> I can cheat by using attributes.getRequest().getUrl() in the Resource to
>> find the full path, but that breaks urlFor.
>>
>> Ultimately my goal is to be able to get URLs for these resources that
>>make
>> use of FilenameWithVersionResourceCachingStrategy .  As you may guess,
>>I’m
>> trying various tacks to make the resource caching of my application work
>> better.
>>
>> Boris
>>
>>
>>
>>
>> On 12/9/14, 3:21 PM, "Martin Grigorov" <mgrigo...@apache.org> wrote:
>>
>> >Check http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/
>> >It describes the idea.
>> >
>> >Martin Grigorov
>> >Wicket Training and Consulting
>> >https://twitter.com/mtgrigorov
>> >
>> >On Tue, Dec 9, 2014 at 3:45 AM, Boris Goldowsky <bgoldow...@cast.org>
>> >wrote:
>> >
>> >> The mapper maps a url path to a filesystem directory, so we can
>>mount,
>> >> say, /static/* to a directory of static files anywhere on our server.
>> >>It
>> >> sets cache duration and MIME type properly along the way.
>> >>
>> >> I¹m certainly open to better ways to accomplish this goal!
>> >>
>> >>
>> >> Boris
>> >>
>> >> On 12/8/14, 5:07 PM, "Martin Grigorov" <mgrigo...@apache.org> wrote:
>> >>
>> >> >Hi,
>> >> >
>> >> >What is the reason to go so low level with AbstractMapper and
>> >> >ResourceStreamRequestHandler
>> >> >?
>> >> >You can mount a ResourceReference with
>>WebApplication#mountResource(),
>> >>and
>> >> >this ResRef#getResource() should return IResource/AbstractResource
>> >>where
>> >> >you have much better control on the response headers.
>> >> >
>> >> >
>> >> >Martin Grigorov
>> >> >Wicket Training and Consulting
>> >> >https://twitter.com/mtgrigorov
>> >> >
>> >> >On Mon, Dec 8, 2014 at 11:03 PM, Boris Goldowsky
>><bgoldow...@cast.org>
>> >> >wrote:
>> >> >
>> >> >> I have a request mapper that extends AbstractMapper, and returns a
>> >> >> ResourceStreamRequestHandler from mapRequest().
>> >> >>
>> >> >> The resource is being send with a Cache-Control: private header,
>> >>which
>> >> >>is
>> >> >> unfortunate for caching in this case; we want the resources to be
>> >> >>publicly
>> >> >> cacheable.
>> >> >>
>> >> >> How can I set the cache scope properly in this scenario?   I see
>>that
>> >> >> ResourceResponse has a setCacheScope() method, but my
>>AbstractMapper
>> >> >> doesn¹t seem to get access to this anywhere.
>> >> >>
>> >> >> Thanks for any pointers!
>> >> >>
>> >> >> Bng
>> >> >>
>> >> >>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> >> For additional commands, e-mail: users-h...@wicket.apache.org
>> >>
>> >>
>>
>>

Reply via email to