Added docs
This commit is contained in:
parent
08b5b8adc4
commit
ad88b4ff4b
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<enunciate
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://enunciate.webcohesion.com/schemas/enunciate-2.14.0.xsd">
|
||||
<api-classes>
|
||||
<exclude pattern="org.gcube.gcat.rest.Docs" />
|
||||
</api-classes>
|
||||
<modules>
|
||||
<gwt-json-overlay disabled="true " />
|
||||
<php-json-client disabled="true" />
|
||||
<ruby-json-client disabled="true" />
|
||||
<java-json-client disabled="true" />
|
||||
<javascript-client disabled="true" />
|
||||
<docs docsDir="${project.build.directory}" docsSubdir="docs" />
|
||||
<swagger basePath="/authorization-bridge"/>
|
||||
</modules>
|
||||
</enunciate>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<application mode='online'>
|
||||
<name>${project.artifactId}</name>
|
||||
<group>${project.groupId}</group>
|
||||
<version>${project.version}</version>
|
||||
<description>${project.description}</description>
|
||||
<exclude>/docs/*</exclude>
|
||||
</application>
|
64
pom.xml
64
pom.xml
|
@ -11,9 +11,11 @@
|
|||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-bridge</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<enunciate.version>2.14.0</enunciate.version>
|
||||
</properties>
|
||||
|
||||
<scm>
|
||||
|
@ -64,6 +66,21 @@
|
|||
<artifactId>jersey-media-multipart</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Required for Enunciate plugin -->
|
||||
<dependency>
|
||||
<groupId>org.geotoolkit</groupId>
|
||||
<artifactId>geotk-xml-base</artifactId>
|
||||
<version>3.20-geoapi-3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- END Required for Enunciate plugin -->
|
||||
|
||||
<!-- Test Dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
@ -78,4 +95,51 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
<plugins>
|
||||
<!-- Enunciate Maven plugin -->
|
||||
<plugin>
|
||||
<groupId>com.webcohesion.enunciate</groupId>
|
||||
<artifactId>enunciate-maven-plugin</artifactId>
|
||||
<version>${enunciate.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>assemble</id>
|
||||
<goals>
|
||||
<goal>assemble</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Copy Enunciate Documentation from your-application/docs into your war -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-enunciate-docs</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>target</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>${project.build.directory}/${project.artifactId}-${project.version}/docs</targetPath>
|
||||
<directory>${project.build.directory}/docs</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,52 @@
|
|||
package org.gcube.common.authorization.rest;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.InternalServerErrorException;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.Context;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Francesco Mangiacrapa (ISTI-CNR)
|
||||
* @author Luca Frosini (ISTI-CNR)
|
||||
*/
|
||||
@Path("docs")
|
||||
public class Docs {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(Docs.class);
|
||||
|
||||
@GET
|
||||
@Path("{any: .*}")
|
||||
public InputStream toDoc(@Context HttpServletRequest req) throws WebApplicationException {
|
||||
|
||||
String pathInfo = req.getPathInfo();
|
||||
try {
|
||||
|
||||
if (pathInfo.endsWith("/docs")) {
|
||||
pathInfo += "/index.html";
|
||||
}
|
||||
|
||||
if (pathInfo.endsWith("/docs/")) {
|
||||
pathInfo += "index.html";
|
||||
}
|
||||
|
||||
logger.info("redirecting to {}", pathInfo);
|
||||
|
||||
String realPath = req.getServletContext().getRealPath(pathInfo);
|
||||
return new FileInputStream(new File(realPath));
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new InternalServerErrorException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
/LICENSE.md
|
||||
/README.md
|
||||
/changelog.xml
|
||||
/gcube-app.xml
|
||||
/CHANGELOG.md
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<web-app>
|
||||
<servlet>
|
||||
<servlet-name>org.gcube.org.gcube.common.authorization.ResourceInitializer</servlet-name>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>org.gcube.org.gcube.common.authorization.ResourceInitializer</servlet-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
</web-app>
|
Loading…
Reference in New Issue