Help with RestEasy Swagger integration

306 views
Skip to first unread message

mkurian

unread,
Apr 12, 2014, 4:34:23 PM4/12/14
to swagger-sw...@googlegroups.com

But still run into issues like resource not found. 


In my case, there are multiple rest resources and providers. So I just appended the swagger dependencies to those. I do see "ResteasyDeployment Adding singleton resource ... from Application javax.ws.rs.core.Application" in the logs. But when I access the url for api-docs, get the 'Could not find resource ' exception.


Here are the snippets from my web.xml:


<context-param>
<param-name>resteasy.resources</param-name>
<param-value>com.wordnik.swagger.jaxrs.listing.ApiListingResourceJSON        </param-value>
</context-param>
<context-param>
<param-name>resteasy.providers</param-name>
<param-value>com.wordnik.swagger.jaxrs.listing.ApiDeclarationProvider,com.wordnik.swagger.jaxrs.listing.ResourceListingProvider</param-value>
</context-param>
 <context-param>
    <param-name>javax.ws.rs.core.Application</param-name>
    <param-value>com.xx.yy.MyApplication</param-value>
  </context-param>
  <context-param>
    <param-name>resteasy.servlet.mapping.prefix</param-name>
    <param-value>/api-docs</param-value>
  </context-param>

 <servlet>
    <servlet-name>DefaultJaxrsConfig</servlet-name>
    <servlet-class>com.wordnik.swagger.jaxrs.config.DefaultJaxrsConfig</servlet-class>
    <init-param>
      <param-name>api.version</param-name>
      <param-value>v1</param-value>
    </init-param>

    <load-on-startup>1</load-on-startup>
  </servlet>

One thing I clearly see missing from the Jersey example is the following. What is the resteasy equivalent of this? How do I convey to resteasy to scan particular set of resources(not all of them) for the purpose of generating documentation and how do I access the documentation(url) in this particular example?

     <filter>
        <filter-name>jersey</filter-name>
        <filter-class>com.sun.jersey.spi.container.servlet.ServletContainer</filter-class>
    <init-param>
        <param-name>com.sun.jersey.config.property.packages</param-name>
        <param-value>com.xx.yy;com.wordnik.swagger.jersey.listing</param-value>
    </init-param>
    </filter>
    <filter-mapping>
        <filter-name>jersey</filter-name>
        <url-pattern>/xx/*</url-pattern>
        <url-pattern>/api-docs</url-pattern>
    </filter-mapping>

Any help is greatly appreciated.

mkurian

unread,
Apr 12, 2014, 4:38:56 PM4/12/14
to swagger-sw...@googlegroups.com

I indeed added the JacksonProvider in the list of providers as documented, but got a classnotfound exception. Which jar contains this class and where should I include it?

tony tam

unread,
Apr 13, 2014, 7:08:15 PM4/13/14
to swagger-sw...@googlegroups.com
Hi, can you get the sample to run?  I suggest looking at the environment differences between that and your application.  What are your dependencies?
Reply all
Reply to author
Forward
0 new messages