title: Swagger interacting with Resteasy not listing content api
body: <p>We're trying to have Swagger interact with our resteasy app so that the api will list out on the swagger page.  We're using annotations in the Java resources and not a yaml/json file.  We want the content to be 'dynamic' or come directly from the resource pages.</p>
  
  <p>When we bring up the swagger page, we get the message 'fetching resource list: //10.155.63.136/nodeMgmt'.  When I render the page using firebug, I see that the page itself (index.html) is being 'fed in' to the content.</p>
  
  <p>I think I'm pretty close but am missing one or two small things.  I used the example as a guide to what I did:  <a href="https://github.com/mrj365/RestEasy-3.09-Spring-3.2.5-Swagger2.0" rel="nofollow noreferrer">https://github.com/mrj365/RestEasy-3.09-Spring-3.2.5-Swagger2.0</a></p>
  
  <p>Again, the issue is that the content from the resteasy api is not being fed into the swagger ui.  The url in my case is <a href="https://10.155.63.92/nodeMgmt/index.html" rel="nofollow noreferrer">https://10.155.63.92/nodeMgmt/index.html</a></p>
  
  <p>We're using JBoss 6.4, NO Spring, Resteasy 3.0.7, Swagger jaxrs 1.5.9.</p>
  
  <p>Any help is really appreciated.</p>
  
  <p>Index.html</p>
  
  <pre><code>  &lt;script type="text/javascript"&gt;
      $(function () {
          window.swaggerUi = new SwaggerUi({
          url: "/nodeMgmt",
          dom_id: "swagger-ui-container",
          supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
          onComplete: function(swaggerApi, swaggerUi){
              log("Loaded SwaggerUI");
  
              $('pre code').each(function(i, e) {
                  hljs.highlightBlock(e)
              });
          },
          onFailure: function(data) {
              log("Unable to Load SwaggerUI");
          },
          docExpansion: "none"
      });
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>  &lt;!-- Auto scan REST service --&gt;
     &lt;context-param&gt;
        &lt;param-name&gt;resteasy.scan&lt;/param-name&gt;
        &lt;param-value&gt;true&lt;/param-value&gt;
     &lt;/context-param&gt;
  
     &lt;context-param&gt;
        &lt;param-name&gt;resteasy.servlet.mapping.prefix&lt;/param-name&gt;
        &lt;param-value&gt;/nodes&lt;/param-value&gt;
     &lt;/context-param&gt;
  
  
    &lt;filter&gt;
      &lt;filter-name&gt;ApiOriginFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;com.sonus.unity.sonusbaserestservice.utils.ApiOriginFilter&lt;/filter-class&gt;
    &lt;/filter&gt;
  
    &lt;filter-mapping&gt;
      &lt;filter-name&gt;ApiOriginFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/index.html&lt;/url-pattern&gt;
    &lt;/filter-mapping&gt;
  
     &lt;!-- if you are using Spring, Seam or EJB as your component model, remove the ResourceMethodSecurityInterceptor --&gt;
     &lt;context-param&gt;
        &lt;param-name&gt;resteasy.resource.method-interceptors&lt;/param-name&gt;
        &lt;param-value&gt;
           org.jboss.resteasy.core.ResourceMethodSecurityInterceptor
        &lt;/param-value&gt;
     &lt;/context-param&gt;
  
     &lt;listener&gt;
        &lt;listener-class&gt;org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap&lt;/listener-class&gt;
     &lt;/listener&gt;
  
     &lt;servlet&gt;
        &lt;servlet-name&gt;Resteasy&lt;/servlet-name&gt;
        &lt;servlet-class&gt;org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher&lt;/servlet-class&gt;
               &lt;init-param&gt;
                  &lt;param-name&gt;javax.ws.rs.Application&lt;/param-name&gt;
                  &lt;param-value&gt;com.sonus.ems.nodemgmt.web.NodeMgmtApplication&lt;/param-value&gt;
              &lt;/init-param&gt;
     &lt;/servlet&gt;
  
     &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;Resteasy&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/nodes/*&lt;/url-pattern&gt;
     &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>application.java</p>
  
  <pre><code>@ApplicationPath("")
  public class NodeMgmtApplication extends SonusBaseRestApplication  {
      private static final Logger log = Logger.getLogger(NodeMgmtApplication.class);
  
      /**
       *  Constructor
       */
      public NodeMgmtApplication() {
          super();
  
          try {
              //TODO Swagger
              // Used for defining swagger
              BeanConfig beanConfig = new BeanConfig();
              beanConfig.setSchemes(new String[]{"http"});
              beanConfig.setHost("localhost:8080");
              beanConfig.setVersion("1.5.9");
              beanConfig.setBasePath("/nodeMgmt");
              beanConfig.setResourcePackage("com.sonus.ems.nodemgmt.web");
              //beanConfig.setPrettyPrint(true);
              beanConfig.setScan(true);
  
              addService(new NodeMgmtAuthorizationFilter());
              addService(new NodeMgmtRestService());
  
              // Swagger
              addService(new ApiListingResource());
              addService(new SwaggerSerializers());
          } catch (Exception e) {
              log.error("NodeAdminApplication: Could not instantiate singletons " + e);
          }
      }
  </code></pre>
  
  <p>resource.java</p>
  
  <pre><code>@Path("/")
  @Api(value = "/", description = "Node operations", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
  public class NodeMgmtRestService {
      private static final Logger log = Logger.getLogger(NodeMgmtRestService.class);
  
      private static final String NODES = "nodes";
      private static final String ID = "id";
  
  
      NodeMgmtServiceProvider nodeMgmtServiceProvider = new NodeMgmtServiceProvider();
  
      Service nodeMgmtService;
  
  
      @GET
      @Path("/{version}")
      @Produces(MediaType.APPLICATION_JSON)
      @ApiOperation(value = "Get all nodes", notes = "Returns a list of node", response = String.class, responseContainer="List")
      public Response getNodes(
              @ApiParam(value = "Version of api (1.0)", required = true) @PathParam("version") String version,
              @ApiParam(value = "Filter by ", required = true) @QueryParam("filterParam") String filterParam,
              @ApiParam(value = "Filter value ", required = true) @QueryParam("filterValue") String filterValue) {
          List&lt;Node&gt; nodeList = new ArrayList&lt;Node&gt;();
          List&lt;Object&gt; nodeJsonList = new ArrayList&lt;Object&gt;();
          Map&lt;String, List&lt;Object&gt;&gt; nodeJsonMap = new HashMap&lt;String, List&lt;Object&gt;&gt;();
          ObjectMapper objectMapper = new ObjectMapper();
          Map&lt;String, String&gt; responseId = new HashMap&lt;String, String&gt;();
          JsonNodeDao jsonNodeDao = new JsonNodeDao();
  </code></pre>
  
  <p>Swagger API key</p>
  
  <pre><code>public class ApiOriginFilter implements Filter {
  
      @Override
        public void doFilter(
                ServletRequest request, 
                ServletResponse response,
                FilterChain chain) throws IOException, ServletException {
          HttpServletResponse res = (HttpServletResponse) response;
  
          // Add access to the header 
          res.addHeader("Access-Control-Allow-Origin", "*");
          res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, PATCH, OPTIONS");
          res.addHeader("Access-Control-Allow-Headers", "Content-Type, api_key, Authorization");
          //res.addHeader("Access-Control-Allow-Headers", "Origin, X-Atmosphere-tracking-id, X-Atmosphere-Framework, X-Cache-Date, Content-Type, api_key, Authorization, X-Atmosphere-Transport, x-requested-with, Total-Count, Total-Pages, Error-Message, *");
          //res.addHeader("Access-Control-Request-Headers", "Origin, X-Atmosphere-tracking-id, X-Atmosphere-Framework, X-Cache-Date, Content-Type, api_key, Authorization, X-Atmosphere-Transport, x-requested-with, Total-Count, Total-Pages, Error-Message,  *");
  
          chain.doFilter(request, response);
        }
  
        @Override
        public void destroy() {
        }
  
        @Override
        public void init(FilterConfig filterConfig) throws ServletException {
        }
  </code></pre>