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 @@ ...@@ -192,6 +192,31 @@
<os.property.file>win.properties</os.property.file> <os.property.file>win.properties</os.property.file>
</properties> </properties>
</profile> </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> </profiles>
<repositories> <repositories>
<repository> <repository>
...@@ -617,7 +642,7 @@ ...@@ -617,7 +642,7 @@
<properties> <properties>
<property> <property>
<name>applicationDocsFile</name> <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> </property>
</properties> </properties>
</wadlGeneratorDescription> </wadlGeneratorDescription>
...@@ -626,7 +651,7 @@ ...@@ -626,7 +651,7 @@
<properties> <properties>
<property> <property>
<name>grammarsFile</name> <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> </property>
</properties> </properties>
</wadlGeneratorDescription> </wadlGeneratorDescription>
...@@ -660,8 +685,8 @@ ...@@ -660,8 +685,8 @@
<includes> <includes>
<include>application.wadl</include> <include>application.wadl</include>
</includes> </includes>
<outputDir>${project.build.outputDirectory}</outputDir> <outputDir>src/main/java/org/olat/restapi/api/_content/</outputDir>
<stylesheet>${basedir}/src/org/olat/restapi/support/wadl_documentation.xsl</stylesheet> <stylesheet>src/main/java/org/olat/restapi/support/wadl_documentation.xsl</stylesheet>
<fileMappers> <fileMappers>
<fileMapper <fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper"> implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
......
...@@ -28,6 +28,7 @@ import javax.ws.rs.PathParam; ...@@ -28,6 +28,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
/** /**
* *
...@@ -62,7 +63,10 @@ public class ApiWebService { ...@@ -62,7 +63,10 @@ public class ApiWebService {
@Path("doc") @Path("doc")
@Produces(MediaType.TEXT_HTML) @Produces(MediaType.TEXT_HTML)
public Response getHtmlDoc() { 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(); return Response.ok(in).build();
} }
...@@ -77,6 +81,9 @@ public class ApiWebService { ...@@ -77,6 +81,9 @@ public class ApiWebService {
@Produces("image/jpeg") @Produces("image/jpeg")
public Response getImage1(@PathParam("filename") String filename) { public Response getImage1(@PathParam("filename") String filename) {
InputStream in = ApiWebService.class.getResourceAsStream("_content/" + filename); InputStream in = ApiWebService.class.getResourceAsStream("_content/" + filename);
if(in == null) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
return Response.ok(in).build(); return Response.ok(in).build();
} }
......
source diff could not be displayed: it is too large. Options to address this: view the blob.
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