Я пробовал следующий код:
Класс приложения
Код: Выделить всё
public class DemoApplication extends SwaggerApplication {
public Restlet createInboundRoot() {
Router baseRouter = new Router(getContext());
DemoResource demoRestlet = new DemoResource(
getContext());
demoRestlet.setApiInboundRoot(this);
attachSwaggerDocumentationRestlets(baseRouter, "/api-docs",
demoRestlet, "/api-docs/{demo}", demoRestlet);
return baseRouter;
}
}
Код: Выделить всё
public class DemoResource extends SwaggerSpecificationRestlet {
public DemoResource(Context context) {
super(context);
}
@Override
public Representation getApiDeclaration(String category) {
try {
ApiDeclaration apiDeclaration = new JacksonRepresentation(
super.getApiDeclaration(category), ApiDeclaration.class)
.getObject();
// manipulate the API declaration object as you wish
apiDeclaration.setBasePath("demo");
return new JacksonRepresentation(apiDeclaration);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
Код: Выделить всё
SimpleRestlet
org.restlet.application
deepu.example.DemoApplication
RestletServlet
org.restlet.ext.servlet.ServerServlet
RestletServlet
/*
Код: Выделить всё
http://localhost:8080/SimpleRestlet/api-docs
Обновить
Дерево каталогов моего проекта выглядит так:

Подробнее здесь: https://stackoverflow.com/questions/285 ... ce-in-java
Мобильная версия