You need to sign in to do that
Don't have an account?
index page - differentiate url rewrite vs. home page vs. 404 error handling
I am using a single index page which I call dispatcher and which decides on what to do with any incomming call. It is using a StandardController for a custom object with a controller extension and dynamically binds templates. I have a rewriter class that maps any incomming url to a custom object, if found. All that works well. However, there are a few exeptions where I am not sure as to how to distinguish them in my controller extension from any redirected pages which are:
1) the index page being called as the home page
2) the index page being called as the 404 error handling page
So, here are my questions...
A) How can I detect in the controller extension for my unified startpage that it is being called as either the home page or via 404 error handling? ...the standard behaviour being implemented via /dispatcher?id=CustomObjectId.
B) How can I, alternatively, make my url rewriter 404 status aware, such that it not only redirects to some other url but also returns a 404 http status to the client?
Cheers, Tobias.
Ok, I don't know if this is the best solution, but I made it work as follows...
1) Site.getOriginalUrl() returns a non NULL value only for urls that go unmapped by the rewriter, hence returning a 404
2) stdController.getId() is NULL when the home page is called
3) stdController.getId() is set to a valid id for any url that the rewriter class successfully maps to a custom object record
If you know of any other solutions, please post them anyways as I am not sure at all that using Site.getOriginalUrl() will always return reliable results no matter what the circumstances.