Ah, good advice. I actually need the Session in the Resource, as some
images have restrictions on who is allowed to see them.

So, instead of stripping the jsessionid, I will create my links for
the src attribute in a way that it they will look like this:
/images/thumbnail/20.png;jsessionid=1ar97uck8ovr5

I also tried to follow the internal flow on how
getRequestParameters().getPath() is resolved, and I see that
Strings.sripJsessionid() is called, and this omits everything
beginning with the jsessionid and ending with a
question-marked-separated querystring. In my case, the "query" was
appended with a slash...

2007/5/26, Johan Compagner <[EMAIL PROTECTED]>:
> what you could do is just stripoff (regexp replace) the jsession id of the
> url
> you can only do this is you don't acess the session in your resource and i
> guess you don't
> do that because you only need the url to stream the resource right?
>
> johan
>
>
> On 5/25/07, Rüdiger Schulz <[EMAIL PROTECTED]> wrote:
> >
> > Hello all,
> >
> > I have (or had) a problem with mounted Resources and an iserted
> > jsessionid. My goal is, as discussed here before:
> >
> http://www.nabble.com/Bookmarkable-images-tf3706668.html#a10383150
> , to
> > have dynamic image URLs with just slashes and no
> > question-mark-separated querystring, like this:
> >
> > /images/thumbnail/20.png
> >
> > What I did was in short this:
> >
> > Subclassed WebResource like this:
> >
> > public IResourceStream getResourceStream() {
> >         String path =
> RequestCycle.get().getRequest().getRequestParameters().getPath();
> >         // ... parse path, return ResourceStream
> >         // path should be "images/thumbnail/20.png"
> > }
> >
> > In my Application.init():
> >
> > getSharedResources().add("imageDataResource", new
> ImageDataResource());
> > mountSharedResource(ImageDataResource.MOUNT_PATH, new
> >
> ResourceReference("imageDataResource").getSharedResourceKey());
> >
> > Then a custom WebComponent, where I have an AttributeModifier for the
> > src attribute, where I compile the src like this:
> >
> > ResourceReference resRef = new
> ResourceReference("imageDataResource");
> > String src = urlFor(resRef);
> > src += "thumbnail/20.png";  // this is dynamic in the application
> >
> > This all works almost perfect.
> >
> > It stops working when someone has disabled cookies, and jsessionid is
> > added to all URLs. Then they look a little strange like this:
> >
> > /images;jsessionid=1ar97uck8ovr5/thumbnail/20.png
> >
> > because urlFor(resRef) returns
> >
> > /images;jsessionid=1ar97uck8ovr5
> >
> > With such a URL, the command
> getRequestParameters().getPath() returns
> > simply "images", and all additional path info is lost.
> >
> > Now, my first take at a solution would be to take the jsessionid into
> > consideration when building my URLs, so that they look like this:
> >
> > /images/thumbnail/20.png;jsessionid=1ar97uck8ovr5
> >
> > But maybe this is just a workaround for something I did wrong at another
> place?
> >
> >
> > --
> > 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
> > [email protected]
> > 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>


-- 
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to