java - Handle Jersey/JAX-RS REST manually -
i'm building application i'd intercept http requests , decide whether or not pass them jax-rs implementation processing.
i have single filter-and-front-controller-servlet combination , servlet delegate routing either jersey or "standard" router.
i can see lots of examples of using jersey servlet, or of starting http server, there doesn't seem handy way take httpservletrequest/httpservletresponse pair , "here go jersey, route me".
am missing obvious?
in case, think requestdispatcher might helps
a requestdispatcher object can used forward request resource, can try following:
public class frontservlet extends httpservlet { @override protected void doget(httpservletrequest req, httpservletresponse resp) throws servletexception, ioexception { servletcontext sc = this.getservletcontext(); if (somecondition) { sc.getrequestdispatcher("/jersey/servlet").forward(req, resp); }else{ sc.getrequestdispatcher("/standard/router").forward(req, resp); } } }
Comments
Post a Comment