Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Servlet Filter (with URL pattern) not called once deployed on AS

696639May 10 2010 — edited Jun 2 2010
Hello,

I want a certain Filter class to be executed for every jspx page, that is in the subfolder "pages" of my application. I'm using JDev/ADF version 10.1.3.3.

What I did is create a new Filter class:
public class TimeoutFilter implements Filter {
    private FilterConfig _filterConfig = null;

    public void init(FilterConfig filterConfig) throws ServletException {
        _filterConfig = filterConfig;
    }

    public void destroy() {
        _filterConfig = null;
    }

    public void doFilter(ServletRequest request, ServletResponse response, 
                         FilterChain chain) throws IOException, ServletException {
         System.out.println("in TimeoutFilter.doFilter");
         chain.doFilter(request, response);
     }
}
The Filter is also registered in the web.xml:
    ...
    <filter>
        <filter-name>TimeoutFilter</filter-name>
        <filter-class>filtertest.filter.TimeoutFilter</filter-class>
    </filter>
    ...
    <filter-mapping>
        <filter-name>TimeoutFilter</filter-name>
        <url-pattern>/pages/*</url-pattern>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    ...
When I run the application in the integrated OC4J, everything works fine. Each time a page is called in the "pages" subfolder, the filter is executed and the message is printed. From the moment that I deploy that application on a stand alone Oracle Application Server (version 10.1.2.3), the filter is not called anymore. Strangly enough, if I change the url-pattern in the web.xml to /faces/pages/*, the filter is called everytime that i LEAVE (instead of enter) a page in the "pages" subfolder. If the url-pattern is set to /*, the filter class is called for every page, as expected, both on the embedded OC4J and on the stand alone AS.

Any ideas? I don't understand why this is working fine on the embedded OC4J, but stops working once deployed. I guess it has something to do with the different version that is used in the local OC4J (10.1.3) and the AS (10.1.2). But still, the code is quite straightforward, so I would expect it to work...

Help would be appreciated!

Thanks,

Chris

Edited by: Chris Schryvers on 10-May-2010 05:08
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 30 2010
Added on May 10 2010
1 comment
1,160 views