2 Replies Latest reply on Mar 21, 2002 10:00 AM by jbaker_softcomms

    Servlet get path info mixed up?

    jbaker_softcomms

      Using Jboss2.4.4 with tomcat3.2.3

      I have a servlet deployed as an ear into jboss. The servlet is supposed to filter everything in that web context so I deployed with empty <url-pattern></url-pattern>. However, it was not behaving as I expect so I put in a few prints at the beginning of the service method to check what was happening. What I found worried me - The response I would expect with this URL from getPathInfo() is coming through in getServletPath(). Any clues how to do this without the strangeness? Snoop seems to not have this problem.

      // The url that triggers the strange repsonse
      http://bongo.101main.com:8080/WebKey/1/2.txt?action=blah

      // Some output
      [INFO,Default] ContextPath: /WebKey
      [INFO,Default] PathInfo: null
      [INFO,Default] PathTranslated: null
      [INFO,Default] QueryString: action=blah
      [INFO,Default] RequestURI: /WebKey/1/2.txt
      [INFO,Default] ServletPath: /1/2.txt

      // Some code that shows above output
      public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
      {
      System.out.println("ContextPath: " + request.getContextPath());
      System.out.println("PathInfo: " + request.getPathInfo());
      System.out.println("PathTranslated: " + request.getPathTranslated());
      System.out.println("QueryString: " + request.getQueryString());
      System.out.println("RequestURI: " + request.getRequestURI());
      System.out.println("ServletPath: " + request.getServletPath());

      // Some web-app XML
      <servlet-mapping>
      <servlet-name>WebKeyServlet</servlet-name>
      <url-pattern />
      </servlet-mapping>

        • 1. Re: Servlet get path info mixed up?
          jbaker_softcomms

          This gets stranger still...

          To deploy in a way that works I find I need to add /ServletName/* However, this is not what I want. I then tried /* which is more like the total filter that I want BUT seems to occasionally bring the entire JBOSS server down with out cleaning up after it (no shutting down message just VM exits!) which I wouldn't have thought possible!!!

          I'll now try if I can get this to happen in a small easily reproducible form.







          • 2. Re: Servlet get path info mixed up?
            jbaker_softcomms

            OK. It seems that it's a tomcat problem. Trying to use the request dispatcher to include a jsp was causing a circular reference. This quickly blew up the VM. Is there a way for includes to avoid going through the main mapping which causes the servlet to be invoked again for the include? I can use a servlet name but that leaves some files accessible - I was everything to go through the servlet.