Hi edvin, pictures are not my only goal, I would like to serve compressed js and css also, and to take advantage of wicket resource caching (http header generation). Anyway, I wrote a simple requesttargeturlcodingstrategy that fulfills my needs. If anyone is interested, here it is:
public class SharedResourcesRequestTargetUrlCodingStrategy extends AbstractRequestTargetUrlCodingStrategy { private String keyPrefix; public SharedResourcesRequestTargetUrlCodingStrategy(String mountPath, Class<?> scope) { this(mountPath, scope, mountPath.substring(1)); } public SharedResourcesRequestTargetUrlCodingStrategy(String mountPath, Class<?> scope, String namePrefix) { super(mountPath); this.keyPrefix = scope.getCanonicalName() + "/" + namePrefix; } public IRequestTarget decode(RequestParameters requestParameters) { String name = requestParameters.getPath ().substring(getMountPath().length()); requestParameters.setResourceKey(keyPrefix + name); return new SharedResourceRequestTarget(requestParameters); } public CharSequence encode(IRequestTarget requestTarget) { String key = ((ISharedResourceRequestTarget)requestTarget).getResourceKey(); return getMountPath() + key.substring(keyPrefix.length()); } public boolean matches(IRequestTarget requestTarget) { if (!(requestTarget instanceof ISharedResourceRequestTarget)) return false; String key = ((ISharedResourceRequestTarget)requestTarget).getResourceKey(); return key.startsWith(keyPrefix); } } Thank you Regards -Carlos On Feb 1, 2008 6:31 PM, Edvin Syse <[EMAIL PROTECTED]> wrote: > > Then there is the mountSharedResource method, but it works on resource > > by resource basis. Instead, I need to alias the path for a big number > > of resources (for example, static images for my application). > > Ideally, I would like my images, following the previous example, to > > be requested as: > > <wicket:link><img src="img/some_image.gif"/></wicket:link> > > If your goal is just to supply static pictures and don't have > programmatically control over them, why don't you just create an img-folder > in > your webroot? Then pictures will be served by your container instead of > Wicket :) > > -- Edvin > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >