Great. Thanks for your help.

On Mon, Nov 14, 2011 at 7:06 PM, Igor Vaynberg <[email protected]> wrote:
> application.getrequestcyclelisteners().add(new abstractrequestcyclelistener() 
> {
>  irequsthandler onexception(e) {
>       Throwable cause = e;
>       if (cause instanceof WicketRuntimeException) {
>           cause = cause.getCause();
>       }
>
>       if (cause instanceof InvocationTargetException) {
>           cause = cause.getCause();
>       }
>
>       if (cause instanceof WicketResourceGoneException
>               || cause instanceof ResourceGoneException) {
>           return new renderpagerequesthandler(new
> ResourceGonePage((WicketResourceGoneException)cause));
>       }
>
>       if (cause instanceof ResourceNotFoundException) {
>           return new renderpagerequesthandler(new
> NotFoundPage((ResourceNotFoundException)cause));
>       }
> });
>
> -igor
>
> On Mon, Nov 14, 2011 at 3:34 PM, Nelson Segura <[email protected]> wrote:
>> Hello,
>> I am starting to migrate from 1.4 to 1.5.
>> I am having problems trying to figure out exactly what is the best way
>> to do the following.
>>
>> I have some custom exception and some custom pages for when the code
>> throws those exception. In 1.4 this seemed trivial. For example
>>
>>
>> ......
>>
>> public class MyRequestLifecycle extends WebRequestCycle {
>>
>>    public MyRequestLifecycle(org.apache.wicket.protocol.http.WebApplication
>> application,
>>                                         WebRequest request,
>>                                         Response response) {
>>        super(application, request, response);
>>    }
>>
>>    @Override
>>    public Page onRuntimeException(Page page, RuntimeException e) {
>>        Throwable cause = e;
>>        if (cause instanceof WicketRuntimeException) {
>>            cause = cause.getCause();
>>        }
>>
>>        if (cause instanceof InvocationTargetException) {
>>            cause = cause.getCause();
>>        }
>>
>>        if (cause instanceof WicketResourceGoneException
>>                || cause instanceof ResourceGoneException) {
>>            return new ResourceGonePage((WicketResourceGoneException)cause);
>>        }
>>
>>        if (cause instanceof ResourceNotFoundException) {
>>            return new NotFoundPage((ResourceNotFoundException)cause);
>>        }
>>        return super.onRuntimeException(page, e);
>>    }
>>
>> }
>>
>>
>> But I can't figure out a clean / easy way to do this in 1.5. I seems
>> that I need to write a lot of code to accomplish this.
>>
>> I am looking at the following links:
>>
>> https://cwiki.apache.org/WICKET/migration-to-wicket-15.html
>> https://cwiki.apache.org/WICKET/requestcycle-in-wicket-15.html
>>
>> Problems are:
>> - Which class should I be extend or implementing.
>> AbstractRequestCycleListener? IExceptionMapper? IRequestHandler?
>> - How do I get access to the current page?
>> If I return a IRequestHandler, how do I create one. Do I need to
>> create one? Can I use the current one? do I need to worry if this is
>> part of an AjaxRequest? I have looked at code in
>> AbstractRequestCycleListener, SystemMapper, CompoundRequestMapper,
>> DefaultExceptionMapper, etc. It all seems too low level compared to
>> other Wicket APIs, that makes me think I am missing something.
>>
>> What should I do?
>>
>> -Nelson
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

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

Reply via email to