I tried to do a similar approach:
public Restlet createInboundRoot() { Router apiRouter = createApiRouter(); attachSwaggerSpecificationRestlet(apiRouter, "/api-docs"); return apiRouter; }
When /api-docs
is access Restlet throws Error 404, what could be messing. The idea is that the apiRouter we have is fully working at this state, when we acess resource like /stuff
etc.
What could be missing in this code? Or is there any specific notes to take into consideration when using Restlet Swagger extension for GAE?
I tested your usecase and I can make work the Swagger extension with the following Maven configuration (restlet-version
= 2.3.1)AE dev server:
<dependencies> <dependency> <groupId>org.restlet.gae</groupId> <artifactId>org.restlet</artifactId> <version>${restlet-version}</version> </dependency> <dependency> <groupId>org.restlet.gae</groupId> <artifactId>org.restlet.ext.servlet</artifactId> <version>${restlet-version}</version> </dependency> <dependency> <groupId>org.restlet.gae</groupId> <artifactId>org.restlet.ext.swagger</artifactId> <version>${restlet-version}</version> <exclusions> <exclusion> <groupId>org.raml</groupId> <artifactId>raml-parser</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.restlet.jse</groupId> <artifactId>org.restlet.ext.jetty</artifactId> <version>${restlet-version}</version> </dependency> </dependencies>
You can notice that I had to exclude the RAML parser within the ext.swagger
.
Here is the code of my Restlet application:
public class RestletApplication extends SwaggerApplication { @Override public Restlet createInboundRoot() { Router router = new Router(getContext()); router.attach("/ping", MyServerResource.class); attachSwaggerSpecificationRestlet(router, "/docs"); return router; } }
If it can help you, I can provide my test project within a Github repository.
Hope it helps you