You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ann Baert <an...@tvh.be> on 2009/07/10 12:00:09 UTC

How to throw new PageExpiredException?

Hello,

How can I throw a PageExpiredException in the constructor of my WebPage?
Because the exception is wrapped by Wicket with WicketRuntimeException it 
goes to the InternalErrorPage.

Thanks,
Ann
**** DISCLAIMER ****
<A HREF="http://www.tvh.be/newen/pages/emaildisclaimer.html">
http://www.tvh.be/newen/pages/emaildisclaimer.html </A>

"This message is delivered to all addressees subject to the conditions
set forth in the attached disclaimer, which is an integral part of this
message."

Re: How to throw new PageExpiredException?

Posted by Igor Vaynberg <ig...@gmail.com>.
throw new RestartResponseException(getApplication().getSettings().getPageExpiredErrorPage());

-igor

On Thu, Jul 16, 2009 at 1:54 AM, Ann Baert<an...@tvh.be> wrote:
>
> That's not how I want it.
> I have a custom PageExpiredErrorPage (and AccessDenied...), so he has to
> take those automaticly.
> getApplicationSettings().setPageExpiredErrorPage(CustomPageExpiredErrorPage.class);
> With your solution I have to repeat them everywhere, like I do now with
> setResponsePage().
>
>
>
> Serkan Camurcuoglu-3 wrote:
>>
>> If all you want is to display a page expired page, maybe you could just
>> use
>>
>> throw new RestartResponseException(PageExpiredErrorPage.class);
>>
>> in your page constructor.
>>
>>
>>
>> Ann Baert wrote:
>>> Can anyone help me with this problem please?
>>> Thanks in advance, Ann.
>>>
>>>
>>>
>>> Ann Baert wrote:
>>>
>>>> I have overridden the RequestCycle.onRuntimeException method:
>>>>
>>>> @Override
>>>> public RequestCycle newRequestCycle(final Request request, final
>>>> Response
>>>> response) {
>>>>     return new WebRequestCycle(this, (WebRequest) request, (WebResponse)
>>>> response) {
>>>>
>>>>         @Override
>>>>         public Page onRuntimeException(Page page, RuntimeException e) {
>>>>             Throwable t = e.getCause();
>>>>             while(t != null) {
>>>>                 if(t instanceof PageExpiredException) {
>>>>                     return super.onRuntimeException(page, new
>>>> PageExpiredException("test"));
>>>>                 }
>>>>
>>>>                 t = t.getCause();
>>>>             }
>>>>             return super.onRuntimeException(page, e);
>>>>         }
>>>>     };
>>>> }
>>>>
>>>> He comes in the if(t instanceof PageExpiredException)..., but in the
>>>> AbstractRequestCycleProcessor.respond(RuntimeException e, RequestCycle
>>>> requestCycle) method he doesn't do anything with the RuntimeException.
>>>> So
>>>> he has still a WicketRuntimeException instead of the
>>>> PageExpiredException.
>>>>
>>>> Ann
>>>>
>>>>
>>>>
>>>>
>>>> igor.vaynberg wrote:
>>>>
>>>>> you can try unwrapping the exceptions in
>>>>> requestcycle.onruntimeexception and call super with the page exipred
>>>>> exception.
>>>>>
>>>>> -igor
>>>>>
>>>>> On Fri, Jul 10, 2009 at 3:00 AM, Ann Baert<an...@tvh.be> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> How can I throw a PageExpiredException in the constructor of my
>>>>>> WebPage?
>>>>>> Because the exception is wrapped by Wicket with WicketRuntimeException
>>>>>> it
>>>>>> goes to the InternalErrorPage.
>>>>>>
>>>>>> Thanks,
>>>>>> Ann
>>>>>> **** DISCLAIMER ****
>>>>>>  http://www.tvh.be/newen/pages/emaildisclaimer.html
>>>>>> http://www.tvh.be/newen/pages/emaildisclaimer.html
>>>>>>
>>>>>> "This message is delivered to all addressees subject to the conditions
>>>>>> set forth in the attached disclaimer, which is an integral part of
>>>>>> this
>>>>>> message."
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/How-to-throw-new-PageExpiredException--tp24424791p24512739.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: How to throw new PageExpiredException?

Posted by Linda van der Pal <lv...@heritageagenturen.nl>.
When I ran into this problem myself with 1.4-rc4, I remembered this 
message and upgraded to rc7. But I still get the Unexpected 
RuntimeException page instead of my custom SessionExpiredPage. Am I 
doing something wrong?

Regards,
Linda

public class WicketApplication extends AuthenticatedWebApplication {
    @Override
    public Class<HomePage> getHomePage() {
        return HomePage.class;
    }

    @Override
    protected Class<? extends WebPage> getSignInPageClass() {
        return LoginPage.class;
    }

    @Override
    protected Class<? extends AuthenticatedWebSession> 
getWebSessionClass() {
        return LunaSession.class;
    }

    @Override
    protected void init() {
        super.init();
        IApplicationSettings settings = getApplicationSettings();
        settings.setPageExpiredErrorPage(SessionExpiredPage.class);
    }

public class SessionExpiredPage extends WebPage {

    private static final long serialVersionUID = 1L;
       
    /**
     * Constructor that is invoked when page is invoked without a session.
     * @param parameters Page parameters
     */
    public SessionExpiredPage(final PageParameters parameters) {
        super(parameters);
       
        add(new StyleSheetReference("stylesheet", HomePage.class, 
"luna.css"));
        add(new Image("bookshelf", new ResourceReference(HomePage.class, 
"bookshelf.png")));
       
       
    }
}

Major Péter wrote:
> Which wicket version are you using? With 1.4-rc7 this behaviour should 
> be fixed.
>
> Peter


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


Re: How to throw new PageExpiredException?

Posted by Major Péter <ma...@sch.bme.hu>.
Which wicket version are you using? With 1.4-rc7 this behaviour should 
be fixed.

Peter

2009-07-16 11:13 keltezéssel, Ann Baert írta:
> I do that already, see my previous post.
> But the PageExpiredException is wrapped into WicketRuntimeException, so that
> he doesn't come on those pages.
>
>
>
>
> Linda van der Pal wrote:
>> A quote from Wicket in Action:
>> =============
>> The three custom error pages can be set in the init method of your
>> Application using the application settings. Here’s an example:
>>
>> @Override
>> protected void init() {
>> IApplicationSettings settings = getApplicationSettings();
>> settings.setAccessDeniedPage(CheesrAccessDeniedPage.class);
>> settings.setPageExpiredErrorPage(CheesrPageExpiredErrorPage.class);
>> settings.setInternalErrorPage(CheesrInternalErrorPage.class);
>> }
>> =============
>> Doesn't this accomplish what you want?
>>
>> Regards,
>> Linda
>>
>> Ann Baert wrote:
>>> That's not how I want it.
>>> I have a custom PageExpiredErrorPage (and AccessDenied...), so he has to
>>> take those automaticly.
>>> getApplicationSettings().setPageExpiredErrorPage(CustomPageExpiredErrorPage.class);
>>> With your solution I have to repeat them everywhere, like I do now with
>>> setResponsePage().
>>>
>>>
>>>
>>> Serkan Camurcuoglu-3 wrote:
>>>
>>>> If all you want is to display a page expired page, maybe you could just
>>>> use
>>>>
>>>> throw new RestartResponseException(PageExpiredErrorPage.class);
>>>>
>>>> in your page constructor.
>>>>
>>>>
>>>>
>>>> Ann Baert wrote:
>>>>
>>>>> Can anyone help me with this problem please?
>>>>> Thanks in advance, Ann.
>>>>>
>>>>>
>>>>>
>>>>> Ann Baert wrote:
>>>>>
>>>>>
>>>>>> I have overridden the RequestCycle.onRuntimeException method:
>>>>>>
>>>>>> @Override
>>>>>> public RequestCycle newRequestCycle(final Request request, final
>>>>>> Response
>>>>>> response) {
>>>>>>      return new WebRequestCycle(this, (WebRequest) request,
>>>>>> (WebResponse)
>>>>>> response) {
>>>>>>
>>>>>>          @Override
>>>>>>          public Page onRuntimeException(Page page, RuntimeException e)
>>>>>> {
>>>>>>              Throwable t = e.getCause();
>>>>>>              while(t != null) {
>>>>>>                  if(t instanceof PageExpiredException) {
>>>>>>                      return super.onRuntimeException(page, new
>>>>>> PageExpiredException("test"));
>>>>>>                  }
>>>>>>
>>>>>>                  t = t.getCause();
>>>>>>              }
>>>>>>              return super.onRuntimeException(page, e);
>>>>>>          }
>>>>>>      };
>>>>>> }
>>>>>>
>>>>>> He comes in the if(t instanceof PageExpiredException)..., but in the
>>>>>> AbstractRequestCycleProcessor.respond(RuntimeException e, RequestCycle
>>>>>> requestCycle) method he doesn't do anything with the RuntimeException.
>>>>>> So
>>>>>> he has still a WicketRuntimeException instead of the
>>>>>> PageExpiredException.
>>>>>>
>>>>>> Ann
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> igor.vaynberg wrote:
>>>>>>
>>>>>>
>>>>>>> you can try unwrapping the exceptions in
>>>>>>> requestcycle.onruntimeexception and call super with the page exipred
>>>>>>> exception.
>>>>>>>
>>>>>>> -igor
>>>>>>>
>>>>>>> On Fri, Jul 10, 2009 at 3:00 AM, Ann Baert<an...@tvh.be>  wrote:
>>>>>>>
>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> How can I throw a PageExpiredException in the constructor of my
>>>>>>>> WebPage?
>>>>>>>> Because the exception is wrapped by Wicket with
>>>>>>>> WicketRuntimeException
>>>>>>>> it
>>>>>>>> goes to the InternalErrorPage.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Ann
>>>>>>>> **** DISCLAIMER ****
>>>>>>>>   http://www.tvh.be/newen/pages/emaildisclaimer.html
>>>>>>>> http://www.tvh.be/newen/pages/emaildisclaimer.html
>>>>>>>>
>>>>>>>> "This message is delivered to all addressees subject to the
>>>>>>>> conditions
>>>>>>>> set forth in the attached disclaimer, which is an integral part of
>>>>>>>> this
>>>>>>>> message."

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


Re: How to throw new PageExpiredException?

Posted by Ann Baert <an...@tvh.be>.
I do that already, see my previous post.
But the PageExpiredException is wrapped into WicketRuntimeException, so that
he doesn't come on those pages.




Linda van der Pal wrote:
> 
> A quote from Wicket in Action:
> =============
> The three custom error pages can be set in the init method of your 
> Application using the application settings. Here’s an example:
> 
> @Override
> protected void init() {
> IApplicationSettings settings = getApplicationSettings();
> settings.setAccessDeniedPage(CheesrAccessDeniedPage.class);
> settings.setPageExpiredErrorPage(CheesrPageExpiredErrorPage.class);
> settings.setInternalErrorPage(CheesrInternalErrorPage.class);
> }
> =============
> Doesn't this accomplish what you want?
> 
> Regards,
> Linda
> 
> Ann Baert wrote:
>> That's not how I want it.
>> I have a custom PageExpiredErrorPage (and AccessDenied...), so he has to
>> take those automaticly.
>> getApplicationSettings().setPageExpiredErrorPage(CustomPageExpiredErrorPage.class);
>> With your solution I have to repeat them everywhere, like I do now with
>> setResponsePage().
>>
>>
>>
>> Serkan Camurcuoglu-3 wrote:
>>   
>>> If all you want is to display a page expired page, maybe you could just
>>> use
>>>
>>> throw new RestartResponseException(PageExpiredErrorPage.class);
>>>
>>> in your page constructor.
>>>
>>>
>>>
>>> Ann Baert wrote:
>>>     
>>>> Can anyone help me with this problem please?
>>>> Thanks in advance, Ann.
>>>>
>>>>
>>>>
>>>> Ann Baert wrote:
>>>>   
>>>>       
>>>>> I have overridden the RequestCycle.onRuntimeException method:
>>>>>
>>>>> @Override
>>>>> public RequestCycle newRequestCycle(final Request request, final
>>>>> Response
>>>>> response) {
>>>>>     return new WebRequestCycle(this, (WebRequest) request,
>>>>> (WebResponse)
>>>>> response) {
>>>>>
>>>>>         @Override
>>>>>         public Page onRuntimeException(Page page, RuntimeException e)
>>>>> {
>>>>>             Throwable t = e.getCause();
>>>>>             while(t != null) {
>>>>>                 if(t instanceof PageExpiredException) {
>>>>>                     return super.onRuntimeException(page, new
>>>>> PageExpiredException("test"));
>>>>>                 }
>>>>>
>>>>>                 t = t.getCause();
>>>>>             }
>>>>>             return super.onRuntimeException(page, e);
>>>>>         }
>>>>>     };
>>>>> }
>>>>>
>>>>> He comes in the if(t instanceof PageExpiredException)..., but in the
>>>>> AbstractRequestCycleProcessor.respond(RuntimeException e, RequestCycle
>>>>> requestCycle) method he doesn't do anything with the RuntimeException.
>>>>> So
>>>>> he has still a WicketRuntimeException instead of the
>>>>> PageExpiredException.
>>>>>
>>>>> Ann
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> igor.vaynberg wrote:
>>>>>     
>>>>>         
>>>>>> you can try unwrapping the exceptions in
>>>>>> requestcycle.onruntimeexception and call super with the page exipred
>>>>>> exception.
>>>>>>
>>>>>> -igor
>>>>>>
>>>>>> On Fri, Jul 10, 2009 at 3:00 AM, Ann Baert<an...@tvh.be> wrote:
>>>>>>       
>>>>>>           
>>>>>>> Hello,
>>>>>>>
>>>>>>> How can I throw a PageExpiredException in the constructor of my
>>>>>>> WebPage?
>>>>>>> Because the exception is wrapped by Wicket with
>>>>>>> WicketRuntimeException
>>>>>>> it
>>>>>>> goes to the InternalErrorPage.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Ann
>>>>>>> **** DISCLAIMER ****
>>>>>>>  http://www.tvh.be/newen/pages/emaildisclaimer.html 
>>>>>>> http://www.tvh.be/newen/pages/emaildisclaimer.html  
>>>>>>>
>>>>>>> "This message is delivered to all addressees subject to the
>>>>>>> conditions
>>>>>>> set forth in the attached disclaimer, which is an integral part of
>>>>>>> this
>>>>>>> message."
>>>>>>>
>>>>>>>         
>>>>>>>             
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>       
>>>>>>           
>>>>>     
>>>>>         
>>>>   
>>>>       
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>>     
>>
>>   
>> ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com 
>> Version: 8.5.375 / Virus Database: 270.13.16/2240 - Release Date:
>> 07/15/09 17:58:00
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-throw-new-PageExpiredException--tp24424791p24512967.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: How to throw new PageExpiredException?

Posted by Linda van der Pal <lv...@heritageagenturen.nl>.
A quote from Wicket in Action:
=============
The three custom error pages can be set in the init method of your 
Application using the application settings. Here’s an example:

@Override
protected void init() {
IApplicationSettings settings = getApplicationSettings();
settings.setAccessDeniedPage(CheesrAccessDeniedPage.class);
settings.setPageExpiredErrorPage(CheesrPageExpiredErrorPage.class);
settings.setInternalErrorPage(CheesrInternalErrorPage.class);
}
=============
Doesn't this accomplish what you want?

Regards,
Linda

Ann Baert wrote:
> That's not how I want it.
> I have a custom PageExpiredErrorPage (and AccessDenied...), so he has to
> take those automaticly.
> getApplicationSettings().setPageExpiredErrorPage(CustomPageExpiredErrorPage.class);
> With your solution I have to repeat them everywhere, like I do now with
> setResponsePage().
>
>
>
> Serkan Camurcuoglu-3 wrote:
>   
>> If all you want is to display a page expired page, maybe you could just
>> use
>>
>> throw new RestartResponseException(PageExpiredErrorPage.class);
>>
>> in your page constructor.
>>
>>
>>
>> Ann Baert wrote:
>>     
>>> Can anyone help me with this problem please?
>>> Thanks in advance, Ann.
>>>
>>>
>>>
>>> Ann Baert wrote:
>>>   
>>>       
>>>> I have overridden the RequestCycle.onRuntimeException method:
>>>>
>>>> @Override
>>>> public RequestCycle newRequestCycle(final Request request, final
>>>> Response
>>>> response) {
>>>>     return new WebRequestCycle(this, (WebRequest) request, (WebResponse)
>>>> response) {
>>>>
>>>>         @Override
>>>>         public Page onRuntimeException(Page page, RuntimeException e) {
>>>>             Throwable t = e.getCause();
>>>>             while(t != null) {
>>>>                 if(t instanceof PageExpiredException) {
>>>>                     return super.onRuntimeException(page, new
>>>> PageExpiredException("test"));
>>>>                 }
>>>>
>>>>                 t = t.getCause();
>>>>             }
>>>>             return super.onRuntimeException(page, e);
>>>>         }
>>>>     };
>>>> }
>>>>
>>>> He comes in the if(t instanceof PageExpiredException)..., but in the
>>>> AbstractRequestCycleProcessor.respond(RuntimeException e, RequestCycle
>>>> requestCycle) method he doesn't do anything with the RuntimeException.
>>>> So
>>>> he has still a WicketRuntimeException instead of the
>>>> PageExpiredException.
>>>>
>>>> Ann
>>>>
>>>>
>>>>
>>>>
>>>> igor.vaynberg wrote:
>>>>     
>>>>         
>>>>> you can try unwrapping the exceptions in
>>>>> requestcycle.onruntimeexception and call super with the page exipred
>>>>> exception.
>>>>>
>>>>> -igor
>>>>>
>>>>> On Fri, Jul 10, 2009 at 3:00 AM, Ann Baert<an...@tvh.be> wrote:
>>>>>       
>>>>>           
>>>>>> Hello,
>>>>>>
>>>>>> How can I throw a PageExpiredException in the constructor of my
>>>>>> WebPage?
>>>>>> Because the exception is wrapped by Wicket with WicketRuntimeException
>>>>>> it
>>>>>> goes to the InternalErrorPage.
>>>>>>
>>>>>> Thanks,
>>>>>> Ann
>>>>>> **** DISCLAIMER ****
>>>>>>  http://www.tvh.be/newen/pages/emaildisclaimer.html 
>>>>>> http://www.tvh.be/newen/pages/emaildisclaimer.html  
>>>>>>
>>>>>> "This message is delivered to all addressees subject to the conditions
>>>>>> set forth in the attached disclaimer, which is an integral part of
>>>>>> this
>>>>>> message."
>>>>>>
>>>>>>         
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>       
>>>>>           
>>>>     
>>>>         
>>>   
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>>     
>
>   
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.5.375 / Virus Database: 270.13.16/2240 - Release Date: 07/15/09 17:58:00
>
>   


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


Re: How to throw new PageExpiredException?

Posted by Ann Baert <an...@tvh.be>.
That's not how I want it.
I have a custom PageExpiredErrorPage (and AccessDenied...), so he has to
take those automaticly.
getApplicationSettings().setPageExpiredErrorPage(CustomPageExpiredErrorPage.class);
With your solution I have to repeat them everywhere, like I do now with
setResponsePage().



Serkan Camurcuoglu-3 wrote:
> 
> If all you want is to display a page expired page, maybe you could just
> use
> 
> throw new RestartResponseException(PageExpiredErrorPage.class);
> 
> in your page constructor.
> 
> 
> 
> Ann Baert wrote:
>> Can anyone help me with this problem please?
>> Thanks in advance, Ann.
>>
>>
>>
>> Ann Baert wrote:
>>   
>>> I have overridden the RequestCycle.onRuntimeException method:
>>>
>>> @Override
>>> public RequestCycle newRequestCycle(final Request request, final
>>> Response
>>> response) {
>>>     return new WebRequestCycle(this, (WebRequest) request, (WebResponse)
>>> response) {
>>>
>>>         @Override
>>>         public Page onRuntimeException(Page page, RuntimeException e) {
>>>             Throwable t = e.getCause();
>>>             while(t != null) {
>>>                 if(t instanceof PageExpiredException) {
>>>                     return super.onRuntimeException(page, new
>>> PageExpiredException("test"));
>>>                 }
>>>
>>>                 t = t.getCause();
>>>             }
>>>             return super.onRuntimeException(page, e);
>>>         }
>>>     };
>>> }
>>>
>>> He comes in the if(t instanceof PageExpiredException)..., but in the
>>> AbstractRequestCycleProcessor.respond(RuntimeException e, RequestCycle
>>> requestCycle) method he doesn't do anything with the RuntimeException.
>>> So
>>> he has still a WicketRuntimeException instead of the
>>> PageExpiredException.
>>>
>>> Ann
>>>
>>>
>>>
>>>
>>> igor.vaynberg wrote:
>>>     
>>>> you can try unwrapping the exceptions in
>>>> requestcycle.onruntimeexception and call super with the page exipred
>>>> exception.
>>>>
>>>> -igor
>>>>
>>>> On Fri, Jul 10, 2009 at 3:00 AM, Ann Baert<an...@tvh.be> wrote:
>>>>       
>>>>> Hello,
>>>>>
>>>>> How can I throw a PageExpiredException in the constructor of my
>>>>> WebPage?
>>>>> Because the exception is wrapped by Wicket with WicketRuntimeException
>>>>> it
>>>>> goes to the InternalErrorPage.
>>>>>
>>>>> Thanks,
>>>>> Ann
>>>>> **** DISCLAIMER ****
>>>>>  http://www.tvh.be/newen/pages/emaildisclaimer.html 
>>>>> http://www.tvh.be/newen/pages/emaildisclaimer.html  
>>>>>
>>>>> "This message is delivered to all addressees subject to the conditions
>>>>> set forth in the attached disclaimer, which is an integral part of
>>>>> this
>>>>> message."
>>>>>
>>>>>         
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>>       
>>>     
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-throw-new-PageExpiredException--tp24424791p24512739.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: How to throw new PageExpiredException?

Posted by Serkan Camurcuoglu <Se...@telenity.com>.
If all you want is to display a page expired page, maybe you could just use

throw new RestartResponseException(PageExpiredErrorPage.class);

in your page constructor.



Ann Baert wrote:
> Can anyone help me with this problem please?
> Thanks in advance, Ann.
>
>
>
> Ann Baert wrote:
>   
>> I have overridden the RequestCycle.onRuntimeException method:
>>
>> @Override
>> public RequestCycle newRequestCycle(final Request request, final Response
>> response) {
>>     return new WebRequestCycle(this, (WebRequest) request, (WebResponse)
>> response) {
>>
>>         @Override
>>         public Page onRuntimeException(Page page, RuntimeException e) {
>>             Throwable t = e.getCause();
>>             while(t != null) {
>>                 if(t instanceof PageExpiredException) {
>>                     return super.onRuntimeException(page, new
>> PageExpiredException("test"));
>>                 }
>>
>>                 t = t.getCause();
>>             }
>>             return super.onRuntimeException(page, e);
>>         }
>>     };
>> }
>>
>> He comes in the if(t instanceof PageExpiredException)..., but in the
>> AbstractRequestCycleProcessor.respond(RuntimeException e, RequestCycle
>> requestCycle) method he doesn't do anything with the RuntimeException. So
>> he has still a WicketRuntimeException instead of the PageExpiredException.
>>
>> Ann
>>
>>
>>
>>
>> igor.vaynberg wrote:
>>     
>>> you can try unwrapping the exceptions in
>>> requestcycle.onruntimeexception and call super with the page exipred
>>> exception.
>>>
>>> -igor
>>>
>>> On Fri, Jul 10, 2009 at 3:00 AM, Ann Baert<an...@tvh.be> wrote:
>>>       
>>>> Hello,
>>>>
>>>> How can I throw a PageExpiredException in the constructor of my WebPage?
>>>> Because the exception is wrapped by Wicket with WicketRuntimeException
>>>> it
>>>> goes to the InternalErrorPage.
>>>>
>>>> Thanks,
>>>> Ann
>>>> **** DISCLAIMER ****
>>>>  http://www.tvh.be/newen/pages/emaildisclaimer.html 
>>>> http://www.tvh.be/newen/pages/emaildisclaimer.html  
>>>>
>>>> "This message is delivered to all addressees subject to the conditions
>>>> set forth in the attached disclaimer, which is an integral part of this
>>>> message."
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>>       
>>     
>
>   


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


Re: How to throw new PageExpiredException?

Posted by Ann Baert <an...@tvh.be>.
Can anyone help me with this problem please?
Thanks in advance, Ann.



Ann Baert wrote:
> 
> I have overridden the RequestCycle.onRuntimeException method:
> 
> @Override
> public RequestCycle newRequestCycle(final Request request, final Response
> response) {
>     return new WebRequestCycle(this, (WebRequest) request, (WebResponse)
> response) {
> 
>         @Override
>         public Page onRuntimeException(Page page, RuntimeException e) {
>             Throwable t = e.getCause();
>             while(t != null) {
>                 if(t instanceof PageExpiredException) {
>                     return super.onRuntimeException(page, new
> PageExpiredException("test"));
>                 }
> 
>                 t = t.getCause();
>             }
>             return super.onRuntimeException(page, e);
>         }
>     };
> }
> 
> He comes in the if(t instanceof PageExpiredException)..., but in the
> AbstractRequestCycleProcessor.respond(RuntimeException e, RequestCycle
> requestCycle) method he doesn't do anything with the RuntimeException. So
> he has still a WicketRuntimeException instead of the PageExpiredException.
> 
> Ann
> 
> 
> 
> 
> igor.vaynberg wrote:
>> 
>> you can try unwrapping the exceptions in
>> requestcycle.onruntimeexception and call super with the page exipred
>> exception.
>> 
>> -igor
>> 
>> On Fri, Jul 10, 2009 at 3:00 AM, Ann Baert<an...@tvh.be> wrote:
>>> Hello,
>>>
>>> How can I throw a PageExpiredException in the constructor of my WebPage?
>>> Because the exception is wrapped by Wicket with WicketRuntimeException
>>> it
>>> goes to the InternalErrorPage.
>>>
>>> Thanks,
>>> Ann
>>> **** DISCLAIMER ****
>>>  http://www.tvh.be/newen/pages/emaildisclaimer.html 
>>> http://www.tvh.be/newen/pages/emaildisclaimer.html  
>>>
>>> "This message is delivered to all addressees subject to the conditions
>>> set forth in the attached disclaimer, which is an integral part of this
>>> message."
>>>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-throw-new-PageExpiredException--tp24424791p24512117.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: How to throw new PageExpiredException?

Posted by Ann Baert <an...@tvh.be>.
I have overridden the RequestCycle.onRuntimeException method:

@Override
public RequestCycle newRequestCycle(final Request request, final Response
response) {
    return new WebRequestCycle(this, (WebRequest) request, (WebResponse)
response) {

        @Override
        public Page onRuntimeException(Page page, RuntimeException e) {
            Throwable t = e.getCause();
            while(t != null) {
                if(t instanceof PageExpiredException) {
                    return super.onRuntimeException(page, new
PageExpiredException("test"));
                }

                t = t.getCause();
            }
            return super.onRuntimeException(page, e);
        }
    };
}

He comes in the if(t instanceof PageExpiredException)..., but in the
AbstractRequestCycleProcessor.respond(RuntimeException e, RequestCycle
requestCycle) method he doesn't do anything with the RuntimeException. So he
has still a WicketRuntimeException instead of the PageExpiredException.

Ann




igor.vaynberg wrote:
> 
> you can try unwrapping the exceptions in
> requestcycle.onruntimeexception and call super with the page exipred
> exception.
> 
> -igor
> 
> On Fri, Jul 10, 2009 at 3:00 AM, Ann Baert<an...@tvh.be> wrote:
>> Hello,
>>
>> How can I throw a PageExpiredException in the constructor of my WebPage?
>> Because the exception is wrapped by Wicket with WicketRuntimeException it
>> goes to the InternalErrorPage.
>>
>> Thanks,
>> Ann
>> **** DISCLAIMER ****
>>  http://www.tvh.be/newen/pages/emaildisclaimer.html 
>> http://www.tvh.be/newen/pages/emaildisclaimer.html  
>>
>> "This message is delivered to all addressees subject to the conditions
>> set forth in the attached disclaimer, which is an integral part of this
>> message."
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-throw-new-PageExpiredException--tp24424791p24457324.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: How to throw new PageExpiredException?

Posted by Igor Vaynberg <ig...@gmail.com>.
not necessarily. we do not unwrap the exceptions to check for page
expired generally, so if you throw it from your code we can catch it
and wrap it in a WRE.

-igor

On Fri, Jul 10, 2009 at 8:32 PM, James
Carman<jc...@carmanconsulting.com> wrote:
> 1.4-rc7 should fix this, no?
>
> On Fri, Jul 10, 2009 at 10:48 AM, Igor Vaynberg<ig...@gmail.com> wrote:
>> you can try unwrapping the exceptions in
>> requestcycle.onruntimeexception and call super with the page exipred
>> exception.
>>
>> -igor
>>
>> On Fri, Jul 10, 2009 at 3:00 AM, Ann Baert<an...@tvh.be> wrote:
>>> Hello,
>>>
>>> How can I throw a PageExpiredException in the constructor of my WebPage?
>>> Because the exception is wrapped by Wicket with WicketRuntimeException it
>>> goes to the InternalErrorPage.
>>>
>>> Thanks,
>>> Ann
>>> **** DISCLAIMER ****
>>> <A HREF="http://www.tvh.be/newen/pages/emaildisclaimer.html">
>>> http://www.tvh.be/newen/pages/emaildisclaimer.html </A>
>>>
>>> "This message is delivered to all addressees subject to the conditions
>>> set forth in the attached disclaimer, which is an integral part of this
>>> message."
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: How to throw new PageExpiredException?

Posted by James Carman <jc...@carmanconsulting.com>.
1.4-rc7 should fix this, no?

On Fri, Jul 10, 2009 at 10:48 AM, Igor Vaynberg<ig...@gmail.com> wrote:
> you can try unwrapping the exceptions in
> requestcycle.onruntimeexception and call super with the page exipred
> exception.
>
> -igor
>
> On Fri, Jul 10, 2009 at 3:00 AM, Ann Baert<an...@tvh.be> wrote:
>> Hello,
>>
>> How can I throw a PageExpiredException in the constructor of my WebPage?
>> Because the exception is wrapped by Wicket with WicketRuntimeException it
>> goes to the InternalErrorPage.
>>
>> Thanks,
>> Ann
>> **** DISCLAIMER ****
>> <A HREF="http://www.tvh.be/newen/pages/emaildisclaimer.html">
>> http://www.tvh.be/newen/pages/emaildisclaimer.html </A>
>>
>> "This message is delivered to all addressees subject to the conditions
>> set forth in the attached disclaimer, which is an integral part of this
>> message."
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: How to throw new PageExpiredException?

Posted by Igor Vaynberg <ig...@gmail.com>.
you can try unwrapping the exceptions in
requestcycle.onruntimeexception and call super with the page exipred
exception.

-igor

On Fri, Jul 10, 2009 at 3:00 AM, Ann Baert<an...@tvh.be> wrote:
> Hello,
>
> How can I throw a PageExpiredException in the constructor of my WebPage?
> Because the exception is wrapped by Wicket with WicketRuntimeException it
> goes to the InternalErrorPage.
>
> Thanks,
> Ann
> **** DISCLAIMER ****
> <A HREF="http://www.tvh.be/newen/pages/emaildisclaimer.html">
> http://www.tvh.be/newen/pages/emaildisclaimer.html </A>
>
> "This message is delivered to all addressees subject to the conditions
> set forth in the attached disclaimer, which is an integral part of this
> message."
>

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