On Thu, April 04, 2013, Martin Grigorov wrote:

> You can pass the application name (application.getName()) to the manually
> started threads and later use it to lookup the Application when needed:
> Application.get(appName).
> 
> If you can understand Scala then you can use
> https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/scala-extensions-parent/wicket-scala/src/main/scala/org/wicketstuff/scala/FutureModel.scala#L53
> as
> inspiration.

Thanks, the 'detach()' call was useful. 
However it seems like I have now found out what my main mistake
was. I obviously did not fully understand how Applications are
created.

When I create my own dummy application, I need to make sure that
I choose a name different from what the Wicket filter I have
configured in my web.xml uses, as that one will run into an
exception when setting the name to a value for which there
already is an application. 

Thus (in rough steps) my code now looks like this:

1. check if an Application is set, if yes, everything's fine
2. if not, check if a dummy Application with a given
   dummy-application-name exists, if no, create it under that
   name
3. set the dummy application in the ThreadContext
4. do your work
5. clean up the ThreadContext using 'detach()'

This way my code seems to work. Anything else that I
misunderstood?

Cheers,

M'bert

-- 
----------- / http://herbert.the-little-red-haired-girl.org / -------------
=+= 
The only "intuitive" interface is the nipple. After that, it's all
learned.  -- Bruce Ediger 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to