Enunciate integration
This commit is contained in:
parent
7df98cb40e
commit
a2b9b8d5e8
|
@ -0,0 +1,27 @@
|
|||
<?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>
|
||||
<!-- Use patterns to exclude classes...
|
||||
|
||||
e.g. for URI-Resolver
|
||||
|
||||
-->
|
||||
<exclude pattern="org.gcube.application.geoportal.service.rest.DocsGenerator" />
|
||||
<exclude pattern="org.gcube.application.geoportal.service.rest.ConcessioniOverMongo" />
|
||||
</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" />
|
||||
<!-- REPLACE THE ${project.artifactId} WITH YOUR APPLICATION NAME. E.g. /gcat, /uri-resolver. if the ${project.artifactId} is not matching your APPLICATION Name /> -->
|
||||
<swagger basePath="/${project.artifactId}" />
|
||||
<docs freemarkerTemplate="${project.basedir}/src/main/resources/META-INF/enunciate/d4science_docs.fmt">
|
||||
<additional-css file="css/d4science_enunciate_custom.css" />
|
||||
</docs>
|
||||
</modules>
|
||||
</enunciate>
|
|
@ -17,7 +17,7 @@
|
|||
<properties>
|
||||
<gitBaseUrl>https://code-repo.d4science.org/gCubeSystem</gitBaseUrl>
|
||||
<sis.version>1.0</sis.version>
|
||||
|
||||
<enunciate.version>2.14.0</enunciate.version>
|
||||
</properties>
|
||||
|
||||
|
||||
|
@ -90,14 +90,29 @@
|
|||
</dependency>
|
||||
|
||||
|
||||
<!-- JERSEY -->
|
||||
|
||||
<!-- enunciate deps -->
|
||||
<dependency>
|
||||
<groupId>com.webcohesion.enunciate</groupId>
|
||||
<artifactId>enunciate-core-annotations</artifactId>
|
||||
<version>${enunciate.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.webcohesion.enunciate</groupId>
|
||||
<artifactId>enunciate-rt-util</artifactId>
|
||||
<version>${enunciate.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- JERSEY -->
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
|
@ -115,6 +130,8 @@
|
|||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- DEPRECATED LEGACY LOGIC SUPPORT -->
|
||||
|
||||
<!-- POSTGRES DRIVERS -->
|
||||
|
@ -169,4 +186,51 @@
|
|||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Enunciate Maven plugin -->
|
||||
<plugin>
|
||||
<groupId>com.webcohesion.enunciate</groupId>
|
||||
<artifactId>enunciate-maven-plugin</artifactId>
|
||||
<version>${enunciate.version}</version>
|
||||
<configuration>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>assemble</id>
|
||||
<goals>
|
||||
<goal>assemble</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Copy Enunciate Documentation from your-application/docs to your-application.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,43 @@
|
|||
package org.gcube.application.geoportal.service.rest;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
@Path("docs")
|
||||
@Slf4j
|
||||
public class DocsGenerator {
|
||||
|
||||
@GET
|
||||
@Path("/{any: .*}")
|
||||
public InputStream toDoc(@Context HttpServletRequest req) throws WebApplicationException {
|
||||
log.info(DocsGenerator.class.getSimpleName() + " toDoc called");
|
||||
|
||||
String pathInfo = req.getPathInfo();
|
||||
log.debug("pathInfo {}", pathInfo);
|
||||
try {
|
||||
|
||||
if (pathInfo.endsWith("/docs/")) {
|
||||
pathInfo += "index.html";
|
||||
}
|
||||
|
||||
log.info("going to {}", pathInfo);
|
||||
|
||||
String realPath = req.getServletContext().getRealPath(pathInfo);
|
||||
return new FileInputStream(new File(realPath));
|
||||
|
||||
} catch (Exception e) {
|
||||
//MANAGE THE EXCEPTION
|
||||
log.error("Unexpected exception ",e);
|
||||
throw new WebApplicationException("Unexpected Exception : "+e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package org.gcube.application.geoportal.service.rest;
|
||||
|
||||
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gcube.application.cms.implementations.ImplementationProvider;
|
||||
import org.gcube.application.cms.plugins.Plugin;
|
||||
|
@ -17,6 +19,10 @@ import java.util.Map;
|
|||
|
||||
@Path(InterfaceConstants.Methods.PLUGINS)
|
||||
@Slf4j
|
||||
@RequestHeaders({
|
||||
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
|
||||
@RequestHeader( name = "Content-Type", description = "application/json")
|
||||
})
|
||||
public class Plugins {
|
||||
|
||||
@GET
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.gcube.application.geoportal.service.rest;
|
||||
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bson.Document;
|
||||
import org.gcube.application.cms.implementations.ImplementationProvider;
|
||||
|
@ -24,6 +26,10 @@ import java.util.List;
|
|||
|
||||
@Path(InterfaceConstants.Methods.PROJECTS+"/{"+InterfaceConstants.Parameters.UCID +"}")
|
||||
@Slf4j
|
||||
@RequestHeaders({
|
||||
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
|
||||
@RequestHeader( name = "Content-Type", description = "application/json")
|
||||
})
|
||||
public class ProfiledDocuments {
|
||||
|
||||
private ProfiledMongoManager manager;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.gcube.application.geoportal.service.rest;
|
||||
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
||||
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gcube.application.cms.implementations.ImplementationProvider;
|
||||
import org.gcube.application.cms.serialization.Serialization;
|
||||
|
@ -13,6 +15,10 @@ import javax.ws.rs.core.Response;
|
|||
|
||||
@Path(InterfaceConstants.Methods.UCD)
|
||||
@Slf4j
|
||||
@RequestHeaders({
|
||||
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
|
||||
@RequestHeader( name = "Content-Type", description = "application/json")
|
||||
})
|
||||
public class UseCaseDescriptors {
|
||||
|
||||
|
||||
|
|
|
@ -4,5 +4,9 @@
|
|||
<version>1.0.0</version>
|
||||
<description>REST service for GeoPortal</description>
|
||||
<local-persistence location='target' />
|
||||
|
||||
|
||||
<exclude>/docs/*</exclude>
|
||||
|
||||
</application>
|
||||
|
||||
|
|
Loading…
Reference in New Issue