java - JAX-WS Web service on Tomcat without sun-jaxws.xml -
i trying minimize required configuration while deploying jax-ws-based web service on tomcat. introduction of servlet 3.0 (supported tomcat 7+), web.xml can thrown out, there still sun-jaxws.xml. blog post interesting:
of course, use of jax-ws annotations, configuration sun-jaxws.xml can made optional making descriptor free, requires specifying default url-pattern in jsr-109 or custom pattern in jersey rest services, in jax-ws specification.
is possible avoid sun-jaxws.xml on tomcat, , how?
sadly, configuration must exist somewhere. mandatory, per source. believe or not, the location of sun-jaxws.xml file hard-coded /web-inf/sun-jaxws.xml (thanks, guys @ metro).
effectively, need take control of following classes
what needs happen:
wsservletcontextlistenernot extended. listener performs of initializations per sun-jaxws.xml , jaxws-catalog file. mentioned earlier, location hard coded. path of least resistance hereimplement own vanilla servlet listener (with
@weblistener) , callnew wsservletcontextlistener(). you'll delegate owncontextinitialized(servletcontext ctxt),contextdestroyed()methods ones in instance ofwsservletcontextlistener.generate file on instantiation of listener, on fly, using
@xmlrootelementclass that'll represent sun-jaxws file(i'll provide sample of in short while, don't have time right :) ).
it's lot of trouble such dispensable convenience, imo, should work in theory. i'll write samples , see how play shortly.
Comments
Post a Comment