Servlet Filter uri-pattern

Hello!
I need to do the following:
- apply a servlet-filter to all files in a directory
- NOT apply that filter to the sub-derictories.
I'm using Tomcat 5.5.
What should be the uri-pattern of that filter? Is there some directive for "Exclude"?
Thanks

Read the spec. IIRC you can also specify extension-based criteria:
<filter-mapping>
<filter-name>servletstatfilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>

Similar Messages

  • Servlet Filters/url patterns with WLS 8

    Hello,
    I am trying to use filters to do some pre processing before my web service
    is invoked. It seems the doFilter() method does not seem to be getting invoked.
    The init() method is getting invoked as I see print statements in the log file.
    I am not sure if the url-pattern is correct and I am enclosing the web.xml file
    here along with relevant lines from web-services.xml and application.xml.In access.log
    I do see HTTP calls to the web service.
    Any help would be appreciated.
    <web-app>
    <filter>
    <filter-name>l10nWebServiceFilter</filter-name>
    <filter-class>com.globalsight.dotNet.L10nWebServiceFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>l10nWebServiceFilter</filter-name>
    <url-pattern>/l10nWebService/*</url-pattern>
    </filter-mapping>
    </web-app>
    From web-services.xml -
    web-service useSOAP12="false" targetNamespace="http://localhost:7001/L10nWebServiceEJB"
    name="L10nWebServiceEJB" style="rpc" uri="/L10nWebServiceEJB">
    and from application.xml -
    <application>
    <display-name></display-name>
    <module>
    <web>
    <web-uri>l10nWebService.war</web-uri>
    <context-root>l10nWebService</context-root>
    </web>
    </module>
    <module>
    <ejb>cap_ssb.jar</ejb>
    </module>
    </application>

    Hi Aswin,
    I think the problem may be in your Servlet Filter code :-)
    The last line in your doFilter() method should be:
    filterChain.doFilter(servletRequest, servletResponse);
    I have attached a small zip that uses a ServletFilter to get around situations,
    where the WLS web services stack/tools has problems dynamically generating the
    WSDL I want to present to the "outside world". It (the zip) contains a web.xml
    that illustrates how to set the <url-pattern>. This web.xml goes with the web-services.xml
    in the web services' .war, but the ServletFilter is "generic" :-)
    HTH,
    Mike Wooten
    "Aswin Dinakar" <[email protected]> wrote:
    >
    Changing the url-pattern to /* solved the problem and the doFilter()
    method is
    being called. However the webservice is not being invoked now. Is there
    any changes
    to web-services.xml that I need to make that after the doFilter() code
    is invoked
    the webservice methods would be invoked ?
    Thanks,
    Aswin.
    "Aswin Dinakar" <[email protected]> wrote:
    Hello,
    I am trying to use filters to do some pre processing beforemy
    web service
    is invoked. It seems the doFilter() method does not seem to be getting
    invoked.
    The init() method is getting invoked as I see print statements in the
    log file.
    I am not sure if the url-pattern is correct and I am enclosing the web.xml
    file
    here along with relevant lines from web-services.xml and application.xml.In
    access.log
    I do see HTTP calls to the web service.
    Any help would be appreciated.
    <web-app>
    <filter>
    <filter-name>l10nWebServiceFilter</filter-name>
    <filter-class>com.globalsight.dotNet.L10nWebServiceFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>l10nWebServiceFilter</filter-name>
    <url-pattern>/l10nWebService/*</url-pattern>
    </filter-mapping>
    </web-app>
    From web-services.xml -
    web-service useSOAP12="false" targetNamespace="http://localhost:7001/L10nWebServiceEJB"
    name="L10nWebServiceEJB" style="rpc" uri="/L10nWebServiceEJB">
    and from application.xml -
    <application>
    <display-name></display-name>
    <module>
    <web>
    <web-uri>l10nWebService.war</web-uri>
    <context-root>l10nWebService</context-root>
    </web>
    </module>
    <module>
    <ejb>cap_ssb.jar</ejb>
    </module>
    </application>
    [webservice_servlet_filter.zip]

  • Strange behavior when using servlet filter with simple index.htm

    I am new to J2EE development so please tolerate my ignorance. I have a web application that starts with a simple index.htm file. I am using a servlet filter throughout the website to check for session timeout, redirecting the user to a session expiration page if the session has timed out. When I do something as simple as loading the index.htm page in the browser, the .css file and one image file that are associated, or referenced in the file are somehow corrupted and not being rendered. How do I get the filter to ignore css and image files??? Thank you!!
    The servlet filter:
    import java.io.IOException;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class SessionTimeoutFilter implements Filter {
         String[] excludedPages = {"SessionExpired.jsp","index.htm","index.jsp"};
         String timeoutPage = "SessionExpired.jsp";
         public void destroy() {
         public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
              if ((request instanceof HttpServletRequest) && (response instanceof HttpServletResponse)) {
                   HttpServletRequest httpServletRequest = (HttpServletRequest) request;
                   HttpServletResponse httpServletResponse = (HttpServletResponse) response;
                   //httpServletResponse.setHeader("Cache-Control","no-cache");
                   //httpServletResponse.setHeader("Pragma","no-cache");
                   //httpServletResponse.setDateHeader ("Expires", 0);
                   String requestPath = httpServletRequest.getRequestURI();
                   boolean sessionInvalid = httpServletRequest.getSession().getAttribute("loginFlag") != "loggedIn";               
                   System.out.println(sessionInvalid);
                   boolean requestExcluded = false;
                   System.out.println(requestExcluded);
                   for (int i=0;i<excludedPages.length;i++){
                        if(requestPath.contains(excludedPages)){
                             requestExcluded = true;
                   if (sessionInvalid && !requestExcluded){
                        System.out.println("redirecting");
                        httpServletResponse.sendRedirect(timeoutPage);
              // pass the request along the filter chain
              chain.doFilter(request, response);
         public void init(FilterConfig arg0) throws ServletException {
              //System.out.println(arg0.getInitParameter("test-param"));
    The index.htm file (or the relevant portion)<HTML>
    <Head>
    <META http-equiv="Content-Style-Type" content="text/css">
    <LINK href="RTEStyleSheet.css" rel="stylesheet" type="text/css">
    <TITLE>Login</TITLE>
    </HEAD>
    <BODY>
    <FORM NAME="Login" METHOD="POST" ACTION="rte.ServletLDAP"><!-- Branding information -->
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
         <tr>
              <td width="30%" align="left"><img src="images/top_logo_new2.gif">
              </td>
              <td width="37%" align="center"></td>
              <td width="33%" align="right"></td>
         </tr>
    </table>
    My web.xml entry for the filter:     <filter>
              <description>
              Checks for a session timeout on each user request, redirects to logout if the session has expired.</description>
              <display-name>
              SessionTimeoutFilter</display-name>
              <filter-name>SessionTimeoutFilter</filter-name>
              <filter-class>SessionTimeoutFilter</filter-class>
              <init-param>
                   <param-name>test-param</param-name>
                   <param-value>this is a test parameter</param-value>
              </init-param>
         </filter>
         <filter-mapping>
              <filter-name>SessionTimeoutFilter</filter-name>
              <url-pattern>/*</url-pattern>
              <dispatcher>REQUEST</dispatcher>
              <dispatcher>FORWARD</dispatcher>
         </filter-mapping>

    Hi,
    Try adding CSS files and images to the excluded Pages.

  • ADF Bindings Servlet/Filter  not invoking  Faces Servlet

    I'm getting ADF Faces and Facelets working properly with pages written in jspx format, but the Faces Servlet being mapped to jsf format.
    The problem I'm getting is while displaying ADF Tables with data retrieved from the database using Toplink and bindings provided by ADF Databindings.
    The following is the Web.xml mappings for Faces Servlet and ADF bindings filter:
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/adf/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <filter>
    <filter-name>adfBindings</filter-name>
    <filter-class>oracle.adf.model.servlet.ADFBindingFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <url-pattern>*.jspx</url-pattern>
    </filter-mapping>
    I'm getting the ADF tables displayed using ADF Bindings, if the faces servlet is mapped for jspx format;but, at the cost of losing Facelets...Facelets is not working with Faces Servlet mapped to jspx format(though written in jspx format, the faces servlet mappping has to be made for jsf format.On the other hand, if I use faces servlet mapping for jsf pages I'm getting Facelets working but ADF Databindings are not working ,(I guess) and hence ADF Faces Tables are not being displayed(I'm getting Access Denied message).
    I even tried to change the ADF binding filter mappings
    ---- from ---- jsp &jspx---- to ----- jsp and jsf ----
    But I got the same Access denied message.
    I read a similar post on this forum by Mr.Ashish Kumar who said he is using java script and automatic form submission, to refresh the page and that gave him the table working.
    as quoted in the post:
    af:table displays Access Denied
    Why should the page be refreshed at all. I Guess , the Faces Servlet is not being invoked by the ADF Bindings Filter/Servlet, and for this , I suppose , Mr.Ashish is using java script to provide the action required.
    And one more thing which that Automatic Refreshing of page using JavaScript cannot do.
    Suppose,
    I need customised display, rather than just a Table or Form,like:
    public String getEmp() {
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding =
    bindings.getOperationBinding("findAllEmp");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    List<Emp> res=(List<Emp>)result;
    for(int i=0;i<res.size();i++)
    Emp myrec=res.get(i);
    System.out.println("Employee ["+myrec.getEname()+"], Salary ["+myrec.getSal()+"]");
    return "";
    where I do some customisation in the backing bean.
    and I call that method binded to a button as below:
    <af:commandButton
    text="findAllEmp"
    disabled="#{!bindings.findAllEmp.enabled}"
    binding="#{backing_Success.commandButton1}"
    id="commandButton1"
    action="#{backing_Success.getEmp}"/>
    What I'm getting is a disabled button.
    Why doesn't ADF bindings servlet invoke the faces Servlet?
    Can't we make ADF Bindings Servlet invoke Faces Servlet by configuring in the web.xml?
    Can't we get ADF Bindings filter mapped to work with jsf pages?
    Won't ADF Bindings work with jsf pages, will they work only with jspx pages?
    ADF Team,
    Please Help me.
    Thanking you,
    Samba

    Hi! Frank,
    Thankyou for your Reply.
    Yes, Mr.Adam Winer has contributed that library, I guess.
    But I already have that adf-facelets.jar in my lib folder ; and with out that the Facelets won't work with ADF faces , in the first place.
    I'm getting Facelets working excellently with ADF Faces but I'm not getting ADF Bindings working with Faceletpages.
    The thing is even in another application which does not have facelets in it, if we use mapping for jsf pages, ADF Bindings are not working.
    I think the ADF bindings filter is configured some where to work with jspx pages only.Could you tell me where to change that entry to make ADF Bindings work with jsf extension?
    Thanking you,
    Samba.

  • How to Add a Servlet Filter to Reports 11.1.1.2.0

    I am running Fusion Middleware 11g (Weblogic 10.3.2), with Oracle Forms/Reports 11.1.1.2.0. The installation is running the default managed servers WLS_FORMS and WLS_REPORTS.
    How can I add a Servlet Filter to the Reports 11.1.1.2.0 application which is running under the WLS_REPORTS managed server?
    I have read the Oracle Doc ID: 418366.1, which describes a process for adding a servlet filter to Reports Developer 10.1.2.2, but I am unclear as to which web.xml file I need to modify in weblogic and where to place the class file for the servlet filter.
    Thanks in advance for your help.

    I can provide some partial help.
    The set up I have was running it locally on Windows 7 (64 bit) laptop and running the reports server (version 11.1.1.4) in XP Mode as part of Windows 7 Professional.
    To find which web.xml file to change, I searched the directories for web.xml and then removed then renamed the web.xml files to something else to see which impacted the start up of the reports server.
    It turns out it was a web.xml file in web.war file in the following directory which impacted the start up:
    C:\Oracle\Middleware\user_projects\domains\ClassicDomain\servers\WLS_REPORTS\tmp\_WL_user\reports_11.1.1.2.0\1ww4ab
    So used winzip to extract files, update web.xml file and and java class as a jar file in the WEB-INF\lib directory and zipped back up to a web.war and put it in the above directory and restarted the Reports Server.
    Note the url pattern I used was slightly different to that shown in the oracle note (forward slash before asterix):
    <url-pattern>/rwservlet/*</url-pattern>
    Have not investigated how to do in for a production environment, but hopefully this information is of use.
    Les.

  • Servlet Filter

    Hi, all
    I work on a web application running on a Jboss server and i would like to filter all the http request in order to save it in a database. (i save those informations for manage web stats).
    I suppose i may use servlet filter, but i don't know the operation of this
    Does anyone could help me giving some example and the protocol to set up this on the server (file server configuration as web.xml)

    Well here is what I know. I hope it helps.....
    First thing is to create a class that implements the "javax.servlet.Filter" interface. But there are also other Filter interfaces that you could use depending on what you want: Filter, FilterChain, and FilterConfig.
    You have to implement the init(), destroy() and doFilter() methods (I ommitted the arguments).
    But most of your work will be done in the doFilter () method. You could extract request information from one of the arguments in these method and have a datasource connection to save to your back-end.
    Something like :
    public void doFilter( ServletRequest request, ServletResponse responce, FilterChain chain ) throws  ServletException {
          HttpServletRequest httpRequest = (HttpServletRequest) request;
          backEndDelegate.saveInformation(  request.getRemoteAddr(),  request.getRemoteHost() );
          chain.doFilter( request, responce );
    }Second, you need to configure the Filter. In the web.xml file add the following tags:
    <filter>
         <filter-name>StatsFilter</filter-name>
          <description>Logs Web Stats to the back end</description>
         <filter-class>com.yourpackage.StatsFilter</filter-class>
         <!--  you can also pass parameters to the StatsFilter -->
          <!--
           <init-param>
                   <param-name>some parameter</param-name>
                   <param-value>some parameter</param-value>
            </init-param>
            -->
    </filter>
    <filter-mapping>
          <filter-name>StatsFilter</filter-name>
          <filter-pattern>*.jsp</filter-pattern>
    </filter-mapping>That is just a little example. You can associate a filter with a Servlet using the <filter-mapping> tags too. And you can also do filter chains, but I don't feel like going there.
    I sure hope that it was helpful. If not then "RTFM"

  • Servlet filter - ClassNotFoundException

    Hi,
    I am trying to create and deploy a servlet filter in portal irj.
    Here is what I have done:
    1. Created filter class(TestFilter.java).
    2. Created a jar file for the above TestFilter.class.
    3. Copied the jar file to C:\usr\sap\DW1\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\lib folder
    4. Modified the web.xml file under C:\usr\sap\DW1\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF folder with the following lines:
    <filter>
    <filter-name>TestFilter</filter-name>
    <display-name>TestFilter</display-name>
    <description>
    </description>
    <filter-class>com.test.TestFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>TestFilter</filter-name>
    <url-pattern>/irj/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>TestFilter</filter-name>
    <servlet-name>prt</servlet-name>
    </filter-mapping>
    5.  I did reference the library in Visual Admin:  library:TestFilter
    6.  Also created the directory under ext/TestFilter and copied the jar file here.
    7. Restarted the engine.
    Exception the logs
    Cannot load filter <TestFilter>  The error is java.lang.ClassNotFoundException:  com.test.TestFilter
    Loader Info----
    I don't see my .jar displayed in the loader info.  irj didn't like my .jar.
    Any additional changes for irj to make it understand the new .jar file for classloader. 
    Appreciate your response.
    Message was edited by:
            Anant

    Hi I was wondering if you had any luck with this issues.
    Thank you.

  • Servlet filter in portal irj?

    Hi,
    I am trying to create and deploy a servlet filter in portal irj.
    Here is what I have done:
    1. Created filter class(TestFilter.java).
    2. Created a jar file for the above TestFilter.class.
    3. Copied the jar file to C:\usr\sap\DW1\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\lib folder
    4. Modified the web.xml file under C:\usr\sap\DW1\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF folder with the following lines:
      <filter>
        <filter-name>TestFilter</filter-name>
        <display-name>TestFilter</display-name>
        <description>
        </description>
        <filter-class>com.test.TestFilter</filter-class>
      </filter>
      <filter-mapping>
        <filter-name>TestFilter</filter-name>
        <url-pattern>/irj/*</url-pattern>
      </filter-mapping>
      <filter-mapping>
        <filter-name>TestFilter</filter-name>
        <servlet-name>prt</servlet-name>
      </filter-mapping>
    5. Restarted the engine.
    But still my filter doesnot get called. Am I missing something?

    i am trying out the sample filter and did the same steps as you mentioned above. 
    I get the following exception.  Looks like the irj didn't recognize the .jar file placed inside the lib.
    I am using EP 6.0.
    Stack Trace
    ===========
    Cannot load filter < com.test.TestFilter > The error is: java.lang.ClassNotFoundException: com.test.TestFilter
    Any additional steps to be done for irj to recognize this library.  The exception also shows the other libraries used during loading the application.  I didn't find mine in the list.
    Appreciate ur help
    Message was edited by:
            Anant

  • Jrun Servlet Filter Issue

    Hi,
    I am using the below filter mapping
    <filter-mapping>
    <filter-name>jscomments</filter-name>
    <url-pattern>*.js</url-pattern>
    </filter-mapping>
    This Mapping works on my local linux dev box but I deploy it
    on our acceptance machines, the Filter does not kick in. I am not
    sure if all the static files(like js, html, etc) are being served
    by any Webservers like Apache, IIS or if there is any mistake with
    my mappings. I do not any Jrun Admin experience.
    If any one had any similar issues in the past, please let me
    know ASAP of any fix you might have.
    Thanks
    Alusac

    Yes, I am using 2.4.
    The filter that is not involed is defined:
    <filter>
    <filter-name>Authenticator</filter-name>
    <filter-class>com.authentication.Authenticate</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>Authenticator</filter-name>
    <servlet-name>UserService</servlet-name>
    </filter-mapping>
    and the servlet is:
    <servlet id="Servlet_1">
    <servlet-name>UserService</servlet-name>
    <display-name>User Services</display-name>
    <servlet-class>com.user.UserServices</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping id="Mapping_1">
    <servlet-name>UserService</servlet-name>
    <url-pattern>/User</url-pattern>
    </servlet-mapping>

  • [javax.servlet.Filter] can i apply multiple jsp & servlet to a filter?

    i have try to applied multiple jsp page & it runs correctly.
    my descriptor is like this:
        <filter-mapping>
            <filter-name>AnonymousFilter</filter-name>
            <url-pattern>/user/a.jsp</url-pattern>     
            <url-pattern>/user/b.jsp</url-pattern>
            <url-pattern>/user/c.jsp</url-pattern>       
        </filter-mapping>now i want to add a servlet, but that filter is not executed...
    i have tried descriptor like this:
        <filter-mapping>
            <filter-name>AnonymousFilter</filter-name>
            <url-pattern>/user/a.jsp</url-pattern>     
            <url-pattern>/user/b.jsp</url-pattern>
            <url-pattern>/user/c.jsp</url-pattern>       
            <servlet-name>dServlet</servlet-name>
        </filter-mapping>and like this:
        <filter-mapping>
            <filter-name>AnonymousFilter</filter-name>
            <url-pattern>/user/a.jsp</url-pattern>     
            <url-pattern>/user/b.jsp</url-pattern>
            <url-pattern>/user/c.jsp</url-pattern>       
        </filter-mapping>
        <filter-mapping>
            <filter-name>AnonymousFilter</filter-name>
            <servlet-name>dServlet</servlet-name>
        </filter-mapping>both are not work...
    is the descriptor wrong? what is the correct descriptor?
    thank you.

    i forgot about dispatcher type...
    the servlet is accessed via FORWARD
    & i map the servlet to /WEB-INF/dServlet...
    it is wrong? but the servlet is accessible...
        <servlet-mapping>
            <servlet-name>dServlet</servlet-name>
            <url-pattern>/WEB-INF/dServlet</url-pattern>
        </servlet-mapping>the web.xml now is:
        <filter-mapping>
            <filter-name>AnonymousFilter</filter-name>
            <url-pattern>/user/a.jsp</url-pattern>     
        </filter-mapping>
        <filter-mapping>
            <filter-name>AnonymousFilter</filter-name>
            <url-pattern>/user/b.jsp</url-pattern>
        </filter-mapping>
        <filter-mapping>
            <filter-name>AnonymousFilter</filter-name>
            <url-pattern>/user/c.jsp</url-pattern>       
        </filter-mapping>
        <filter-mapping>
            <filter-name>AnonymousFilter</filter-name>
            <servlet-name>dServlet</servlet-name>
            <dispatcher>FORWARD</dispatcher>
        </filter-mapping>i put this inside the filter:
    System.out.println(System.out.println("Anonymous Filter > " + httpRequest.getRequestURI());& hopelessly when i access from a.jsp, b.jsp, c.jsp the filter do print in System.out. but not from servlet...
    someone please help me...

  • Weblogic.utils.NestedRuntimeException when using javax.servlet.Filter

    IDE: JDev 10gR3.4 & JDev 11gR2.3
    ViewController technology: JSF/ADF Faces
    Example code flow:
    Run page2.jsf
    MyFilter intercepts request, checks for parameter on session.
    If parameter not null, goto page2.jsf
    Else redirect to page1.jsf
    page1.jsf has a button that sets the value on the session scope after clicking.
    In jdev 11gR2.3, I get an weblogic.utils.NestedRuntimeException after clicking the button on page1.jsf. This error does not occur in jdev 10gR3.5. Although the application continues to execute and proper info is displayed, I’m wondering why this occurs and also if I should be concerned. Has anyone experienced a similar issue when using javax.servlet.Filter in 11g?
    MyFilter code snipet:
        public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) {
            try {
                HttpServletRequest httpRequest = (HttpServletRequest)servletRequest;
                HttpServletResponse httpResponse = (HttpServletResponse)servletResponse;
                String redirect = httpRequest.getContextPath() + "/faces/page1.jsf"; //only difference here is 11g uses jsf, 10g uses jsp.
                String uri = httpRequest.getRequestURI().toString();
                Boolean mySessionAttribute = (Boolean)httpRequest.getSession().getAttribute("MYSESSIONATTRIBUTE");
                if (uri.endsWith(redirect) || mySessionAttribute != null) {
                    filterChain.doFilter(servletRequest, servletResponse);
                } else {
                    httpResponse.sendRedirect(redirect);
                    return;
            } catch (IOException e) {
                e.printStackTrace();
            } catch (ServletException e) {
                e.printStackTrace();
    page1.jsf/jsp
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
        <h:form id="f1">
            <h:commandButton value="Submit" id="cb1" action="#{Page1Bean.clicked}" type="submit"/>
        </h:form>
    </f:view>page2.jsf/jsp
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
        <af:document title="main.jsf" id="d1">
            <af:form id="f1">
                <af:outputText value="This is the main content" id="ot1"/>
            </af:form>
        </af:document>
    </f:view>Page1Bean.java
    public class Page1Bean {
        public void clicked() {       
            FacesContext context = FacesContext.getCurrentInstance();
            ExternalContext externalContext = context.getExternalContext();
            externalContext.getSessionMap().put("MYSESSIONATTRIBUTE", Boolean.TRUE);
            try {
                externalContext.redirect("/11gFilterExample-ViewController-context-root/faces/page2.jsf");
            } catch (IOException e) {
                    e.printStackTrace();
    }Full exception
    weblogic.utils.NestedRuntimeException: Cannot parse POST parameters of request: '/11gFilterExample-ViewController-context-root/faces/page1.jsf'
         at weblogic.servlet.internal.ServletRequestImpl$RequestParameters.mergePostParams(ServletRequestImpl.java:2144)
         at weblogic.servlet.internal.ServletRequestImpl$RequestParameters.parseQueryParams(ServletRequestImpl.java:2024)
         at weblogic.servlet.internal.ServletRequestImpl$RequestParameters.getQueryParams(ServletRequestImpl.java:1918)
         at weblogic.servlet.internal.ServletRequestImpl$RequestParameters.getParameter(ServletRequestImpl.java:1995)
         at weblogic.servlet.internal.ServletRequestImpl$RequestParameters.access$800(ServletRequestImpl.java:1817)
         at weblogic.servlet.internal.ServletRequestImpl.getParameter(ServletRequestImpl.java:804)
         at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:169)
         at org.apache.myfaces.trinidadinternal.context.external.ServletRequestParameterMap.getAttribute(ServletRequestParameterMap.java:43)
         at org.apache.myfaces.trinidadinternal.context.external.ServletRequestParameterMap.getAttribute(ServletRequestParameterMap.java:31)
         at org.apache.myfaces.trinidadinternal.context.external.AbstractAttributeMap.get(AbstractAttributeMap.java:73)
         at oracle.adfinternal.controller.state.ControllerState.getRootViewPortFromRequest(ControllerState.java:788)
         at oracle.adfinternal.controller.state.AdfcContext.initialize(AdfcContext.java:185)
         at oracle.adfinternal.controller.state.AdfcContext.initialize(AdfcContext.java:79)
         at oracle.adfinternal.controller.application.AdfcConfigurator.beginRequest(AdfcConfigurator.java:53)
         at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl._startConfiguratorServiceRequest(GlobalConfiguratorImpl.java:562)
         at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.beginRequest(GlobalConfiguratorImpl.java:212)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:174)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.net.SocketException: Connection reset
         at java.net.SocketInputStream.read(SocketInputStream.java:168)
         at weblogic.servlet.internal.PostInputStream.read(PostInputStream.java:177)
         at weblogic.servlet.internal.ServletInputStreamImpl.read(ServletInputStreamImpl.java:228)
         at weblogic.servlet.internal.ServletRequestImpl$RequestParameters.mergePostParams(ServletRequestImpl.java:2118)
         ... 39 more
    <UIXEditableValue> <_isBeanValidationAvailable> A Bean Validation provider is not present, therefore bean validation is disabled

    I dont believe that solution pertains to my case. clicked() is invoked from standard jsf page and the adf controller is not acquired yet. i put a couple of print statements in the filter and it seems that the doFilter is called twice! This is not the case when running in 10g.
                if (uri.endsWith(redirect) || mySessionAttribute != null) {
                    System.out.println("URI dofilter: "+uri);
                    filterChain.doFilter(servletRequest, servletResponse);
                } else {
                    System.out.println("URI sendRedirect: "+uri);
                    httpResponse.sendRedirect(redirect);              
                }11g weblogic console log:
    URI sendRedirect: /11gFilterExample-ViewController-context-root/faces/page2
    URI dofilter: /11gFilterExample-ViewController-context-root/faces/page1.jsf
    URI dofilter: /11gFilterExample-ViewController-context-root/faces/page1.jsf
    10g oc4j console log:
    13/01/07 15:48:13 URI sendRedirect: /10gFilterExample-ViewController-context-root/faces/page2.jsp
    13/01/07 15:48:13 URI dofilter: /10gFilterExample-ViewController-context-root/faces/page1.jsp
    I believe whatever thats causing this occur could be why the exception is thrown...

  • Servlet filter is not protecting html files

    Hi All,
    I am using Iplanet web server 6.0 SP4 with JDK v1.3.1_06. I am able to protect the JSP page using the servlet filter. But when I try to access the html files then filter is not getting invoked. The content of web-apps.xml is given below :-
    <web-app>
    <filter>
    <filter-name>TestIntercepto</filter-name>
    <filter-class>testinterceptor</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>TestInterceptor</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    </web-app>
    Can you guys tell me the reason ?

    I don't know much about IPlanet but with Apache/Tomcat it is possible to configure Apache to serve static content from a web application (eg: non-JSP pages) which would mean that Tomcat was never able to intercept the request for the page in the first place. Just a though.

  • Set Roles in servlet filter

    How can I set the user's role in the request object in a servlet filter
    so that in my action class, i can query the role using
    request.isUserInRole() and request.getUserPrinciple() methods.
    Any ideas...
    Thanks,

    How can I set the user's role in the request object
    in a servlet filter
    so that in my action class, i can query the role
    using
    request.isUserInRole() and request.getUserPrinciple()
    methods.You may want to check out JAAS in the Creator tutorial:
    http://developers.sun.com/prodtech/javatools/jscreator/ea/jsc2/reference/sampleapps/

  • Servlet filter problem

    I've written a simple servlet filter to intercept a request to another servlet. So when the user tries to access /servlet/ViewMetadata servlet, they first hit InterceptServlet, the filter configured in Tomcat.
    I need to access the name and URL of the target servlet ViewMetada within InterceptServlet but don't know how to do this. I am familiar with HttpServletRequest.getServletPath() but doFilter uses ServletRequest as its argument.
    Can I obtain the target servlet name inside the filter servlet? I know this is probably very basic!
    Arc

    If the filter is invoked by a HttpServletRequest, then the ServletRequest handle you've in the filter is just an instance of HttpServletRequest.
    Cast it back.

  • Servlet Filter not working in Oracel9iAS(9.2.0.3)

    Hi,
    May i know what cause the servlet filter not workinng in Oracle9iAS? Is there any library files missing? I have tried deploy the war file in Tomcat but is working fine but when i try to deploy in Oracle9iAS, the application seems like can't call the servlet filter.
    Please advice.
    Thanks.
    Regards,
    Ming Jade

    I'm not exactly sure what version you are using.
    Servlet Filters were introduced in Servlet 2.3 which was part of J2EE 1.3.
    Oracle9iAS 9.0.2.3 is J2EE 1.2 compatible .
    Oracle Application Server 10g 9.0.4.x and 10.1.2 is J2EE 1.3 compatible
    Oracle Application Server 10g 10.1.3 is J2EE 1.4 compatible.
    So the problem could be that the version of the product you are using does does not support the version of the servlet spec that covers Servlet Filters.
    Can you upgrade to/install the 10.1.2 release as a minimum?
    cheers
    -steve-

Maybe you are looking for

  • Any idea when FCP 7 will be released or what apple is working on?

    any idea when FCP 7 will be released? does anyone have a link to any info regarding FCP 7?

  • Error in idoc process

    I am new to EDI / IDOC. Manual bill is not being created. In TCODE EA18 I am facing an error that the EDI 810 failed to process , idoc - Application document not posted - Datex Process Error. Can anyone suggest me what to do for resolving this error.

  • 100 percent width issue with smaller windows

    It took me many times to try and submit this, perhaps as the title had the percent sign? I kept getting the system errors and logging out automatically (see system error below) even though other similar posts have the % sign in the title.  So I am tr

  • IMac power problems?

    Sinse upgrading to Snow Leopard, I've been having some power issues with my iMac. First, during the night and day, usually when it is idle and in sleep mode, it will wake up on its own. However, it does not turn on the display. THe fans will run, the

  • Performance : Anyconnect vs. IPSEC

    Currently running a pair of 5520 as VPN routers. running 8.0.3, been using only Anyconnect SSL VPN for end users. These boxes do nothing else except serve VPN clients. However, recently we tried testing some IPSEC clients and are realizing that the A