feature_23113 #4

Merged
francesco.mangiacrapa merged 58 commits from feature_23113 into master 2022-04-06 09:59:06 +02:00
5 changed files with 168 additions and 8 deletions
Showing only changes of commit 5f5901845c - Show all commits

View File

@ -4,6 +4,12 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2-7.1-SNAPSHOT] - 2022-03-24
**New**
- Integrate Enunicate https://github.com/stoicflame/enunciate/
## [v2-7.0-SNAPSHOT] - 2022-01-31
**New**

13
enunciate.xml Normal file
View File

@ -0,0 +1,13 @@
<?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">
<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}/docs"/> -->
</modules>
</enunciate>

88
pom.xml
View File

@ -9,7 +9,7 @@
</parent>
<groupId>org.gcube.data.transfer</groupId>
<artifactId>uri-resolver</artifactId>
<version>2.7.0-SNAPSHOT</version>
<version>2.7.1-SNAPSHOT</version>
<packaging>war</packaging>
<description>The URI Resolver is an HTTP URI resolver implemented as an REST service which gives access trough HTTP to different gcube Resolvers and gCube Applications.</description>
@ -23,7 +23,8 @@
<jersey.version>2.24.1</jersey.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- <additionalparam>-Xdoclint:none</additionalparam> -->
<enunciate.version>2.14.0</enunciate.version>
</properties>
<dependencyManagement>
@ -256,6 +257,38 @@
<scope>test</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>com.webcohesion.enunciate</groupId> -->
<!-- <artifactId>enunciate-core-annotations</artifactId> -->
<!-- <version>${enunciate.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>com.webcohesion.enunciate</groupId> -->
<!-- <artifactId>enunciate-rt-util</artifactId> -->
<!-- <version>${enunciate.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>javax.xml.bind</groupId> -->
<!-- <artifactId>jaxb-api</artifactId> -->
<!-- <version>${jaxb.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>com.sun.xml.bind</groupId> -->
<!-- <artifactId>jaxb-core</artifactId> -->
<!-- <version>${jaxb-core.version}</version> -->
<!-- </dependency> -->
<!-- Required for Enunciate plugin -->
<dependency>
<groupId>org.geotoolkit</groupId>
<artifactId>geotk-xml-base</artifactId>
<version>3.20-geoapi-3.0</version>
</dependency>
</dependencies>
<build>
@ -276,8 +309,7 @@
</resource>
</resources>
<!-- <finalName>${artifactId}</finalName> -->
<!-- Enunciate Maven plugin -->
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
@ -286,6 +318,52 @@
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- Enunciate Maven plugin -->
<plugin>
<groupId>com.webcohesion.enunciate</groupId>
<artifactId>enunciate-maven-plugin</artifactId>
<version>${enunciate.version}</version>
<configuration>
<docsDir>${project.build.directory}/docs</docsDir>
</configuration>
<executions>
<execution>
<id>assemble</id>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Copy Enunciate Docs -->
<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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
@ -304,6 +382,8 @@
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,56 @@
/**
*
*/
package org.gcube.datatransfer.resolver.services;
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.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Oct 22, 2018
*/
@Path("docs")
public class UriResolverDocs {
private static Logger logger = LoggerFactory.getLogger(UriResolverDocs.class);
@GET
@Produces({MediaType.TEXT_HTML})
@Path("")
public InputStream index(@Context HttpServletRequest req) throws WebApplicationException{
String indexFile = "/docs/index.html";
try{
logger.info(UriResolverDocs.class.getSimpleName() +" called");
String realPath = req.getServletContext().getRealPath(indexFile);
return new FileInputStream(new File(realPath));
}catch (Exception e) {
if(!(e instanceof WebApplicationException)){
//UNEXPECTED EXCEPTION managing it as WebApplicationException
String error = "Index.jsp not found. Please, contact the support!";
throw ExceptionManager.internalErrorException(req, error, this.getClass(), null);
}
//ALREADY MANAGED AS WebApplicationException
logger.error("Exception:", e);
throw (WebApplicationException) e;
}
}
}

View File

@ -18,11 +18,11 @@ body {
height: 300px;
margin-top: -150px; /*set to a negative number 1/2 of your height*/
margin-left: -300px; /*set to a negative number 1/2 of your width*/
/* border: 1px solid #ccc; */
/* border: 1px solid #ccc; */
/* background-color: #9b9b9b; */
position: fixed;
text-align: center;
/* vertical-align: middle; */
/* vertical-align: middle; */
}
.myTitle {
@ -39,8 +39,13 @@ body {
<div class="myTitle">The URI Resolver</div>
<p>
See wiki page at <a
href="https://gcube.wiki.gcube-system.org/gcube/index.php/URI_Resolver" target="_blank">gCube Wiki URI
Resolver</a>
href="https://gcube.wiki.gcube-system.org/gcube/index.php/URI_Resolver"
target="_blank">gCube Wiki URI Resolver</a>
</p>
<p>
See API documentation at <a
href="docs/index.html"
target="_blank">URI Resolver API</a>
</p>
</div>
</body>