Skip to content
Snippets Groups Projects
Commit 9b21b7e5 authored by srosse's avatar srosse
Browse files

FXOLAT-224: generate the REST API document with a maven profile and copy the...

FXOLAT-224: generate the REST API document with a maven profile and copy the documentation in the source code
parent cbb5adc8
No related branches found
No related tags found
No related merge requests found
......@@ -192,6 +192,31 @@
<os.property.file>win.properties</os.property.file>
</properties>
</profile>
<profile>
<id>documentation</id>
<build>
<plugins>
<plugin>
<groupId>com.sun.tools.jxc.maven2</groupId>
<artifactId>maven-jaxb-schemagen-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>maven-wadl-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories>
<repository>
......@@ -617,7 +642,7 @@
<properties>
<property>
<name>applicationDocsFile</name>
<value>${basedir}/src/org/olat/restapi/support/application-doc.xml</value>
<value>src/main/java/org/olat/restapi/support/application-doc.xml</value>
</property>
</properties>
</wadlGeneratorDescription>
......@@ -626,7 +651,7 @@
<properties>
<property>
<name>grammarsFile</name>
<value>${basedir}/src/org/olat/restapi/support/application-grammars.xml</value>
<value>src/main/java/org/olat/restapi/support/application-grammars.xml</value>
</property>
</properties>
</wadlGeneratorDescription>
......@@ -660,8 +685,8 @@
<includes>
<include>application.wadl</include>
</includes>
<outputDir>${project.build.outputDirectory}</outputDir>
<stylesheet>${basedir}/src/org/olat/restapi/support/wadl_documentation.xsl</stylesheet>
<outputDir>src/main/java/org/olat/restapi/api/_content/</outputDir>
<stylesheet>src/main/java/org/olat/restapi/support/wadl_documentation.xsl</stylesheet>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
......
......@@ -28,6 +28,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
/**
*
......@@ -62,7 +63,10 @@ public class ApiWebService {
@Path("doc")
@Produces(MediaType.TEXT_HTML)
public Response getHtmlDoc() {
InputStream in = ApiWebService.class.getResourceAsStream("../../../../application.html");
InputStream in = ApiWebService.class.getResourceAsStream("_content/application.html");
if(in == null) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
return Response.ok(in).build();
}
......@@ -77,6 +81,9 @@ public class ApiWebService {
@Produces("image/jpeg")
public Response getImage1(@PathParam("filename") String filename) {
InputStream in = ApiWebService.class.getResourceAsStream("_content/" + filename);
if(in == null) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
return Response.ok(in).build();
}
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment