tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid...@pidster.com>
Subject Re: How to get the context path during servlet load?
Date Sat, 13 Oct 2007 13:49:06 GMT

if you mean during the init() method:


    /*
     * (non-Javadoc)
     * @see javax.servlet.GenericServlet#init(javax.servlet.ServletConfig)
     */
    @Override
    public void init(ServletConfig config) throws ServletException {
        //
        ServletContext context = config.getServletContext();
	String path = context.getContextPath();

        super.init(config);
    }


Zsolt Koppany wrote:
> Hi,
> 
> I want to make the application contextPath independent. Normally this is not
> a problem because I can use request.getContextPath() however I need to know
> the contextPath during startup:
> 
> <servlet>
> 	<servlet-name>startup</servlet-name>
> 	<servlet-class>...</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> </servlet>
> 
> How can I do that?
> 
> Zsolt 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message