https://bz.apache.org/bugzilla/show_bug.cgi?id=57733

Tomasz <tomasz.mac...@comarch.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|DUPLICATE                   |FIXED

--- Comment #4 from Tomasz <tomasz.mac...@comarch.pl> ---
Ok i agree, that this code work OK.
But my case is other. I get ServletContext from servlet. Hire is my example:

public class TestServlet extends HttpServlet {

    @Override
    public void init() throws ServletException {

        ServletContext servletContext = getServletContext();

        System.out.println("Servlet START: " +
servletContext.getContextPath());

        String[] contextTab = { "/", "/app1", "/app2" };

        for (String con : contextTab) {
            System.out.println("Context " + con + " : " +
servletContext.getContext(con));
        }
    }
}

And in context "/" always I have null. In server.xml i have configuration:
<Context path="" docBase="${catalina.base}/webapps/ROOT" crossContext="true" />
<Context path="/app1" docBase="${catalina.base}/webapps/app1"
crossContext="true" />
<Context path="/app2" docBase="${catalina.base}/webapps/app2"
crossContext="true" />

And the output is:
Servlet START: /app1
Context / : null
Context /app1 : null
Context /app2 : null

Servlet START: /app2
Context / : null
Context /app1 : org.apache.catalina.core.ApplicationContextFacade@8c6fb37
Context /app2 : null

Servlet is added to app1 and app2.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to