title: Swagger for Jersey API using embedded Grizzly
body: <p>I'm pretty new to JAVA, and more specifically REST based services in JAVA.</p>
  
  <p>I'm using Grizzly as an embedded web server, serving up a Jersey REST API. That's all working great, but when I try to add in Swagger to document the API, it doesn't work.</p>
  
  <p>Here is my POM (using maven)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
           &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
           &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
          &lt;groupId&gt;swagger_test&lt;/groupId&gt;
          &lt;artifactId&gt;swagger_grizzly_test&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
          &lt;!-- bring in all the jersey dependencies we need, from the same version --&gt;
          &lt;dependencyManagement&gt;
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.glassfish.jersey&lt;/groupId&gt;
                      &lt;artifactId&gt;jersey-bom&lt;/artifactId&gt;
                      &lt;version&gt;2.13&lt;/version&gt;
                      &lt;type&gt;pom&lt;/type&gt;
                      &lt;scope&gt;import&lt;/scope&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
          &lt;/dependencyManagement&gt;
  
          &lt;dependencies&gt;
              &lt;!-- the web server --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
                  &lt;artifactId&gt;jersey-container-grizzly2-http&lt;/artifactId&gt;
              &lt;/dependency&gt;
              &lt;!-- json serializer --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
                  &lt;artifactId&gt;jersey-media-json-jackson&lt;/artifactId&gt;
                  &lt;version&gt;2.10.1&lt;/version&gt;
              &lt;/dependency&gt;
              &lt;!-- jersey for API documentation --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;com.wordnik&lt;/groupId&gt;
                  &lt;artifactId&gt;swagger-jersey-jaxrs_2.10&lt;/artifactId&gt;
                  &lt;version&gt;1.3.12&lt;/version&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/project&gt;
  </code></pre>
  
  <p>And here is my Main function, launching the server. Note my 'Browse' resource is under the package 'resources'.</p>
  
  <pre><code>public class Main
      {
      public static void main(String [ ] args)
          {
          String restUrl = "http://localhost:8080";
  
          // Grizzly makes you add the resources you want to expose
          final ResourceConfig rc = new ResourceConfig().packages ("resources", "com.wordnik.swagger.jersey.listing");
  
          HttpServer server = null;
          try
              {
              server = GrizzlyHttpServerFactory.createHttpServer(URI.create (restUrl), rc);
              server.start();
              System.out.println("Started...");
              }
          catch (Exception e)
              {
              System.out.println("Failed to start (" + e.toString () + ")");
              }
  
          // Wait for the user to close out of the app
          try{System.in.read();} catch (IOException e) {}
  
          if(server != null)
              {
              server.shutdownNow ();
              }
          }
      }
  </code></pre>
  
  <p>Lastly, here is my one and only resource.</p>
  
  <pre><code>@Path("browse")
  @Api(value = "/browse", description = "Browse tags")
  public class Browse
      {
      @GET
      @Produces(MediaType.APPLICATION_JSON)
      @ApiOperation(value = "Browse for tags", notes = "Returns all tags in a flat list")
      @ApiResponses(value = {
              @ApiResponse(code = 200, message = "OK"),
              @ApiResponse(code = 500, message = "Something wrong in Server")})
      public String browse ()
          {
          return "Hello World";
          }
      }
  </code></pre>
  
  <p>If I go to <a href="http://localhost:8080/api-docs" rel="nofollow">http://localhost:8080/api-docs</a> I get...</p>
  
  <pre><code>{
  apiVersion: "1.0.0",
  swaggerVersion: "1.2"
  }
  </code></pre>
  
  <p>Note there are no APIs listed. I've followed a number of tutorials, but I'm not using servlets (directly) so I think this is a little different?</p>
  
  <p>Any help would be awesome!</p>