Your getClasses() method in the Application class tells JAX-RS what to scan (there are other methods as well).
ApiListingResource.class is just a JAX-RS endpoint like any of your own. From: <[email protected]> on behalf of Bryan Nelson <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Thursday, 23 February 2017 at 12:54 To: Swagger <[email protected]> Subject: Re: Dynamic Filtering of APIs Now this is becoming more clear. The Application class is the starting point of your JAX-RS app. I Ok, I understand that. It triggers the scanning of your resources Ok. I got that. and exposes them as a rest service. This is where I'm confused...under what endpoint is it registered? Are you saying it is just exposing it at the root of whatever the ApplicationPath annotation has on the extended Application class? That seems to be the case but I guess my confusion is where is that happening? Does BeanConfig do that? Thanks for bearing with me; I really want to understand this! On Thursday, February 23, 2017 at 3:28:15 PM UTC-5, Ron wrote: The Application class is the starting point of your JAX-RS app. It triggers the scanning of your resources and exposes them as a rest service. All you need to do is create your own Filter (extending AbstratSpecFilter) and adding it to your beanConfig as you can see in https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-2.X-Project-Setup-1.5#using-swaggers-beanconfig. Look again at https://github.com/swagger-api/swagger-samples/blob/master/java/java-jersey2/src/main/java/io/swagger/sample/util/ApiAuthorizationFilterImpl.java. The `if(params.containsKey("api_key"))` code checks if there’s a parameter called api_key. It’s just something we chose. You can choose to call it tags or whatever you want. If you want to use a header instead, you can do that too. From: <[email protected]> on behalf of Bryan Nelson <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Thursday, 23 February 2017 at 12:20 To: Swagger <[email protected]> Subject: Re: Dynamic Filtering of APIs I'm not trying to be obtuse, but how is that a web service? Also, I need it to accept input params (which would be the tags I'd want to dynamically filter on) and I don't see anyway to make that happen in what I pasted above? On Thursday, February 23, 2017 at 3:15:47 PM UTC-5, Ron wrote: So that’s your web service. You just need to add your filter to that. From: <[email protected]> on behalf of Bryan Nelson <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Thursday, 23 February 2017 at 12:06 To: Swagger <[email protected]> Subject: Re: Dynamic Filtering of APIs Ok, here's my setup. I have the UI working like mentioned above. I then have a java class that extends javax.ws.rs.core.Application where I do this: public class MyApplication extends Application { public MyApplication() { BeanConfig beanConfig = new BeanConfig(); beanConfig.setVersion("1.0"); beanConfig.setTitle("My App"); beanConfig.setDescription("My description."); beanConfig.setSchemes(new String[]{"http, https"}); beanConfig.setBasePath("/myContext/"); beanConfig.setResourcePackage("com.myPackage.rest.resource"); beanConfig.setPrettyPrint(true); beanConfig.setScan(true); } @Override public Set<Class<?>> getClasses() { Set<Class<?>> resources = new HashSet<Class<?>>(); resources.add(ApiListingResource.class); resources.add(SwaggerSerializers.class); return resources; } } That's all I have really besides all my annotations obviously. -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
