Don't forget about the "exception" event that allows a page to handle its own exceptions before they are passed off to the RequestExceptionHandler service.
On Tue, Aug 26, 2008 at 3:12 PM, Geoff Callender <[EMAIL PROTECTED]> wrote: > I'm looking for thoughts on the best way to handle this situation that > almost every page has to deal with. > > Let's say the user chose http://myhost/myapp/products/123, so the Products > page tries to get product 123 in onActivate. What if the product doesn't > exist, or the user is not authorised to view the product? I see 3 options: > > 1. Handle it on the same page - either display the product or display the > error, on the same page. > 2. Return a new page, possibly setting it up with a message. > 3. Throw an exception and interpret it in your app's exception page. The > exception page could give certain exceptions special treatment eg. > DoesNotExistException and NotAuthorisedException might get different > treatment to unexpected exceptions. > > Approach 1 has the big advantage that it keeps the same URL - the user can > see what they requested. > Approach 2 gives you complete control over the page they see but the user > can no longer see the URL they requested. > Approach 3 is really simple to implement. > > Are there other considerations? Is one of these more RESTful? > > Cheers, > Geoff > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]