Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Fabio Sinibaldi | 9f0fe65a9f |
|
@ -10,11 +10,11 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@XmlRootElement
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(callSuper = true)
|
||||
//@XmlRootElement
|
||||
//@AllArgsConstructor
|
||||
//@Getter
|
||||
//@Setter
|
||||
//@ToString(callSuper = true)
|
||||
public class Field extends Document {
|
||||
|
||||
public static final String TYPE="_type";
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?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.application.geoportal.service.rest.DocsGenerator" />
|
||||
|
||||
<!-- Exclude legacy method-->
|
||||
<exclude pattern="org.gcube.application.geoportal.common.model.legacy.**"/>
|
||||
<exclude
|
||||
pattern="org.gcube.application.geoportal.service.rest.ConcessioniOverMongo"/>
|
||||
|
||||
<!-- Issue with lombok?-->
|
||||
<exclude pattern="org.gcube.application.geoportal.common.model.useCaseDescriptor.Field"/>
|
||||
|
||||
|
||||
<include
|
||||
pattern="org.gcube.application.geoportal.common.model.**"/>
|
||||
<include
|
||||
pattern="org.gcube.application.geoportal.common.rest.**"/>
|
||||
|
||||
<include
|
||||
pattern="org.bson.**"/>
|
||||
|
||||
</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" freemarkerTemplate="${project.basedir}/src/main/resources/META-INF/enunciate/d4science_docs.fmt">
|
||||
<additional-css file="css/d4science_enunciate_custom.css" />
|
||||
</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}" />
|
||||
|
||||
</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>
|
||||
|
||||
|
||||
|
@ -114,6 +114,25 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 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.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- DEPRECATED LEGACY LOGIC SUPPORT -->
|
||||
|
||||
|
@ -169,4 +188,60 @@
|
|||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Enunciate Maven plugin -->
|
||||
<plugin>
|
||||
<groupId>com.webcohesion.enunciate</groupId>
|
||||
<artifactId>enunciate-maven-plugin</artifactId>
|
||||
<version>${enunciate.version}</version>
|
||||
<configuration>
|
||||
<sourcepath-includes>
|
||||
<sourcepath-include>
|
||||
<!-- Include the "com.external:external" artifact on the sourcepath. -->
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-client</artifactId>
|
||||
</sourcepath-include>
|
||||
</sourcepath-includes>
|
||||
</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,41 @@
|
|||
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) {
|
||||
log.error("Exception while Docs. Request was {}",req,e);
|
||||
throw new WebApplicationException("Doc Exception ",e, Response.Status.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,5 +4,8 @@
|
|||
<version>1.0.0</version>
|
||||
<description>REST service for GeoPortal</description>
|
||||
<local-persistence location='target' />
|
||||
|
||||
<!-- Enunciate? -->
|
||||
<!-- <exclude>/docs/*</exclude>-->
|
||||
</application>
|
||||
|
||||
|
|
Loading…
Reference in New Issue