Tuesday, April 10, 2012

Common web.xml usages in Webcenter Portal Application

1) For Error codes like 404,401,400,500 or any other, we can redirect over application to an custom error page. The settings can be done in web.xml file as follows::

  <error-page>
    <error-code>404</error-code>
    <location>/error.html</location>
  </error-page>
  <error-page>
    <error-code>401</error-code>
    <location>/error.html</location>
  </error-page>

2) Session Timeout setting::


  <session-config>
    <session-timeout>15</session-timeout>
  </session-config>

3) Custom DataSource references::


   <resource-ref>
    <res-ref-name>jdbc/CustomDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>