tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marius Preuten <mar...@preuten.com>
Subject Using the Tomcat API to Change the Context
Date Thu, 05 Jul 2007 10:12:55 GMT
I'm trying to write a Servlet which adds a Mapping on an existing 
Servlet-Class to ists own Context.
Is this possible or are there any restrictions ?

I tried this, but there wasn't a result:
.....
public class Index extends HttpServlet implements ContainerServlet {
............
    protected void doGet(HttpServletRequest request,HttpServletResponse 
response) throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        Context child = (Context) host.findChild("/Admin");     //<-- 
ists not the default admin-app
        out.println(child.getName()+"<br />");       //<-- Exists
        child.addServletMapping("/test.html", "Index");           
//<--tries to map his own servlet class to a new url
    }
.......
}


If i go to http://myserver:8080/Admin/index.html there is no error or 
something,
but if i try http://myserver:8080/Admin/test.html i get a 404.
I use Tomcat 6.0.13 on WinXP or Debian4.0 if that counts.

If someone knows a good tutorial about this stuff, it would be very 
nice, because i can't find any on the web.


---------------------------------------------------------------------
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