Uploaded image for project: 'Geronimo'
  1. Geronimo
  2. GERONIMO-3921

getContextRoot() returns forward slash rather than empty string for apps deployed to root context

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0, 2.0.1, 2.0.2, 2.1, 2.1.1, 2.2
    • 2.0.3, 2.1.1, 2.2
    • Tomcat
    • Security Level: public (Regular issues)
    • None

    Description

      An app deployed to the root context should have "" returned by getContextRoot() - On Tomcat, we are returning "/".

      dcherk wrote:
      > I am deploying my war file into the root context with the following
      > deployment plan:
      > ----------
      > <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0"
      > xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"
      > xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
      > xmlns:security="http://geronimo.apache.org/xml/ns/security-1.2">
      > ...
      > <context-root></context-root>
      > ...
      > </web-app>
      > ----------
      >
      > The application starts up properly, and responds on http://localhost, as
      > expected.
      >
      > However, when I examine request.getContextPath(), I get a forward slash:
      > "/".
      >
      > This is incorrect, as far as I can tell. According to the API
      > (http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpServletRequest.html#getContextPath()):
      > ----------
      > For servlets in the default (root) context, this method
      > [HttpServletRequest.html.getContextPath()] returns "".
      > ----------
      >

      Attachments

        Issue Links

          Activity

            People

              jaydm Jay McHugh
              jaydm Jay McHugh
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: