Re: [Wicket-user] Exception Strategy in 1.3
* craigdd: Thanks Eelco, your example was extremely helpful and I agree that the API is not obvious when it comes to this type of stuff. It also doesn't help when the javadoc for RequestCycle.onRuntimeException refers to DefaultExceptionResponseStrategy which does not exist in 1.3. I just fixed this. It would be nice if you could create a JIRA issue next time for that kind of problems, and if possible the updated documentation. -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Exception Strategy in 1.3
this sure seems familiar. didn't we have a nice plan to address this a few months back? Eelco Hillenius wrote: You can return the page you want to be displayed and have full control. I know the API currently is non-obvious; I complained about this in another thread. For example, this is what I'm using for the project I'm working on: public Page onRuntimeException(Page page, RuntimeException e) { if (e instanceof AuthorizationException) { return super.onRuntimeException(page, e); } else if (e instanceof PageExpiredException) { Ts4Session session = Ts4Session.get(); if (session.isTemporary() || session.getUserId() == null) { // this was an actual session expiry log .info(session expired and request cannot be honored, cycleId: + cycleId); return super.onRuntimeException(page, e); } else { log.error(unable to find page for an active session!); // hmmm, we have a logged in user, but the page could not be // found. Fall through to display an error page or exception // page } } if (Application.DEPLOYMENT.equals(Application.get() .getConfigurationType())) { return new ErrorPage(e, page, cycleId); } else { return new ExceptionErrorPage(e, page); } } eelco Overriding the onRuntimeException does not work because you don't have access to the page that you are directing to. The page parameter in this method if the context from where the exception was thrown. -Craig Rüdiger_Schulz wrote: Make a subclass of WebRequestCycle, and override onRuntimeException(). Works like a charm for me. 2007/5/22, craigdd [EMAIL PROTECTED]: True the wicket session is mandatory, thanks for pointing that out. As for my question though, I'm looking for the best way to implement this strategy. I could override the respond method in RequestCycle, but I'd have to rewrite the given logic, which most of it I want. I'm wondering if there are any other hooks that I can implement that leaves the respond method alone but have the exception and internal page available. -Craig Mr Mean wrote: As far as i know the wicket session is mandatory in wicket but that does not mean you have to use it to store information. Other then that i see no reason why your proposed strategy should not work. Maurice On 5/22/07, craigdd [EMAIL PROTECTED] wrote: Basically what I want to do is set the internal error page to my own internal page, i.e. my login page, and add a message from the a resource bundle, .properties file, that includes an error code that is generated from an internal RuntimeException. Another requirement is that a Session is optional, meaning that this should work with or without a Session. -Craig craigdd wrote: What is the best way to implement your own exception strategy in wicket 1.3? I want to add some added logic to my application when an unexcepted exception occurs. During this added logic I want a handle on the page that is being redirected to, ie the internal error page. Thanks Craig -- View this message in context: http://www.nabble.com/Exception-Strategy-in-1.3-tf3793570.html#a10730008 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context:
Re: [Wicket-user] Exception Strategy in 1.3
On Wednesday, May 23, 2007, 2:53:50 AM, craigdd [EMAIL PROTECTED] wrote: Thanks Eelco, your example was extremely helpful and I agree that the API is not obvious when it comes to this type of stuff. It also doesn't help when the javadoc for RequestCycle.onRuntimeException refers to DefaultExceptionResponseStrategy which does not exist in 1.3. All patches welcome! It's especially useful if it's from someone like yourself who's just had to wrestle with something that's not as it should be, as that way it should be fresh as to what the sticking points were what it should be! /Gwyn - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Exception Strategy in 1.3
Will do Gwyn, I plan on spending a few hours tonight to see what type of update to the API would be needed to help out my type of situation. -Craig Gwyn wrote: On Wednesday, May 23, 2007, 2:53:50 AM, craigdd [EMAIL PROTECTED] wrote: Thanks Eelco, your example was extremely helpful and I agree that the API is not obvious when it comes to this type of stuff. It also doesn't help when the javadoc for RequestCycle.onRuntimeException refers to DefaultExceptionResponseStrategy which does not exist in 1.3. All patches welcome! It's especially useful if it's from someone like yourself who's just had to wrestle with something that's not as it should be, as that way it should be fresh as to what the sticking points were what it should be! /Gwyn - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/Exception-Strategy-in-1.3-tf3793570.html#a10790773 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Exception Strategy in 1.3
As far as i know the wicket session is mandatory in wicket but that does not mean you have to use it to store information. Other then that i see no reason why your proposed strategy should not work. Maurice On 5/22/07, craigdd [EMAIL PROTECTED] wrote: Basically what I want to do is set the internal error page to my own internal page, i.e. my login page, and add a message from the a resource bundle, .properties file, that includes an error code that is generated from an internal RuntimeException. Another requirement is that a Session is optional, meaning that this should work with or without a Session. -Craig craigdd wrote: What is the best way to implement your own exception strategy in wicket 1.3? I want to add some added logic to my application when an unexcepted exception occurs. During this added logic I want a handle on the page that is being redirected to, ie the internal error page. Thanks Craig -- View this message in context: http://www.nabble.com/Exception-Strategy-in-1.3-tf3793570.html#a10730008 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Exception Strategy in 1.3
* craigdd: I'm wondering if there are any other hooks that I can implement that leaves the respond method alone but have the exception and internal page available. Have a look at ExceptionErrorPage and IExceptionSettings -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Exception Strategy in 1.3
Make a subclass of WebRequestCycle, and override onRuntimeException(). Works like a charm for me. 2007/5/22, craigdd [EMAIL PROTECTED]: True the wicket session is mandatory, thanks for pointing that out. As for my question though, I'm looking for the best way to implement this strategy. I could override the respond method in RequestCycle, but I'd have to rewrite the given logic, which most of it I want. I'm wondering if there are any other hooks that I can implement that leaves the respond method alone but have the exception and internal page available. -Craig Mr Mean wrote: As far as i know the wicket session is mandatory in wicket but that does not mean you have to use it to store information. Other then that i see no reason why your proposed strategy should not work. Maurice On 5/22/07, craigdd [EMAIL PROTECTED] wrote: Basically what I want to do is set the internal error page to my own internal page, i.e. my login page, and add a message from the a resource bundle, .properties file, that includes an error code that is generated from an internal RuntimeException. Another requirement is that a Session is optional, meaning that this should work with or without a Session. -Craig craigdd wrote: What is the best way to implement your own exception strategy in wicket 1.3? I want to add some added logic to my application when an unexcepted exception occurs. During this added logic I want a handle on the page that is being redirected to, ie the internal error page. Thanks Craig -- View this message in context: http://www.nabble.com/Exception-Strategy-in-1.3-tf3793570.html#a10730008 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/Exception-Strategy-in-1.3-tf3793570.html#a10737906 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- greetings from Berlin, Rüdiger Schulz www.2rue.de - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Exception Strategy in 1.3
Overriding the onRuntimeException does not work because you don't have access to the page that you are directing to. The page parameter in this method if the context from where the exception was thrown. -Craig Rüdiger_Schulz wrote: Make a subclass of WebRequestCycle, and override onRuntimeException(). Works like a charm for me. 2007/5/22, craigdd [EMAIL PROTECTED]: True the wicket session is mandatory, thanks for pointing that out. As for my question though, I'm looking for the best way to implement this strategy. I could override the respond method in RequestCycle, but I'd have to rewrite the given logic, which most of it I want. I'm wondering if there are any other hooks that I can implement that leaves the respond method alone but have the exception and internal page available. -Craig Mr Mean wrote: As far as i know the wicket session is mandatory in wicket but that does not mean you have to use it to store information. Other then that i see no reason why your proposed strategy should not work. Maurice On 5/22/07, craigdd [EMAIL PROTECTED] wrote: Basically what I want to do is set the internal error page to my own internal page, i.e. my login page, and add a message from the a resource bundle, .properties file, that includes an error code that is generated from an internal RuntimeException. Another requirement is that a Session is optional, meaning that this should work with or without a Session. -Craig craigdd wrote: What is the best way to implement your own exception strategy in wicket 1.3? I want to add some added logic to my application when an unexcepted exception occurs. During this added logic I want a handle on the page that is being redirected to, ie the internal error page. Thanks Craig -- View this message in context: http://www.nabble.com/Exception-Strategy-in-1.3-tf3793570.html#a10730008 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/Exception-Strategy-in-1.3-tf3793570.html#a10737906 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- greetings from Berlin, Rüdiger Schulz www.2rue.de - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/Exception-Strategy-in-1.3-tf3793570.html#a10742036 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Exception Strategy in 1.3
You can return the page you want to be displayed and have full control. I know the API currently is non-obvious; I complained about this in another thread. For example, this is what I'm using for the project I'm working on: public Page onRuntimeException(Page page, RuntimeException e) { if (e instanceof AuthorizationException) { return super.onRuntimeException(page, e); } else if (e instanceof PageExpiredException) { Ts4Session session = Ts4Session.get(); if (session.isTemporary() || session.getUserId() == null) { // this was an actual session expiry log .info(session expired and request cannot be honored, cycleId: + cycleId); return super.onRuntimeException(page, e); } else { log.error(unable to find page for an active session!); // hmmm, we have a logged in user, but the page could not be // found. Fall through to display an error page or exception // page } } if (Application.DEPLOYMENT.equals(Application.get() .getConfigurationType())) { return new ErrorPage(e, page, cycleId); } else { return new ExceptionErrorPage(e, page); } } eelco Overriding the onRuntimeException does not work because you don't have access to the page that you are directing to. The page parameter in this method if the context from where the exception was thrown. -Craig Rüdiger_Schulz wrote: Make a subclass of WebRequestCycle, and override onRuntimeException(). Works like a charm for me. 2007/5/22, craigdd [EMAIL PROTECTED]: True the wicket session is mandatory, thanks for pointing that out. As for my question though, I'm looking for the best way to implement this strategy. I could override the respond method in RequestCycle, but I'd have to rewrite the given logic, which most of it I want. I'm wondering if there are any other hooks that I can implement that leaves the respond method alone but have the exception and internal page available. -Craig Mr Mean wrote: As far as i know the wicket session is mandatory in wicket but that does not mean you have to use it to store information. Other then that i see no reason why your proposed strategy should not work. Maurice On 5/22/07, craigdd [EMAIL PROTECTED] wrote: Basically what I want to do is set the internal error page to my own internal page, i.e. my login page, and add a message from the a resource bundle, .properties file, that includes an error code that is generated from an internal RuntimeException. Another requirement is that a Session is optional, meaning that this should work with or without a Session. -Craig craigdd wrote: What is the best way to implement your own exception strategy in wicket 1.3? I want to add some added logic to my application when an unexcepted exception occurs. During this added logic I want a handle on the page that is being redirected to, ie the internal error page. Thanks Craig -- View this message in context: http://www.nabble.com/Exception-Strategy-in-1.3-tf3793570.html#a10730008 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -- View this message in context: http://www.nabble.com/Exception-Strategy-in-1.3-tf3793570.html#a10737906 Sent from the Wicket - User mailing list archive at Nabble.com.
Re: [Wicket-user] Exception Strategy in 1.3
Thanks Eelco, your example was extremely helpful and I agree that the API is not obvious when it comes to this type of stuff. It also doesn't help when the javadoc for RequestCycle.onRuntimeException refers to DefaultExceptionResponseStrategy which does not exist in 1.3. Thanks Craig Eelco Hillenius wrote: You can return the page you want to be displayed and have full control. I know the API currently is non-obvious; I complained about this in another thread. For example, this is what I'm using for the project I'm working on: public Page onRuntimeException(Page page, RuntimeException e) { if (e instanceof AuthorizationException) { return super.onRuntimeException(page, e); } else if (e instanceof PageExpiredException) { Ts4Session session = Ts4Session.get(); if (session.isTemporary() || session.getUserId() == null) { // this was an actual session expiry log .info(session expired and request cannot be honored, cycleId: + cycleId); return super.onRuntimeException(page, e); } else { log.error(unable to find page for an active session!); // hmmm, we have a logged in user, but the page could not be // found. Fall through to display an error page or exception // page } } if (Application.DEPLOYMENT.equals(Application.get() .getConfigurationType())) { return new ErrorPage(e, page, cycleId); } else { return new ExceptionErrorPage(e, page); } } eelco Overriding the onRuntimeException does not work because you don't have access to the page that you are directing to. The page parameter in this method if the context from where the exception was thrown. -Craig Rüdiger_Schulz wrote: Make a subclass of WebRequestCycle, and override onRuntimeException(). Works like a charm for me. 2007/5/22, craigdd [EMAIL PROTECTED]: True the wicket session is mandatory, thanks for pointing that out. As for my question though, I'm looking for the best way to implement this strategy. I could override the respond method in RequestCycle, but I'd have to rewrite the given logic, which most of it I want. I'm wondering if there are any other hooks that I can implement that leaves the respond method alone but have the exception and internal page available. -Craig Mr Mean wrote: As far as i know the wicket session is mandatory in wicket but that does not mean you have to use it to store information. Other then that i see no reason why your proposed strategy should not work. Maurice On 5/22/07, craigdd [EMAIL PROTECTED] wrote: Basically what I want to do is set the internal error page to my own internal page, i.e. my login page, and add a message from the a resource bundle, .properties file, that includes an error code that is generated from an internal RuntimeException. Another requirement is that a Session is optional, meaning that this should work with or without a Session. -Craig craigdd wrote: What is the best way to implement your own exception strategy in wicket 1.3? I want to add some added logic to my application when an unexcepted exception occurs. During this added logic I want a handle on the page that is being redirected to, ie the internal error page. Thanks Craig -- View this message in context: http://www.nabble.com/Exception-Strategy-in-1.3-tf3793570.html#a10730008 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list
Re: [Wicket-user] Exception Strategy in 1.3
Basically what I want to do is set the internal error page to my own internal page, i.e. my login page, and add a message from the a resource bundle, .properties file, that includes an error code that is generated from an internal RuntimeException. Another requirement is that a Session is optional, meaning that this should work with or without a Session. -Craig craigdd wrote: What is the best way to implement your own exception strategy in wicket 1.3? I want to add some added logic to my application when an unexcepted exception occurs. During this added logic I want a handle on the page that is being redirected to, ie the internal error page. Thanks Craig -- View this message in context: http://www.nabble.com/Exception-Strategy-in-1.3-tf3793570.html#a10730008 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user