I have an app that previously displayed a list of information at a URL
like this:
/author/first_last
Now I am switching it to use an ID:
/author/25/1
Where 25 is the person id and 1 is the page of the list to display.
I'm using something like:
Object onActivate(Person person, int page) {
}
When people hit the old URL with something like:
/author/john_smith
It throws an exception. I would prefer it show a 404 or even maybe do
a lookup and redirect them.
Is there a way to catch the exception when the String gets gets turned
into a long so I can do something other than showing the user an
exception page? Alternatively is there a way to over-ride onActivate
so I can do something like:
public Object onActivate(String str) {
if(person == null) {
return new HttpError(404, "Resource Not Found");
}
return null;
}
Or is there another solution that I'm overlooking.
--Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]