Magnolia

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

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 3.5
  • Component/s: None
  • Labels:
  • 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.

    Show
    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.
  • Environment:
    3.1-SNAPSHOT
    JBoss 4.0.5

Issue Links

Activity

Hide
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 ?

Show
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 ?
Hide
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
    
Show
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
    
Hide
Fabrizio Giustina added a comment - 19/Aug/09 10:44 AM

Solved a long time ago, by mapping the magnolia filter with ERROR dispatcher like explained by Gregory

Show
Fabrizio Giustina added a comment - 19/Aug/09 10:44 AM Solved a long time ago, by mapping the magnolia filter with ERROR dispatcher like explained by Gregory

People

Dates

  • Created:
    31/May/07 1:55 PM
    Updated:
    08/Mar/10 5:10 PM
    Resolved:
    19/Aug/09 10:44 AM