My problem is that, i have an RESTEasy api with seam in java, a maven project, this works correctly but when im trying to document this api with swagger, the swagger.json file is never founded. I dont know what the problem is.
pom.xml:
<dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam-resteasy</artifactId>
<version>2.2.2.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.2.2.GA</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>2.2.2.GA</version>
</dependency>
<!-- Dependencia swagger -->
<!-- https://mvnrepository.com/artifact/io.swagger/swagger-annotations -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.20</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.swagger/swagger-jaxrs -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>1.5.20</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.swagger/swagger-core -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
<version>1.5.20</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.swagger/swagger-models -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.20</version>
</dependency>
web.xml:
<!-- Swagger -->
<servlet>
<servlet-name>SwaggerConfigurationServlet</servlet-name>
<display-name>SwaggerConfigurationServlet</display-name>
<description></description>
<servlet-class>packageOfSwaggerConfiguration.SwaggerConfigurationServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>`
SwaggerConfigurationServlet:
@ApplicationPath("v3")
public class SwaggerConfigurationServlet extends Application {
/**
*
*/
private static final long serialVersionUID = -9026370104891567770L;
public void Init(ServletConfig config) throws ServletException{
BeanConfig beanConfig=new BeanConfig();
beanConfig.setSchemes(new String[] {"http"});
beanConfig.setBasePath("http://localhost:8080/NameOfProyect/seam/resource/rest");
beanConfig.setTitle("Swagger");
beanConfig.setVersion("1.0");
beanConfig.setResourcePackage("PackageOfApi");
beanConfig.setScan(true);
beanConfig.setPrettyPrint(true);
}
public Set<Class<?>> getClasses() {
Set<Class<?>> s = new HashSet<Class<?>>();
// here I add my REST WSs
s.add(ApiListingResource.class);
s.add(SwaggerSerializers.class);
return s;
}
index.html:
$(function () {
var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
url = decodeURIComponent(url[1]);
} else {
url = "http://localhost:8080/NameOfProyect/seam/resource/rest/swagger.json";
}
I expect that the swagger.json file is in http://localhost:8080/NameOfProyect/seam/resource/rest/swagger.json or http://localhost:8080/NameOfProyect/seam/resource/rest/v3/swagger.json
but is never founded.
I guess your application path is wrong. Should you check it.