you can also implement your own DynamicImageResource, and add it to shared
resources
webapp.getsharedresources().add("images", new MyDynamicImageResource());
urls for shared resources are stable, and you can also mount them.
-igor
On 5/7/07, Jeremy Thomerson <[EMAIL PROTECTED]> wrote:
I've done a lot of custom URL encoding / decoding to keep very clean,
search-engine friendly URLs in our application. The place I would start
would be to mount a custom IRequestTargetUrlCodingStrategy in your WebApp
class.
Here's some code that might help as a starting point:
private final Pattern mRequestPattern = Pattern.compile(getMountPath()
+ "/([0-9]*)/.*");
public boolean matches(RequestParameters rp) {
return mRequestPattern.matcher(rp.getPath()).matches();
}
public IRequestTarget decode(RequestParameters rp) {
Matcher matcher = mRequestPattern.matcher(rp.getPath());
matcher.find();
String strID = matcher.group(1);
int id = -1;
try {
id = Integer.parseInt(strID);
} catch (NumberFormatException nfe) {
throw new IllegalArgumentException(strID + " is not a
valid ID");
}
IFooService svc = getBean(IFooService.class);
return new PageRequestTarget(new FooPage( svc.findByID(id)));
}
Jeremy Thomerson
On 5/7/07, Rüdiger Schulz <[EMAIL PROTECTED] > wrote:
>
> Hello everybody,
>
> in my application, I'm currently serving images with a special
> servlet. It accepts request paths like /app/images/42.gif. The images
> themself are stored in a database. I like this approach, because the
> image URLs are static, and by that they can be cached by proxies and
> stored as bookmarks in browsers.
>
> I integrate this servlet with a custom WebComponent in my Wicket
> pages, where I compile the correct path.
>
> This all works very well, but now I'd like to convert this servlet
> into a Wicket component. It needs the same behavior (static urls), but
> I'd like to restrict access according to data in the current Wicket
> session.
>
> I think I know how to do this with a DynamicWebResource and all, but I
> have no idea how to do the URL binding. I don't know where to start at
> all. For pages there is the IndexedParamUrlCodingStrategy, but that
> won't do for images I guess...
>
> So, any help would be very welcome. Oh, and I'm still using Wicket
> 1.2.6; an update to 1.3 is planned, but cannot be done right now. If a
> solution would be much more easier in 1.3 than in 1.2, however, we
> might do it earlier or at least wait with the conversion of the
> Servlet until then.
>
>
> --
> greetings from Berlin,
>
> Rüdiger Schulz
>
> www.2rue.de
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user