Issue Details (XML | Word | Printable)

Key: MAGNOLIA-1565
Type: New Feature New Feature
Status: Open Open
Priority: Minor Minor
Assignee: Boris Kraft
Reporter: Amir Mistric
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Magnolia

Allow error pages (401,404,500 etc,etc) to be configured as Magnolia pages

Created: 31/May/07 01:55 PM   Updated: 11/Sep/08 12:03 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Environment:
3.1-SNAPSHOT
JBoss 4.0.5
Issue Links:
relation
 

Labels:
Date of First Response: 10/Sep/08 11:19 PM


 Description  « Hide
While discussing error page locations with Sameer (via dev list and support), it was suggested that this feature may make it into next version.

The goal would be to mimic web.xml error page logic where one can define an error code or exception (or both) and specify Magnolia page that should be displayed when such error/exception occurs.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Grégory Joseph added a comment - 10/Sep/08 11:19 PM
Since 3.5, the ERROR dispatcher is assigned to the main Magnolia filter by default. If that's the case in your setup too, the 404 page in your web.xml needs to be reachable through Magnolia. Typically, you could have this in your web.xml:
 
  <error-page>
    <error-code>404</error-code>
    <location>/errors/404.html</location>
  </error-page>
.. and upon request of an unexisting resource, Magnolia would serve your /error/404 page.

Now, as far as I can tell, there is no other way than mapping all error codes in web.xml - we could do so by default, and a have location like /.magnolia/error which would take care, based on some configuration, render the configured page for the different codes, but

  • is it really worth it ? i.e how much configuration will one be ready to do when it can be done directly in web.xml ? - (if there was a way to map "all" error codes to locations, I'd love it but as far as i can tell you have to map each and every error code separately)
  • as far as I can tell, when serving an error page, you can't really know what the error code and message were (unless i've missed the obvious)

Any suggestion ?


Grégory Joseph added a comment - 10/Sep/08 11:45 PM
This just in, the following request attributes are set when serving an error page:
  • when serving for a mapped error code:
        javax.servlet.error.message = NOT_FOUND
        javax.servlet.error.request_uri = /magnolia-empty-webapp/eee.html
        javax.servlet.error.servlet_name = default
        javax.servlet.error.status_code = 404
    
  • when serving for a mapped exception:
        javax.servlet.error.exception = java.lang.UnsupportedOperationException: my error message
        javax.servlet.error.exception_type = class java.lang.UnsupportedOperationException
        javax.servlet.error.message = my error message
        javax.servlet.error.request_uri = /magnolia-empty-webapp/docroot/test2.jsp
        javax.servlet.error.servlet_name = jsp
        javax.servlet.error.status_code = 500