I have two separate bnd workspaces with two different JAXRS projects. I am having an issue with one of the workspaces rest endpoint paths not working and where the other JAXRS end points are working. I am defining the @JaxrsAppplicationBase (no issue in either workspace), the @Path for each method (no issue in either workspace) and the@Path for the class (it works in one workspace but not the other).
Authentication Workspace: This workspace is recognizing the JAXRS Rest end points. AuthenticationJaxRsApp.java @JaxrsApplicationBase("rest/auth") @JaxrsName("AuthenticationRestApp") @Component(service = Application.class) public class AuthenticationJaxRsApp extends Application { @Reference AuthenticationFilter authFilter; @Reference AuthenticationQuietFilter quietFilter; @Reference AuthenticationSuperFilter superFilter; @Reference AuthenticationAdminFilter adminFilter; @Override public Set<Class<?>> getClasses() { Set<Class<?>> classes = new HashSet<>(); classes.add(JacksonJsonProvider.class); classes.add(authFilter.getClass()); classes.add(quietFilter.getClass()); classes.add(superFilter.getClass()); classes.add(adminFilter.getClass()); return classes; } } LookupResource.java @Component(service = LookupResource.class) @JaxrsResource @JaxrsApplicationSelect("(osgi.jaxrs.name=AuthenticationRestApp)") @Path("lookup") public class LookupResource { @Reference LookupManager manager; /** * Method to get the security questions. * @param authorizationHeader * @return */ @GET @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("security-questions") @Secured public Response getSecurityQuestions() { List<SecurityQuestionDto> list = manager.getSecurityQuestions(); return Response.ok(list).build(); } } Reservation Workspace: This workspace is NOT recognizing the JAXRS Rest end points. I can remove the @Path from the class level and the rest endpoints will work. Trying to retain the @Path for the class to make it more manageable. This workspace includes the workspace above for dependencies. MakoJaxRsApp.java @JaxrsApplicationBase("rest/mako") @JaxrsName("ReservationRestApp") @Component(service = Application.class) public class MakoJaxRsApp extends Application { @Reference AuthenticationFilter authFilter; @Reference AuthenticationQuietFilter quietFilter; @Reference AuthenticationSuperFilter superFilter; @Reference AuthenticationAdminFilter adminFilter; // https://www.nabisoft.com/tutorials/java-ee/producing-and-consuming-json-or-x ml-in-java-rest-services-with-jersey-and-moxy#Step3 // https://www.nabisoft.com/tutorials/java-ee/producing-and-consuming-json-or-x ml-in-java-rest-services-with-jersey-and-jackson @Override public Set<Class<?>> getClasses() { Set<Class<?>> classes = new HashSet<>(); classes.add(JacksonJsonProvider.class); classes.add(authFilter.getClass()); classes.add(quietFilter.getClass()); classes.add(superFilter.getClass()); classes.add(adminFilter.getClass()); return classes; } } LookupResouce.java (This is a different class and package from the class defined previously) @Component(service = LookupResource.class, immediate = true) @JaxrsResource @JaxrsApplicationSelect("(osgi.jaxrs.name=ReservationRestApp)") @Path("lup") public class LookupResource { @Context private HttpServletRequest request; @Context private HttpServletResponse response; @Reference ContainerUtil containerUtility; @Reference LookupManager manager; @Reference AuthenticationManager authManager; @GET @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("cost-types") @Secured public Response getCostTypes() { return Response.ok(manager.getCostTypes()).build(); } } Thank you for any suggestions or advise you may have on how I misconfigured the second workspace.
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev