Hi,

You should do something like
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java#L46
You almost have it.
The only extra thing you should do is to export the Application as a
ThreadLocal. You can get a reference to it by using
Application.get(String). As parameter use the name of the WicketFilter in
your web.xml. The export it with ThreadContext.setApplication(app) and
unexport it in the finally clause.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Fri, Aug 1, 2014 at 8:35 AM, hoosssein <[email protected]> wrote:

> I use Hibernate in wicket and i create a Hibernate Session at the beginning
> of each request. now i want to create a TimerTask and work with database
> but
> there is no open session in this thread and if I open session manually, it
> doesn't work because my entities work with the session that give form
> RequestCycle.get(). so is there any way to manually create a request and
> finalize it?
>
> I try this
>
>     final MockWebRequest request = new MockWebRequest(null);
>     final NullResponse response = NullResponse.getInstance();
>     RequestCycle rc = Application.get().createRequestCycle(request,
> response);
>     //do jobs
>     rc.detach();
>
> but at line 3 it said that There is no application attached to current
> thread.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Create-Request-Manually-tp4666838.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to