Forward in filter chain

Hi,
i have a question to the behaviour of a filter chain.
Assumed i have a chain of 3 filters and at filter 2 there is a forward on request to a different url.
Wath is the next action?
1) New url will be processed with filters 1,2,3.
2) New url will be processed with filter 3
3) the filter chain will be abborted
Thanks for answers Thomas

well it depends if you dont call doFilter() but redirect to a redirect on the same server with the same mapping your current filterChain will be aborted but you will start a new one on the forwarded URL

Similar Messages

  • Filter chain behaviour on browser disconnection

    Hi
    I'm trying to implement a filter that acts as a work queue. Here's the code I use in my filter:
    // push a new worker to the queue, the queue will wait() if there are already enough active workers.
    queue.push(this);
    // out of the queue, let the chain process the request
    chain.doFilter(request, response);
    // inform queue that the current worker is done and the next queued worker can be released
    queue.pop();
    The code works fine with normal user activity, but if the user disconnects the page (presses stop or browses another link), the processing doesn't reach queue.pop(). I would like to somehow get information relayed to queue or filter that that "the browser disconnected", but I'm not sure if this possible.
    From previous threads in this forum I just found techniques which used the browser to launch some event, but those aren't suitable in this case.
    The only approach I've figured out would be to use a leaky queue implementation. The queue would leak a worker periodically if no workers have been released after a specified time. I'd definitely appreciate better solutions =)
    I'm using the Orion application server 1.6.0b.

    Hi
    Yes, it works even when the browser is fully disconnected (I verified this from the firewall's connections). The filter doesn't intercept the disconnection, but instead it's guaranteed that the page gets fully rendered.
    Currently I use the following approach:
    1. try/catch around chain.doFilter(request, response); to catch any thrown exceptions in the filter chain or while page was rendered. The worker is released from the queue when the execution of the code gets back from doFilter() and any recieved exceptions are thrown upwards.
    2. Leaky queue, which leaks workers if the above doesn't work for some reason
    3. Since there might be other worker queues in use while rendering the page (which need to be freed in case of an error), they're stored to a Vector in request's context. Normally they're released after use, but if there's an error the error gets caught in 1. and there the vector is iterated releasing all work queues.

  • JRun4 Filter Chain problem

    Hi,
    I try to use servlet.Filter in my web app. the Filter works
    fine in Tomcat. but when i deployed it to JRun4(update6), JRun gave
    me this error message as below.
    I tried to google it in the internet, but couldn't find
    anything related to this problem. Please can someone help me?
    Thanks in advance.
    oneduan
    500
    jrun.servlet.JRunInvokerChain
    java.lang.ClassCastException: jrun.servlet.JRunInvokerChain
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:85)
    at myTest.SessionFilter.doFilter(SessionFilter.java:140)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
    at jrun.servlet.FilterChain.service(FilterChain.java:101)
    at
    jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at
    jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at
    jrun.servlet.JRunRequestDispatcher.invokeNext(JRunRequestDispatcher.java:534)
    at
    jrun.servlet.JRunRequestDispatcher.forwardInvoke(JRunRequestDispatcher.java:503)
    at
    jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:177)
    at
    jrun.servlet.file.FileServlet.service(FileServlet.java:316)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
    at myTest.SessionFilter.doFilter(SessionFilter.java:62)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
    at jrun.servlet.FilterChain.service(FilterChain.java:101)
    at
    jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at
    jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at
    jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:259)
    at
    jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
    at
    jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
    at
    jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
    at
    jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
    at
    jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    ------------------------------------------------------------------------------------------ -------------------------------------

    I find another error message from JRun launcher console.
    ERROR: Translator.CompilationFailedExceptionCompiler
    errors:Note: C:\JRun4\serve
    rs\default\SERVER-INF\temp\dwadj.war-1227002279\07/04
    13:34:39 error jrun.servle
    t.JRunInvokerChain
    java.lang.ClassCastException: jrun.servlet.JRunInvokerChain
    at jrun.servleWEB-INF\jsp\jrun__jsp__index2ejspe.java uses or
    overrides
    a deprecated API.
    Note: Recompile with -Xlint
    eprecation for details.t.FilterChain.doFilter(Filte
    rChain.java:85)
    at myTest.SessionFilter.doFilter(
    SessionFil
    ter.java:140)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
    at jrun.servlet.FilterChain.service(FilterChain.java:101)
    at
    jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at
    jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at
    jrun.servlet.JRunRequestDispatcher.invokeNext(JRunRequestDispatcher.j
    ava:534)
    at
    jrun.servlet.JRunRequestDispatcher.forwardInvoke(JRunRequestDispatche
    r.java:503)
    at
    jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java
    :177)
    at
    jrun.servlet.file.FileServlet.service(FileServlet.java:316)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
    at myTest.SessionFilter.doFilter(
    SessionFilter.java:62)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
    at jrun.servlet.FilterChain.service(FilterChain.java:101)
    at
    jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at
    jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at
    jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:
    259)
    at
    jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:
    541)
    at
    jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
    at
    jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPoo
    l.java:320)
    at
    jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.j
    ava:428)
    at
    jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.
    java:266)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

  • Forward/reverse proxy chain losing headers

    I have the following setup:
    user(browser) -> proxy1 -> proxy2 -> webserver
    This has both forward and reverse mappings. In proxy 1, I have an NSAPI plugin that appends a name/value(uid:userid) pair into the HTTP headers, at the end of my current header string . I use
    const char *HEADERS = "full-headers"; //HEADER NAME
    pblock_findval((char *)HEADERS, request->reqpb))
    pblock_remove((char *)HEADERS, request->reqpb);
    pblock_nvinsert((char *)HEADERS, (char*)"current list of NV pairs, uid: user123", request->reqpb);
    In the previous proxy versions to 3.63, the second proxy and teh webserver receive my entire header string(full-headers) without any issue and just as I sent it.
    With version 3.63, my UID is missing from the "
    Protocol Request PB (rq->reqpb)" section along with some other info in my header string. I use sdump to view the headers, plus my backend app is not receiving the uid.
    Has anyone else had the issue of their headers getting mangled, and or missing in Proxy 3.63 ?Or does anyone have any ideas to the issue?

    Yep, good catch
    There is a bug in the proxy : Proxy 3.6 SP3 removes "Proxy-authenticate:" HTTP header when forwarding requests to other proxies.
    This is basically in adherence to RFC2616 clause
    13.5.1 End-to-end and Hop-by-hop Headers:
    For the purpose of defining the behavior of caches and non-caching
    proxies, we divide HTTP headers into two categories:
    - End-to-end headers, which are transmitted to the ultimate
    recipient of a request or response. End-to-end headers in
    responses MUST be stored as part of a cache entry and MUST be
    transmitted in any response formed from a cache entry.
    - Hop-by-hop headers, which are meaningful only for a single
    transport-level connection, and are not stored by caches or
    forwarded by proxies.
    The following HTTP/1.1 headers are hop-by-hop headers:
    - Connection
    - Keep-Alive
    - Proxy-Authenticate
    - Proxy-Authorization
    - TE
    - Trailers
    - Transfer-Encoding
    - Upgrade
    All other headers defined by HTTP/1.1 are end-to-end headers.
    This somehow messed up the proxy chain configurations
    This has been fixed in SP4 which will be released in a week or two
    Thx
    Maneesh

  • JSSE/KeyManager -- Problem forwarding received certificate chains

    Hi there,
    I'm in a situation in which we must do pass-through X.509 authentication, which means that the user signs onto our server using TLS, and when we connect to another server downstream instead of using a fixed keystore, we construct one in memory containing the certificates passed to us. I've written the code to do this, but when I try it out, I've been getting a null-cert-chain error because the key manager only seems to pick up certificates in the store that are PrivateKeyEntry, not TrustedCertificateEntry. (Ignoring the fact that TrustedCertificateEntry can only carry a single certificate for the moment....). I wrote my own KeyManager subclass to handle finding the alias corresponding the TrustedCertificateEntry, but the KeyManager is getting called for a private key which I obviously can't supply (I'm being forced to return null, and that results in the socket getting closed). Is there some switch or other mode that I can use to get the JSSE implementation to allow me to forward the client's cert without it being a PrivateKeyEntry, OR, is there a way to fake up a PrivateKeyEntry (with a null Key?) that will be seen as valid? How can I do this?
    thanks in advance,
    James

    I'm in a situation in which we must do pass-through X.509 authentication, which means that the user signs onto our server using TLS, and when we connect to another server downstream instead of using a fixed keystore, we construct one in memory containing the certificates passed to us.That will never work. If it could, it would constitute a man-in-the-middle attack on SSL, and there aren't any. Part of the protocol is a digital signature with the private key corresponding to the certificate sent, and the client verifies the signature to assert that the server is the owner of the certificate, i.e. establish identity.
    So what you're doing is impossible, and is fully intended to be impossible.

  • Continue the chain of filters after forward doesn't work

    Hi,
    I'm dealing with a problem since two days ago and I guess it's time to ask for some help =).
    I'm trying to do a forward and just after that let the filters continue, maybe I have a missunderstanding of the servlet/jsp life cicle, but don't really know.
    Let's say I have two filters
    A) URLTranslatorFilter. This filter take the URL requested and forward it to the correct URL, so, the user can enter the URL in another language (creepy requirement I know =( ) and being redirected to the actual resource.
    http://localhost:8080/test01/entrar.faces
    would be translated to
    http://localhost:8080/test01/login.faces
    B) SessionFilter, it's a simple filter that check for the user being on a session, security control, simple as that.
    When a URL It's translated, just after that I have to check the username and all that kind of things, but i get the terrible error:
    javax.servlet.ServletException: Cannot forward after response has been committed
    the filterChain.doFilter isn't working I think.
    In fact, there's more than just a filter after the URLTranslatorFilter, but I can't get it to work even with two of them.
    The source for the URLTranslatorFilter:
    package mx.www.filter;
    import java.io.IOException;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.HttpServletRequest;
    public class URLTranslatorFilter implements Filter {
         public void init(FilterConfig arg0) throws ServletException {
         public void doFilter(ServletRequest request, ServletResponse response,
                   FilterChain chain) throws IOException, ServletException {
              System.out.println("URLTranslatorFilter-->");
              if (!(request instanceof HttpServletRequest)) return;
              HttpServletRequest httpServletRequest = (HttpServletRequest) request;
              String currentURI = httpServletRequest.getRequestURI();
              System.out.println("URI-->" + currentURI);
              if (currentURI.equals("/test01/entrar.faces")) {
                   RequestDispatcher requestDispatcher = request.getRequestDispatcher("/test01/login.faces");
                   requestDispatcher.forward(request, response);
              chain.doFilter(request, response);
              System.out.println("<--URLTranslatorFilter");
         public void destroy() {
    }The simple dummy SessionFilter:
    package mx.nic.rty.www.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;
    public class SessionFilter implements Filter{
         public void init(FilterConfig arg0) throws ServletException {
         public void doFilter(ServletRequest request, ServletResponse response,
                   FilterChain chain) throws IOException, ServletException {
              System.out.println("SessionFilter-->");
              chain.doFilter(request, response);
              System.out.println("<--SessionFilter");
         public void destroy() {
    }The filters defined in web.xml
         <filter>
              <filter-name>URL Translator Filter</filter-name>
              <filter-class>mx.nic.rty.www.filter.URLTranslatorFilter</filter-class>
         </filter>
         <filter-mapping>
              <filter-name>URL Translator Filter</filter-name>
              <url-pattern>*.faces</url-pattern>
         </filter-mapping>
         <filter>
              <filter-name>Session Filter</filter-name>
              <filter-class>mx.nic.rty.www.filter.SessionFilter</filter-class>
         </filter>
         <filter-mapping>
              <filter-name>Session Filter</filter-name>
              <url-pattern>*.faces</url-pattern>
         </filter-mapping>The sample pages do nothing really just show a simple message, any help you could give me would be appreciated.
    I can post more code if necessary =) thanks!
    -JF-

    Maybe try it like this:
    if (currentURI.equals("/test01/entrar.faces")) {
      RequestDispatcher requestDispatcher = request.getRequestDispatcher("/test01/login.faces");
      requestDispatcher.forward(request, response);
    else{
      chain.doFilter(request, response);
    }Forwarding control to a request dispatcher is sending a response
    calling chain.doFilter() is also sending a response.
    You can only send one response per request, so if you forward control to another resource, you should stop the current resource sending a response.

  • BRE Forward Chaining and Backward Chaining

    Hello Experts,
    Can you please help me in understanding what is forward and backward chaining in BRE
    Thanks

    Forward chaining:
    Following is the extract from my favourite BizTalk book - Professional
    BizTalk Server 2006. I would recomment you to read though this book on forward chaining with BRE.
    In short: Forward chaining describes the ability for one rule’s actions to impact facts relied on by another rule and thus require such a rule to be reevaluated to maintain consistency.
    Forward chaining describes the ability for one rule’s actions to impact facts relied on by another rule and thus require such a rule to be reevaluated to maintain consistency.
    Consider this three-rule scenario: Rules 1 and 2 rely on the Loan Risk property to establish which APR the loan should be set to. Rule 3 marks the customer as High Risk if the customer meets the profiling criteria.
    Rule 1: IF Customer.LoanRisk = “Low” THEN Loan.APR = 0%
    Rule 2: IF Customer.LoanRisk = “High” THEN Loan.APR = 39%
    Rule 3: IF Customer.Age < 21 AND Income < “20,000” THEN Customer.LoanRisk = “High”
    A clear dependency exists between these rules. The action of Rule 1 or Rule 2 can be made invalid by Rule 3.  The action of Rule 3 modifies the LoanRisk fact, which is used as part of the conditions for Rule 1 and Rule 2. 
    This is where forward chaining comes in. The BRE requires that users create rules with this mind and add an UPDATE statement to the rule. This indicates to the BRE that the fact specified with the UPDATE statement has changed and that all rules that rely
    on this fact in a condition should be reevaluated and therefore pass through the match–conflict resolution–action stages again.
    The previous rule statement would need to be modified as follows.  
    Rule 1: IF Customer.LoanRisk = “Low” THEN Loan.APR = 0%
    Rule 2: IF Customer.LoanRisk = “High” THEN Loan.APR = 39%
    Rule 3: IF Customer.Age < 21 AND Income < “20,000” THEN Customer.LoanRisk = “High”
    UPDATE Customer
    Here Forward chaining describes the ability for one rule’s actions (Rule3's action) to impact facts relied on by another rule( Rule1 and Rule2) and thus require such a rule to be reevaluated to maintain consistency.
     Backward chaining
    Regarding
    Backward chaining, I don't know anyone who has implemented backward chaining other than Charles Young. In case of Microsoft's BRE with backward chaining, his blogpost on this topic is the only reference. So its better I refer to his one and only blog on this
    topic (in Microsoft BRE engine)
    Charles Young's excellent blog on this: MS BRE Backward Chaining - Part 2: The 'Simple Name' pattern
    Other references for you on this topic..
    Technet Wiki:Biztalk: BRE Forward Chaining
     A
    real time use case addressed in MSDN forum
    As said from my favourite - excellent detail provided on this topic with an in book Professional
    BizTalk Server 2006 with an example
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • 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.

  • Filter does not work with *.jsp URL pattern???

    Hi All,
    I am, by no means, very good at JSF or Java. I have looked at various forum posts on here for ways to implement a security filter to intercept requests to pages that first require one to be logged in, and if not, redirect them to the login page. Yes, I know a lot of you have heard this many times before, and I'm sorry to bring it up again.
    BUT, from the guidance of other posts, I have got a filter that works fine when the url pattern is set to "/faces/*" or "/<anything>/*", however it won't work for "*.jsp" or "*.<anything>"
    My filter is as follows:
    package test.security;
    import javax.faces.context.FacesContext;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.http.HttpSession;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class SecurityFilter implements Filter{
        /** Creates a new instance of SecurityFilter */
        private final static String FILTER_APPLIED = "_security_filter_applied";
        public SecurityFilter() {
        public void init(FilterConfig filterConfig) {
        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException{
            HttpServletRequest req = (HttpServletRequest)request;
            HttpServletResponse res = (HttpServletResponse)response;
            HttpSession session = req.getSession();
            String requestedPage = req.getPathTranslated();
            String user=null;
            if(request.getAttribute(FILTER_APPLIED) == null) {
                //check if the page requested is the login page or register page
                if((!requestedPage.endsWith("Page1.jsp")) /* This is the login page */
                    //set the FILTER_APPLIED attribute to true
                    request.setAttribute(FILTER_APPLIED, Boolean.TRUE);
                    //Check that the session bean is not null and get the session bean property username.
                    if(((test.SessionBean1)session.getAttribute("SessionBean1"))!=null) {
                        user = ((test.SessionBean1)session.getAttribute("SessionBean1")).getUsername();
                    if((user==null)||(user.equals(""))) {
                       // try {
                     //       FacesContext.getCurrentInstance().getExternalContext().redirect("Page1.jsp");
                      //  } catch (ServletException ex) {
                      //      log("Error Description", ex);
                        res.sendRedirect("../Page1.jsp");
                        return;
            //deliver request to next filter
            chain.doFilter(request, response);
        public void destroy(){
    }My web.xml declaration for the filter is:
    <filter>
      <description>Filter to check whether user is logged in.</description>
      <filter-name>SecurityFilter</filter-name>
      <filter-class>test.security</filter-class>
    </filter>
    <filter-mapping>
      <filter-name>SecurityFilter</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    Note: I have also tried this with <url-pattern>*.jsp</url-pattern> for the filter mapping in place of the Faces Servlet
    My web.xml declaration for the url pattern is:
    <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>Which JSC/NetbeansVWP automatically creates a "JSCreator_index.jsp" which has:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root  version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page">
      <jsp:forward page="Page1.jsp"/>
    </jsp:root>When run, this causes an Error 500 in the browser and a NullPointerException in SecurityFilter.java on the line:
    if((!requestedPage.endsWith("Page1.jsp")) /* This is the login page */I think I'm missing something that would be obvious to anyone who knows better than me. Any ideas?

    Dear Ginger and Boris,
    thanks for the information - the problem seems to ocur in EP7 as well, Boris told me it is fixed in SP15. We are on SP14 now, so there is hope !
    actually the information in the oss note stated above is also true, as we have an Oracle DB. On a similar demo system (only difference is SQL DB) the hyphen search works !
    best regards, thank you !
    Johannes

  • Conditionally send redirect in Servlet filter after j_security_check

    I am writing a form based challenge for a secured J2EE application. What I want the user to do is log in, and after they are authenticated by j_security_check, get the Role that they have, and based on the role, redirect with the filter to different jsp pages.
    Here is my code
    public void doFilter(
              ServletRequest req,
              ServletResponse resp,
              FilterChain chain)
              throws ServletException, IOException {
              //action to perform before logging on
              chain.doFilter(req, resp);
              System.out.println("Filter was called");
              HttpServletResponse response = (HttpServletResponse) resp;
              //do the work to get the users Role... request.isUserInRole("Some Role");
                                               //if yes
                                               response.sendRedirect("somejsp.jsp");
                                               //else
                                               //response.sendRedirect("someother.jsp")
                                              return;
         }When I try to run the above code, My send redirect has no effect, and I get the following in my System.out
    [5/17/04 10:31:20:975 CDT] 7b2bdbb7 TraceNLS u No message text associated with key HttpConnection.run:.java.lang.IllegalStateException:.0.response.bytes.written,.but.Content-Length.header.equals.9262 in bundle com.ibm.ejs.resources.seriousMessages
    [5/17/04 10:31:20:975 CDT] 7b2bdbb7 HttpConnectio E HttpConnection.run: java.lang.IllegalStateException: 0 response bytes written, but Content-Length header equals 9262
    [5/17/04 10:31:21:006 CDT] 7b2bdbb7 SystemOut O java.lang.IllegalStateException: 0 response bytes written, but Content-Length header equals 9262
    [5/17/04 10:31:21:006 CDT] 7b2bdbb7 SystemOut O      at com.ibm.ws.http.HttpResponse.finish(HttpResponse.java:89)
    [5/17/04 10:31:21:006 CDT] 7b2bdbb7 SystemOut O      at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:565)
    [5/17/04 10:31:21:006 CDT] 7b2bdbb7 SystemOut O      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:366)
    [5/17/04 10:31:21:006 CDT] 7b2bdbb7 SystemOut O      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
    [5/17/04 10:31:29:350 CDT] 66a7dbb7 SystemOut O Filter was called
    [5/17/04 10:31:29:350 CDT] 66a7dbb7 SystemOut O Cast was completed
    [5/17/04 10:31:35:429 CDT] 66a7dbb7 WebGroup E SRVE0026E: [Servlet Error]-[Filter [LoginFilter]: filter is unavailable.]: java.lang.IllegalStateException
         at com.ibm.ws.webcontainer.srt.SRTServletResponseContext.sendRedirect(SRTServletResponseContext.java:101)
         at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendRedirect(SRTServletResponse.java:679)
         at com.mutualofomaha.groupwebenrollment.LoginFilter.doFilter(LoginFilter.java:41)
         at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
         at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:914)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:528)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
         at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
         at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
         at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
         at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
         at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
         at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
         at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:516)
         at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:362)
         at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)

    Something in the filter chain has committed the response.
    As you're redirecting you almost certainly don't need to call filterChain.doFilter anyway; you just want to send the user somewhere else.

  • Providing redirects in Servlet filter

    Hi,
    I need to provide serverside redirects in Servlet filter.O tried the below code, But unable to do it.
    Is it possible to do such a thing.
    public void doFilter(ServletRequest req, ServletResponse res,
                   FilterChain chain) throws IOException, ServletException {
              logger.info("Start of RedirectFilter ");
              HttpServletRequest request = (HttpServletRequest) req;
              HttpServletResponse response = (HttpServletResponse) res;
              String requestURI=request.getRequestURI();
              String domainURL=request.getServerName().toLowerCase();
              logger.info("domainName--"+domainName);
              String keywordToBeAppended=domainURL.replaceAll(domainName,"");
              logger.info("url--"+request.getRequestURI());
              logger.info("servername--"+request.getServerName());
              logger.info("keywordToBeAppended-"+keywordToBeAppended);
              String finalURL= request.getScheme()+"://"+domainURL+"/"+keywordToBeAppended+requestURI;
              logger.info("finalURL--"+finalURL);
              RequestDispatcher rd = request.getRequestDispatcher(finalURL);
              rd.forward(request, response);
              logger.info("End of RedirectFilter ");
              chain.doFilter(request, response);
         }

    There is technically a huge difference between "redirect" and "forward". You're doing here forwards. And because you continue the filter chain, you run into problems. You should do either a forward OR continuing the current request unchanged (through the filter chain) OR send a redirect. You cannot do one or more simultaneously.

  • Glassfish 2.1.1 locale filter

    I've a locale filter which sets the locale by the url and forwards the reply, and stopped working after update to Glassfish 2.1.1. There's something changed ?...
    The filter code:
            if (relativePath.contains("/es/")) {
                log.debug(" before req:"+req.getRequestURI());
                    req.getSession().setAttribute("c-locale", "es");
                filterConfig.getServletContext().getRequestDispatcher("/"+relativePath.replaceAll("/es/", "")).
                    forward(request, response);
                log.debug(" after req:"+req.getRequestURI());
            } else if (relativePath.contains("/en/")) {
                origURI=req.getRequestURI();
                log.debug(" before req:"+req.getRequestURI());
                req.getSession().setAttribute("c-locale", "en");
                filterConfig.getServletContext().getRequestDispatcher("/"+relativePath.replaceAll("/en/", "")).
                    forward(request, response);
    } else {
                 chain.doFilter(request, response);
    }web.xml
    <filter>
        <filter-name>localefilter</filter-name>
        <filter-class>com.foo.bar.localefilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>localefilter</filter-name>
        <url-pattern>/en/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>   
    </filter-mapping>Instead of getting the forwarded page, I get:
    javax.faces.FacesException: Problem in renderResponse: /en/page1.xhtml Not Found in ExternalContext as a Resource
    Looks like Facelets didn't take the forward ¿? ... The same project under glassfish "Java System Application Server 9.1_02 (build b04-fcs)" process well the filter...
    I didnt find any change in the documentation!!!
    Any hints ?...
    thank you very much!
    PS: I'm using icefaces 1.8.1 + facelet, below the stack trace
    java.io.FileNotFoundException: /en/page1.xhtml Not Found in ExternalContext as a Resource
            at com.sun.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:121)
            at com.sun.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:91)
            at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:268)
            at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:153)
            at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)

    I don't think so, as I said, in previous version works well, and I've just been testing on Tomcat 6, and forwards works like I expected.. I suspect that this is a bug in GF. I think it's time to move forward to another AS, I'm really exhausted about GF problems.
    thank you for your reply,

  • Can we have a filter to handle all the apps in a container?

    Hi,
    I have a simple (Stupid) question.
    Can I configure a Servlet filter to intercept requests to all the applications (a.k.a all the ServletContexts)? All I know is we can configure a filter for each ServletContext (application), but I am wondering if there is any way.
    The reason I am asking is because, if there is a way to do so, I can configure my filter to provide me the debug output (Such as CGI, session, request, and ServletContext variables) on all the applications on development servers and when I can get rid of debugging on production servers (by not deploying the filter).
    Thanx in advance,
    Thirupati Panyala

    Thanks for the reply Sudhir.
    I tried it in Tomcat 4.x. It works for only the root resources even though I configured the filter for /* which is expected to include all the resources including root (for ex: /examples/...).
    So, I understand, the web.xml under /conf will be overriden by that of the respective apps as you go further down the context paths (apps). That's why the container was not executing my filter when I went to the next level of the URI (http://localhost:8080/index.html WORKED, but NOT http://localhost:8080/examples/jsp/num/numguess.jsp).
    If you want to try it for yourself, here is the piece of code I tried with (This is taken from Apache Tomcat source):
    package filters;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.io.StringWriter;
    import java.sql.Timestamp;
    import java.util.Enumeration;
    import java.util.Locale;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.Cookie;
    import javax.servlet.http.HttpServletRequest;
    * Example filter that dumps interesting state information about a request
    * to the associated servlet context log file, before allowing the servlet
    * to process the request in the usual way. This can be installed as needed
    * to assist in debugging problems.
    * @author Craig McClanahan
    * @version $Revision: 1.5 $ $Date: 2001/05/23 22:26:17 $
    public final class RequestDumperFilter implements Filter {
    // ----------------------------------------------------- Instance Variables
    * The filter configuration object we are associated with. If this value
    * is null, this filter instance is not currently configured.
    private FilterConfig filterConfig = null;
    // --------------------------------------------------------- Public Methods
    * Take this filter out of service.
    public void destroy() {
    this.filterConfig = null;
    * Time the processing that is performed by all subsequent filters in the
    * current filter stack, including the ultimately invoked servlet.
    * @param request The servlet request we are processing
    * @param result The servlet response we are creating
    * @param chain The filter chain we are processing
    * @exception IOException if an input/output error occurs
    * @exception ServletException if a servlet error occurs
    public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain)
         throws IOException, ServletException {
    if (filterConfig == null)
         return;
         // Render the generic servlet request properties
         StringWriter sw = new StringWriter();
         PrintWriter writer = new PrintWriter(sw);
         writer.println("Request Received at " +
              (new Timestamp(System.currentTimeMillis())));
         writer.println(" characterEncoding=" + request.getCharacterEncoding());
         writer.println(" contentLength=" + request.getContentLength());
         writer.println(" contentType=" + request.getContentType());
         writer.println(" locale=" + request.getLocale());
         writer.print(" locales=");
         Enumeration locales = request.getLocales();
         boolean first = true;
         while (locales.hasMoreElements()) {
         Locale locale = (Locale) locales.nextElement();
         if (first)
         first = false;
         else
         writer.print(", ");
         writer.print(locale.toString());
         writer.println();
         Enumeration names = request.getParameterNames();
         while (names.hasMoreElements()) {
         String name = (String) names.nextElement();
         writer.print(" parameter=" + name + "=");
         String values[] = request.getParameterValues(name);
         for (int i = 0; i < values.length; i++) {
         if (i > 0)
              writer.print(", ");
              writer.print(values);
         writer.println();
         writer.println(" protocol=" + request.getProtocol());
         writer.println(" remoteAddr=" + request.getRemoteAddr());
         writer.println(" remoteHost=" + request.getRemoteHost());
         writer.println(" scheme=" + request.getScheme());
         writer.println(" serverName=" + request.getServerName());
         writer.println(" serverPort=" + request.getServerPort());
         writer.println(" isSecure=" + request.isSecure());
         // Render the HTTP servlet request properties
         if (request instanceof HttpServletRequest) {
         writer.println("---------------------------------------------");
         HttpServletRequest hrequest = (HttpServletRequest) request;
         writer.println(" contextPath=" + hrequest.getContextPath());
         Cookie cookies[] = hrequest.getCookies();
    if (cookies == null)
    cookies = new Cookie[0];
         for (int i = 0; i < cookies.length; i++) {
         writer.println(" cookie=" + cookies[i].getName() +
                   "=" + cookies[i].getValue());
         names = hrequest.getHeaderNames();
         while (names.hasMoreElements()) {
         String name = (String) names.nextElement();
              String value = hrequest.getHeader(name);
         writer.println(" header=" + name + "=" + value);
         writer.println(" method=" + hrequest.getMethod());
         writer.println(" pathInfo=" + hrequest.getPathInfo());
         writer.println(" queryString=" + hrequest.getQueryString());
         writer.println(" remoteUser=" + hrequest.getRemoteUser());
         writer.println("requestedSessionId=" +
                   hrequest.getRequestedSessionId());
         writer.println(" requestURI=" + hrequest.getRequestURI());
         writer.println(" servletPath=" + hrequest.getServletPath());
         writer.println("=============================================");
         // Log the resulting string
         writer.flush();
         response.getWriter().print(sw.getBuffer().toString());
         // Pass control on to the next filter
    chain.doFilter(request, response);
    * Place this filter into service.
    * @param filterConfig The filter configuration object
    public void init(FilterConfig filterConfig) throws ServletException {
         this.filterConfig = filterConfig;
    * Return a String representation of this object.
    public String toString() {
         if (filterConfig == null)
         return ("RequestDumperFilter()");
         StringBuffer sb = new StringBuffer("RequestDumperFilter(");
         sb.append(filterConfig);
         sb.append(")");
         return (sb.toString());
    And the config in web.xml is :
    <filter>
    <filter-name>Request Dumper Filter</filter-name>
    <filter-class>filters.RequestDumperFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>Request Dumper Filter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    Thanx
    Thirupati Panyala

  • FMJ2 - Carry forward with budget Line

    Hello,
    I have done a carry forward FMJ2 and everything works perfectly. However the client let me know that they also want the budget line associated to the commitments to be carry forwarded.
    When I try that, the system gives me error FMAVC005.
    In "Define basic stting for carry forward" I have "Carry forward with document chain".
    In "Enter default settings" I have flaged "Carry forward budget for commitement allowed" and also the other 2 (Commitemnt and residual).
    Any idea about this topic.
    Please let me know.
    Regards,

    Hello,
    Avalability control is activated and I ma working with BCS Budget.
    In 2013 I have introduce my budget FMBB (Budget line). Then I have created a reserve agaisnt this budget line.
    When I try to do the carry forward the budget line is not carry forward and so the reserve in 2014 is trying to consume a budget line that do not exist.
    Please find a document with the images of the customizng and the 4th one with the result of the budget in 2014 but without the availability control (I get a negative ammount).
    Regards,
    Daniel

  • Notification forward issue

    Hi all,
    we have some approvers, suppose(a,b,c,d,e) now if 'a' sends the approval mail to 'b' for approval where 'b' approves and it reaches 'c' where he approves and approval chain ends. Ideally the approval chain needs to end at 'c'.
    But , in our case , if 'b' is not approving, and he forwards the mail , it is reaching 'c','d' & 'e' ( where 'd' & 'e' are superior to 'c' ) which is not intended to happen.
    Even if 'b' is forwarding , the approval chain should stop at 'c'.
    Thanks.
    Karthik

    You can try by using a post notification activity so that when C acts on the notification (transfers or approves) you can validate and allow the transfer or prevent it. Post notification functions are documented in the WF Developers Guide and also sampled here: https://blogs.oracle.com/oracleworkflow/entry/implementing_a_post_notification_function
    Regards,
    Alejandro

Maybe you are looking for

  • Using VMWare Fusion for playing games

    Hi all and I hope you can help. I have a recent 17" MBP with 2GB of RAM and a Core 2 Duo and I am trying to get some decent game software running on it. To do this I have installed VMWare Fusion, XP Pro and Crysis. My problem is, I can get the game t

  • Table name for storing condition value determined for Transactions

    Hi, For a routine that we need to write for pricing procedure, we need to pick up the value of the condition record that gets determined in any order. We were not able to find this table name. Any pointers? regards, Jaya

  • UCCE Error[12005]

    Hello I need help! I have this message:     IPCC Error[12005] Login could not be performed.     Possible causes are Invalid Instrument; Media Termination Problem or other CM issue" I already check jtapi user asociate to extension also check device ta

  • DB structure when replacing XE in place of Three Access Databases.

    We have an application which has three access databases for offline access. For online access we use Oracle 10g. Now we want to replace these three access databases with XE. the three offline dbs are for the use of keeping some downlaoded data, trans

  • Linking flash buttons? not working need help:)

    Hey guys, Got a site here - www.fatalwisdom.com - as you can see i want the top swf file - with the links in there to work like eg. audio button when clicked going to; audio.htm. The file won't seem to work though - here is the file : www.mastacraft.