简体   繁体   中英

How to make a jersey servlet responsible for any request?

Imagine the following situation: A webapplication gets deployed to a tomcat server. A jersey servlet is started that serves requests at http://localhost/myServlet

Now, when somebody is requesting http://localhost/myServlet/this/path/shall/be/handled , the myServlet should feel responsible for this request and handle it appropiately.

Edit: To be more specific: I do NOT know the path the user is requesting. Think about this like a virtual file system where the user requests myServlet/path/to/file . MyServlet shall be responsible for this GET request. As you can see mapping those URLs to Annotations is not possible. I'd like to annotate like myServlet/* , if that is more understandable.

Could anybody point me to the right direction? I feel a bit lost, but I am quite sure this is possible!

Jersey Servlet (com.sun.jersey.spi.spring.container.servlet.SpringServlet) is the end point for REST API (if we are using Jersey REST) Call. So, When ever the servlet get any request , The same request is been processed by its Handler.

When the application get a request with myServlet with the appropriate url-pattern then Its corresponding Handler will activate and process the request for the appropriate response.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM