How to specify html page globally in Jboss?

We have a filter that redirects the user to error.html if the user is not logged in. Right now, we keep the error.html page inside the WAR, but is there a way to make the html file publicly accessible so that every war file can access this error page? It would be even better if we made this html page a jar and saved it in server / default / lib.

Here is the sample used in the filter.

 `reqDespacher = request.getRequestDispatcher (" error.html ")`

and the access url is

http://localhost/Context_root/error.html

      

Any help would be appreciated.

+3


source to share


1 answer


In JBoss5 or JBoss6, you can copy and then define this custom one error.html

inside the /deployer/jbossweb.deployer/web.xml

server instance you are using. This will require a restart of the JBoss instance. Example of a 404 error code:

<error-page>
            <error-code>404</error-code>
            <location><relative_path_to_error_html_file_under_jbossweb.deployer_folder></location>
</error-page>

      



Second, instead of re-direction request, specifying the page manually, as it is now, you should use the directive <error-page>

and <error-code>

to define custom error pages. See specify-the-default-error-page-in-web-xml-in-servlet for a detailed example of how to add code-xx directives to an error code.

For configuring the JBoss AS7 global error page, see how-to-customize-jboss-as7-404-page .

+2


source







All Articles