Hi all,

For anyone wanting to serve up a 404 (or 403, or other error response page) from RIFE, here's how to do it:

0. Create your rife pages
1. Make sure you have a container that supports Servlet 2.4
2. Add <dispatcher>ERROR</dispatcher> to your filter-mapping for RIFE.
3. Add your error-page declarations which point to your RIFE pages.
4. Go get a [root] beer. :)

==[WEB-INF/web.xml]===============================================
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!-- Note: The xsi:schemeLocation has a space after ".../j2ee", and
"http://java...."; is on the same line!   It's just wrapping here. -->

<web-app  xmlns="http://java.sun.com/xml/ns/j2ee";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
        version="2.4"
>
        <filter>
                <filter-name>RIFE</filter-name>
                <filter-class>
                        com.uwyn.rife.servlet.RifeFilter
                </filter-class>
                <init-param>
                        <param-name>rep.path</param-name>
                        <param-value>rep/participants.xml</param-value>
                </init-param>
        </filter>

        <filter-mapping>
            <filter-name>RIFE</filter-name>
            <url-pattern>/*</url-pattern>
            <dispatcher>REQUEST</dispatcher>
            <dispatcher>ERROR</dispatcher>
        </filter-mapping>
        
   <error-page>
      <error-code>403</error-code>
      <location>/403</location>
   </error-page>

   <error-page>
      <error-code>404</error-code>
      <location>/404</location>
   </error-page>
</web-app>
=========================================================
==[participant sites file snippet]=======================
...
    <element id="PAGE403" extends="rife/template/print.xml" url="/403">
                <property name="name">403</property>
    </element>
    <element id="PAGE404" extends="rife/template/print.xml" url="/404">
                <property name="name">404</property>
    </element>
...
=========================================================

Requirements:
* A Servlet 2.4 compatible container (Tomcat 5.0+ and Jetty 5.1.4+ both work) * 403 and 404 here are just RIFE templates with names '403.html' and '404.html' * Shouldn't be required, but FWIW, I'm using rife-1.3.1-jdk14.jar and JDK1.5.

Other notes:
* If you'd like to use a jsp (or other servlet) to include or forward requests to RIFE, you can add 'dispatcher' elements for INCLUDE and FORWARD.

Reference:
Servlet 2.4 Specification (Final Release), Filtering SRV 6.2.5 "Filters and Requests"
http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html


Josh
--
Joshua Hansen
Up Bear Enterprises
(541) 760-7685 (new #)

_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to