servlet registration at runtime
awesome! did you have a look at the servlet 3.0 API PD?
I did not yet, but was amazed to see something like this:
| Java | | copy | | ? |
public void contextInitialized(ServletContextEvent sce) { |
ServletContext sc = sce.getServletContext(); |
ServletRegistration sr = sc.addServlet("NewServlet", "test.NewServlet"); |
sr.setInitParameter("servletInitName", "servletInitValue"); |
sc.addServletMapping("NewServlet", new String[] {"/newServlet"}); |
} |
wonder, if servlets and filters can be removed at runtime as well
one thing bugs me though: why the hell has the servlet’s name to be a parameter to addServletMapping !?
shouldn’t it be only possible to map the servlet bound to this ServletRegistration object? in that case, repeating the name is a source of possible error, right?

