I have the following code and whichever service is created last works(so my annotations must be correct). I am assuming this must be a copy the example mistake but I am not sure how to deploy two endpoints without them conflicting. Here is the code I was using to deploy both of them…
public void start() {
Server svr3 = createRestService(restEnrollmentResponse);
Server svr2 = createRestService(restEnrollment);
}
public static Server createRestService(Object service) {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(service.getClass());
sf.setResourceProvider(service.getClass(), new SingletonResourceProvider(service));
sf.setAddress("http://0.0.0.0:9900/");
Server svr = sf.create();
return svr;
}
NOTE: The restEnrollment @Path is /enrollment and the restEnrollmentResponse @Path is
I finally figured this nightmare out. Change both @Path annotations to @Path(“/”) and then change the
sf.setAddress(“http://0.0.0.0:9900/”);
to
sf.setAddress(“http://0.0.0.0:9900/enrollmentrequest”);
sf.setAddress(“http://0.0.0.0:9900/othercontext”);
and it now works ;).
Dean