Although I haven't tested this theory, I used the ThreadLocal because I am
fairly sure that the "shared" resources are shared across threads (multiple
simultaneous requests) without synchronization.  Therefore, you need to keep
the parameters between method invocations, but can't keep it in a normal
field because multiple requests could be reading / writing them
simultaneously.

That code was not the best code - but it's a workaround because the
parameters are blown away before you are in your method that creates the
image.


-- 
Jeremy Thomerson
http://www.wickettraining.com


On Sat, Dec 27, 2008 at 1:31 AM, smallufo <[email protected]> wrote:

> Thank you, it works !
> Though I am not sure why ThreadLocal is needed here ...
>
> Anyway , the solution is much pretty than WebPage.
>
> BR
> --
>
>
>
> 2008/12/27 Jeremy Thomerson <[email protected]>
>
> > It's not a WebPage because you're not serving a page - it is a mounted
> > resource.  Why do you want to force it to be a page?  It's a bookmarkable
> > resource - which is what you're serving.  The type is set by
> > DynamicImageResource - look in getResourceStream or getResourceState.
> >
> > On Fri, Dec 26, 2008 at 1:51 PM, smallufo <[email protected]> wrote:
> >
> > > Hi ,
> > > thank you for replying.....
> > >
> > >
> > > 2008/12/26 Jeremy Thomerson <[email protected]>
> > > Then, you can include it in your page:
> > > JAVA: add(new Image("img", new
> > > ResourceReference( WicketApplication.IMAGE_KEY)));
> > > HTML: <img wicket:id="img" />
> > >
> > >
> > >
> > > >
> > > > http://localhost:8080/foo
> > > > http://localhost:8080/foo?text=fff&width=200
> > > >
> > > >
> > >
> > >
> > >
> > > My question is ...
> > > is "/foo" a bookmarkable mounted WebPage ?
> > > If it is , where did you set the ContentType to "image/png" ? I cannot
> > find
> > > such code ...
> > >
> > > If it is not a WebPage , how should I accomplish this by a WebPage ?
> > > I don't need the dynamic-generated image to be included in the
> WebPage's
> > > <img> tag.
> > >
> > > BR
> > > --
> > > smallufo
> > >
> >
> >
> >
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
>

Reply via email to