Re: Application # newSession # sessionUnbound - RuntimeException

2019-11-21 Thread Sven Meier

Hi Francois,

yes, that's a non-request thread.

IExceptionMapper isn't a general exception handler, it is a mapper from 
exceptions to request handlers.

Using it here does not make sense.

Have fun
Sven


On 21.11.19 18:12, Francois Meillet wrote:

WARNING [Catalina-utility-1] 
org.apache.catalina.core.StandardContext.backgroundProcess Exception lors du 
traitement d'arrière plan du gestionnaire de sessions 
[StandardManager[StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]]
java.lang.RuntimeException
at 
baz.web.base.app.OfferApplication.sessionUnbound(OfferApplication.java:560)
at 
org.apache.wicket.session.HttpSessionStore$SessionBindingListener.valueUnbound(HttpSessionStore.java:444)
at 
org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1784)
at 
org.apache.catalina.session.StandardSession.expire(StandardSession.java:856)
at 
org.apache.catalina.session.StandardSession.isValid(StandardSession.java:659)
at 
org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:573)
at 
org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:558)
at 
org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5539)
at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1353)
at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1357)
at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1357)
at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1335)
at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at 
java.base/java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:305)
at 
java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java)
at 
java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at 
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

François




Le 21 nov. 2019 à 17:55, Sven Meier  a écrit :

Yes, I mean a non-web-request thread, i.e. when the session expires as you've 
written.

Sven

On 21.11.19 17:52, Martin Grigorov wrote:

On Thu, Nov 21, 2019 at 6:30 PM Sven Meier  wrote:


Hi,

actually #sessionUnbound() is called *on* the application instance, so
the ExceptionMapper is available.


oh, right. silly me!




But ExceptionMapper maps an exception to a requestHandler, this doesn't
make sense for an exception happening on a worker thread.


you meant on *non*-worker thread ?

Francois, please give us the stack trace.



Hope this helps
Sven


On 21.11.19 16:37, Martin Grigorov wrote:

Hi Francois,

#sessionUnbound() is called in two contexts:
1) the user clicked the Logout button - in this case the call is executed
in http worker thread where there is a ThreadContext, i.e.
Application.get(), Session.get() and RequestCycle.get() would work
here, I think, Wicket should use the ExceptionMapper
2) when the user session has timed out - in this case the web container
(Tomcat/Jetty) will execute this method in non-worker thread and
Application.get() would be null, so we cannot get a reference to the
ExceptionMapper

On Thu, Nov 21, 2019 at 5:01 PM Francois Meillet <

francois.meil...@gmail.com>

wrote:


Hi,

Any RuntimeException thrown in Application # newSession(Request request,
Response response) is handled by the DefaultExceptionMapper #
mapUnexpectedExceptions(Exception e, final Application application)

but

Any RuntimeException thrown in Application # sessionUnbound(String
sessionid) is not handled

Is that normal ?

François




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For 

Re: Application # newSession # sessionUnbound - RuntimeException

2019-11-21 Thread Francois Meillet
WARNING [Catalina-utility-1] 
org.apache.catalina.core.StandardContext.backgroundProcess Exception lors du 
traitement d'arrière plan du gestionnaire de sessions 
[StandardManager[StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]]
java.lang.RuntimeException
at 
baz.web.base.app.OfferApplication.sessionUnbound(OfferApplication.java:560)
at 
org.apache.wicket.session.HttpSessionStore$SessionBindingListener.valueUnbound(HttpSessionStore.java:444)
at 
org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1784)
at 
org.apache.catalina.session.StandardSession.expire(StandardSession.java:856)
at 
org.apache.catalina.session.StandardSession.isValid(StandardSession.java:659)
at 
org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:573)
at 
org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:558)
at 
org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5539)
at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1353)
at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1357)
at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1357)
at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1335)
at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at 
java.base/java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:305)
at 
java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java)
at 
java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at 
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

François



> Le 21 nov. 2019 à 17:55, Sven Meier  a écrit :
> 
> Yes, I mean a non-web-request thread, i.e. when the session expires as you've 
> written.
> 
> Sven
> 
> On 21.11.19 17:52, Martin Grigorov wrote:
>> On Thu, Nov 21, 2019 at 6:30 PM Sven Meier  wrote:
>> 
>>> Hi,
>>> 
>>> actually #sessionUnbound() is called *on* the application instance, so
>>> the ExceptionMapper is available.
>>> 
>> oh, right. silly me!
>> 
>> 
>> 
>>> But ExceptionMapper maps an exception to a requestHandler, this doesn't
>>> make sense for an exception happening on a worker thread.
>>> 
>> you meant on *non*-worker thread ?
>> 
>> Francois, please give us the stack trace.
>> 
>> 
>>> Hope this helps
>>> Sven
>>> 
>>> 
>>> On 21.11.19 16:37, Martin Grigorov wrote:
 Hi Francois,
 
 #sessionUnbound() is called in two contexts:
 1) the user clicked the Logout button - in this case the call is executed
 in http worker thread where there is a ThreadContext, i.e.
 Application.get(), Session.get() and RequestCycle.get() would work
 here, I think, Wicket should use the ExceptionMapper
 2) when the user session has timed out - in this case the web container
 (Tomcat/Jetty) will execute this method in non-worker thread and
 Application.get() would be null, so we cannot get a reference to the
 ExceptionMapper
 
 On Thu, Nov 21, 2019 at 5:01 PM Francois Meillet <
>>> francois.meil...@gmail.com>
 wrote:
 
> Hi,
> 
> Any RuntimeException thrown in Application # newSession(Request request,
> Response response) is handled by the DefaultExceptionMapper #
> mapUnexpectedExceptions(Exception e, final Application application)
> 
> but
> 
> Any RuntimeException thrown in Application # sessionUnbound(String
> sessionid) is not handled
> 
> Is that normal ?
> 
> François
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>> 
>>> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 



Re: Application # newSession # sessionUnbound - RuntimeException

2019-11-21 Thread Sven Meier
Yes, I mean a non-web-request thread, i.e. when the session expires as 
you've written.


Sven

On 21.11.19 17:52, Martin Grigorov wrote:

On Thu, Nov 21, 2019 at 6:30 PM Sven Meier  wrote:


Hi,

actually #sessionUnbound() is called *on* the application instance, so
the ExceptionMapper is available.


oh, right. silly me!




But ExceptionMapper maps an exception to a requestHandler, this doesn't
make sense for an exception happening on a worker thread.


you meant on *non*-worker thread ?

Francois, please give us the stack trace.



Hope this helps
Sven


On 21.11.19 16:37, Martin Grigorov wrote:

Hi Francois,

#sessionUnbound() is called in two contexts:
1) the user clicked the Logout button - in this case the call is executed
in http worker thread where there is a ThreadContext, i.e.
Application.get(), Session.get() and RequestCycle.get() would work
here, I think, Wicket should use the ExceptionMapper
2) when the user session has timed out - in this case the web container
(Tomcat/Jetty) will execute this method in non-worker thread and
Application.get() would be null, so we cannot get a reference to the
ExceptionMapper

On Thu, Nov 21, 2019 at 5:01 PM Francois Meillet <

francois.meil...@gmail.com>

wrote:


Hi,

Any RuntimeException thrown in Application # newSession(Request request,
Response response) is handled by the DefaultExceptionMapper #
mapUnexpectedExceptions(Exception e, final Application application)

but

Any RuntimeException thrown in Application # sessionUnbound(String
sessionid) is not handled

Is that normal ?

François




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Application # newSession # sessionUnbound - RuntimeException

2019-11-21 Thread Martin Grigorov
On Thu, Nov 21, 2019 at 6:30 PM Sven Meier  wrote:

> Hi,
>
> actually #sessionUnbound() is called *on* the application instance, so
> the ExceptionMapper is available.
>

oh, right. silly me!



> But ExceptionMapper maps an exception to a requestHandler, this doesn't
> make sense for an exception happening on a worker thread.
>

you meant on *non*-worker thread ?

Francois, please give us the stack trace.


> Hope this helps
> Sven
>
>
> On 21.11.19 16:37, Martin Grigorov wrote:
> > Hi Francois,
> >
> > #sessionUnbound() is called in two contexts:
> > 1) the user clicked the Logout button - in this case the call is executed
> > in http worker thread where there is a ThreadContext, i.e.
> > Application.get(), Session.get() and RequestCycle.get() would work
> > here, I think, Wicket should use the ExceptionMapper
> > 2) when the user session has timed out - in this case the web container
> > (Tomcat/Jetty) will execute this method in non-worker thread and
> > Application.get() would be null, so we cannot get a reference to the
> > ExceptionMapper
> >
> > On Thu, Nov 21, 2019 at 5:01 PM Francois Meillet <
> francois.meil...@gmail.com>
> > wrote:
> >
> >> Hi,
> >>
> >> Any RuntimeException thrown in Application # newSession(Request request,
> >> Response response) is handled by the DefaultExceptionMapper #
> >> mapUnexpectedExceptions(Exception e, final Application application)
> >>
> >> but
> >>
> >> Any RuntimeException thrown in Application # sessionUnbound(String
> >> sessionid) is not handled
> >>
> >> Is that normal ?
> >>
> >> François
> >>
> >>
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Opening a stateful page in a new window/tab with ajax

2019-11-21 Thread Sven Meier

Hi,

that's a perfectly valid usage.

Have fun
Sven


On 21.11.19 13:44, mscoon wrote:

Hi all,

We are using the following code inside an ajax callback to create a new
page and open it in a new window. Are there any gotchas with respect to how
we create MyPage and get the url for it? Is it guaranteed to be found in
the user's session when the request for it comes in?

void openPageInNewWindow(AjaxRequestTarget target) {
 Page pg = new MyPage();
 String url = urlFor(new RenderPageRequestHandler(new
PageProvider(pg))).toString();
  target.appendJavaScript("window.open(\"" + url + "\")");
}

Is there a better way to do this?

Note that we don't want to use a BookmarkablePage page as an alternative.
We want the new page to be instantiated inside the ajax callback.

Thank you in advance,
Marios



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Application # newSession # sessionUnbound - RuntimeException

2019-11-21 Thread Sven Meier

Hi,

actually #sessionUnbound() is called *on* the application instance, so 
the ExceptionMapper is available.


But ExceptionMapper maps an exception to a requestHandler, this doesn't 
make sense for an exception happening on a worker thread.


Hope this helps
Sven


On 21.11.19 16:37, Martin Grigorov wrote:

Hi Francois,

#sessionUnbound() is called in two contexts:
1) the user clicked the Logout button - in this case the call is executed
in http worker thread where there is a ThreadContext, i.e.
Application.get(), Session.get() and RequestCycle.get() would work
here, I think, Wicket should use the ExceptionMapper
2) when the user session has timed out - in this case the web container
(Tomcat/Jetty) will execute this method in non-worker thread and
Application.get() would be null, so we cannot get a reference to the
ExceptionMapper

On Thu, Nov 21, 2019 at 5:01 PM Francois Meillet 
wrote:


Hi,

Any RuntimeException thrown in Application # newSession(Request request,
Response response) is handled by the DefaultExceptionMapper #
mapUnexpectedExceptions(Exception e, final Application application)

but

Any RuntimeException thrown in Application # sessionUnbound(String
sessionid) is not handled

Is that normal ?

François




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Application # newSession # sessionUnbound - RuntimeException

2019-11-21 Thread Francois Meillet
thanks Martin

François



> Le 21 nov. 2019 à 16:37, Martin Grigorov  a écrit :
> 
> Hi Francois,
> 
> #sessionUnbound() is called in two contexts:
> 1) the user clicked the Logout button - in this case the call is executed
> in http worker thread where there is a ThreadContext, i.e.
> Application.get(), Session.get() and RequestCycle.get() would work
> here, I think, Wicket should use the ExceptionMapper
> 2) when the user session has timed out - in this case the web container
> (Tomcat/Jetty) will execute this method in non-worker thread and
> Application.get() would be null, so we cannot get a reference to the
> ExceptionMapper
> 
> On Thu, Nov 21, 2019 at 5:01 PM Francois Meillet 
> wrote:
> 
>> Hi,
>> 
>> Any RuntimeException thrown in Application # newSession(Request request,
>> Response response) is handled by the DefaultExceptionMapper #
>> mapUnexpectedExceptions(Exception e, final Application application)
>> 
>> but
>> 
>> Any RuntimeException thrown in Application # sessionUnbound(String
>> sessionid) is not handled
>> 
>> Is that normal ?
>> 
>> François
>> 
>> 
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Application # newSession # sessionUnbound - RuntimeException

2019-11-21 Thread Martin Grigorov
Hi Francois,

#sessionUnbound() is called in two contexts:
1) the user clicked the Logout button - in this case the call is executed
in http worker thread where there is a ThreadContext, i.e.
Application.get(), Session.get() and RequestCycle.get() would work
here, I think, Wicket should use the ExceptionMapper
2) when the user session has timed out - in this case the web container
(Tomcat/Jetty) will execute this method in non-worker thread and
Application.get() would be null, so we cannot get a reference to the
ExceptionMapper

On Thu, Nov 21, 2019 at 5:01 PM Francois Meillet 
wrote:

> Hi,
>
> Any RuntimeException thrown in Application # newSession(Request request,
> Response response) is handled by the DefaultExceptionMapper #
> mapUnexpectedExceptions(Exception e, final Application application)
>
> but
>
> Any RuntimeException thrown in Application # sessionUnbound(String
> sessionid) is not handled
>
> Is that normal ?
>
> François
>
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Application # newSession # sessionUnbound - RuntimeException

2019-11-21 Thread Francois Meillet
Hi,

Any RuntimeException thrown in Application # newSession(Request request, 
Response response) is handled by the DefaultExceptionMapper # 
mapUnexpectedExceptions(Exception e, final Application application)

but

Any RuntimeException thrown in Application # sessionUnbound(String sessionid) 
is not handled

Is that normal ?

François




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Opening a stateful page in a new window/tab with ajax

2019-11-21 Thread mscoon
Hi all,

We are using the following code inside an ajax callback to create a new
page and open it in a new window. Are there any gotchas with respect to how
we create MyPage and get the url for it? Is it guaranteed to be found in
the user's session when the request for it comes in?

void openPageInNewWindow(AjaxRequestTarget target) {
Page pg = new MyPage();
String url = urlFor(new RenderPageRequestHandler(new
PageProvider(pg))).toString();
 target.appendJavaScript("window.open(\"" + url + "\")");
}

Is there a better way to do this?

Note that we don't want to use a BookmarkablePage page as an alternative.
We want the new page to be instantiated inside the ajax callback.

Thank you in advance,
Marios