0

I'm developing a FrontServlet, so there is no need to map other Servlet. I use getRequestDispatcher for specific Servlet and I need some name to access it, to forward request, but without mapping's url-pattern I don't know how to do it.

Is there an ability to access the Servlet without being mapped in web.xml?

MaVRoSCy
  • 17,747
  • 15
  • 82
  • 125
ovnia
  • 2,412
  • 4
  • 33
  • 54
  • @kocko yes, it is. But there are no answer. I know how to do it in web.xml, and i also know how to do it with anotations. I need to avoid these records. – ovnia Apr 14 '14 at 14:28
  • As @BalusC says in that post, that was a security hole on previous Apache implementations. That feature was deprecated and then removed – MaVRoSCy Apr 14 '14 at 14:32

1 Answers1

1

You should have your servlet mapped to some name in order to invoke it programmatically, and this can be done:

  • Either the old way with a <servlet-mapping>...</servlet-mapping> tag in the deployment descriptor file.
  • With the 3.0 Servlet Spec with the annotation @WebServlet
  • Using the addServlet method.

Then you will be able to chain your request to the your custom servlet.

tmarwen
  • 15,750
  • 5
  • 43
  • 62