This content has been marked as final.
Show 3 replies
-
1. Re: How to configure a web service with two context roots
honza889 Mar 12, 2018 12:09 PM (in response to hvu63)If you are changing context-root of your web service, I think best practice would be have deployed old service and new service as two independent deployments in parallel.
Java EE spec allows only one context-root per web module.
-
2. Re: How to configure a web service with two context roots
hvu63 Mar 13, 2018 10:23 AM (in response to honza889)I have only one service but we want to change the end point. By keeping the old end point (which can be forwarded to the new end point) we can let the consumer of the webservice the time to update the end point.
-
3. Re: How to configure a web service with two context roots
honza889 Mar 14, 2018 12:09 PM (in response to hvu63)If you really need two different context-roots, you will need two web deployments.
On the other hand, if you actually need to have two different rest application paths in one context-root, you can define multiple rest Application:
@ApplicationPath("/old-rest") public class OldRestApplication extends Application { } @ApplicationPath("/new-rest") public class NewRestApplication extends Application { }
Only one rest service class will be sufficient for both prefixes in such case:
@Path("/myRestService") public class MyRestService { @GET public String doSomething() { ... } }