Enportal/5.5/solutions customization/custom error page handlers/custom handling of http errors

Revision as of 05:59, 23 January 2014 by imported>Mylene.stolpe
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


The error pages displayed for CRS exceptions are defined by JSP files You can edit the existing files to include the customized branding and messaging that you desire, or copy them to create your own JSP files.

Error Handler Rules Files

There are five XML files in \PORTAL_HOME\xmlroot\server\crs\defaulthandlers\ which define the rules for handling standard HTTP response codes:

  1. 1XXrules.xml
  2. 2XXrules.xml
  3. 3XXrules.xml
  4. 4XXrules.xml
  5. 5XXrules.xml


These files identify which error pages to display when a particular error code is returned. The file 1XXrules.xml is for 100 error codes, 2XXrules.xml for 200 codes, and so on.

Modify Rules for CRS Error Handling

To see a sample rule for error handling, examine the following code section from the file 4XXrules.xml:

<OutputProcess order="aa2" id="setnofilejsp">
<MatchResponseCode>404</MatchResponseCode>
<SetVariable name="ERROR_JSP" findValue=".*" replaceValue="/framework/secured/crs/ex/ex_crs_nofile.jsp"/>
</OutputProcess>

The above rule indicates that when a 404 error code is received, enPortal is configured by default to execute and display \PORTAL_HOME\httproot\framework\secured\crs\ex\ex_crs_nofile.jsp. You can edit this rule to call your own custom JSP file when this error code is received. Then repeat the process for each error that you want to handle with a custom JSP.

CRS Error Pages JSPs

When there are HTTP errors in enPortal, JSP error pages are displayed to the user. These pages are located in the directory \PORTAL_HOME\httproot\framework\secured\crs\ex\. You can modify these pages to suit your needs.

It is recommended that you set up a basic template to display in all pages, and then reference that template in each of the individual JSP files. For example, looking at the default files in this folder you can see that several of the pages are currently configured to include the header from ex_crs_header.jsp. You can use a similar methodology to include your own master template in each error page. This template can include your corporate logo and other standard HTML used to standardize your pages.

Modify JSP Error Pages

To display error pages with your customized branding and message, you can either edit the default JSP files directly or create your own JSP pages to display. If you create your own JSP files, you need to change the CRS error handler files to reference your JSP files, as outlined in the above paragraph on how to Modify Rules for CRS Error Handling. It is recommended that you set up a JSP file with a basic template to display in all custom error pages, and then reference that template in each of your individual JSP files.

Template-note.png
If you make any customizations to the portal error page JSP files, these changes will not be automatically preserved when you make future upgrades to the system. Thus, you must make sure your export.properties files are properly configured to include the above changes when you run the FilesExport command.