Uploaded image for project: 'OpenEJB'
  1. OpenEJB
  2. OPENEJB-2152

PathInfo parsed wrong

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      I'm using openejb to test a servlet and got a wrong PathInfo from org.apache.openejb.server.httpd.HttpRequestImpl class because method getPathInfo is returning a path containg the servlet path.

      My servlet path is /servlet and the request /app/servlet/test is returning /servlet/test as both getServletPath and getPathInfo, but the correct path info would be /test only.

      I verified that the getPathInfo implementation can strip the servletPath but the method initServletPath is not called, so servletPath is null.

      Accoding to Servlet Spec 3.x, section 3.5 Request Path Elements, we have:

      The request path that leads to a servlet servicing a request is composed of many
      important sections. The following elements are obtained from the request URI path
      and exposed via the request object:

      • Context Path: The path prefix associated with the ServletContext that this
        servlet is a part of. If this context is the “default” context rooted at the base of the
        Web server’s URL name space, this path will be an empty string. Otherwise, if the
        context is not rooted at the root of the server’s name space, the path starts with a
        / character but does not end with a / character.
      • Servlet Path: The path section that directly corresponds to the mapping which
        activated this request. This path starts with a ’/’ character except in the case
        where the request is matched with the ‘/*’ or ““ pattern, in which case it is an
        empty string.
      • PathInfo: The part of the request path that is not part of the Context Path or the
        Servlet Path. It is either null if there is no extra path, or is a string with a leading
        ‘/’.

      The following methods exist in the HttpServletRequest interface to access this
      information:

      • getContextPath
      • getServletPath
      • getPathInfo

      It is important to note that, except for URL encoding differences between the request
      URI and the path parts, the following equation is always true:

      requestURI = contextPath + servletPath + pathInfo

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            thgramos Thiago Ramos
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified