diff --git a/enunciate.xml b/enunciate.xml
index 99d416a..5ae5a43 100644
--- a/enunciate.xml
+++ b/enunciate.xml
@@ -6,6 +6,7 @@
+
diff --git a/src/main/java/org/gcube/gcat/rest/ApiDocs.java b/src/main/java/org/gcube/gcat/rest/ApiDocs.java
new file mode 100644
index 0000000..67dd6d1
--- /dev/null
+++ b/src/main/java/org/gcube/gcat/rest/ApiDocs.java
@@ -0,0 +1,52 @@
+package org.gcube.gcat.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 Luca Frosini (ISTI-CNR)
+ */
+@Path("api-docs")
+public class ApiDocs {
+
+ private static Logger logger = LoggerFactory.getLogger(ApiDocs.class);
+
+ @GET
+ @Path("{any: .*}")
+ public InputStream toDoc(@Context HttpServletRequest req) throws WebApplicationException {
+ logger.trace("Called method to redirect to api-docs/index.html");
+
+ String pathInfo = req.getPathInfo();
+ try {
+
+ if (pathInfo.endsWith("/api-docs")) {
+ pathInfo += "/index.html";
+ }
+
+ if (pathInfo.endsWith("/api-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);
+ }
+ }
+
+}
+
diff --git a/src/main/java/org/gcube/gcat/rest/Docs.java b/src/main/java/org/gcube/gcat/rest/Docs.java
index 075201d..e6e78cb 100644
--- a/src/main/java/org/gcube/gcat/rest/Docs.java
+++ b/src/main/java/org/gcube/gcat/rest/Docs.java
@@ -15,27 +15,28 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * @author Francesco Mangiacrapa (ISTI-CNR)
* @author Luca Frosini (ISTI-CNR)
*/
-@Path("api-docs")
+@Path("docs")
public class Docs {
private static Logger logger = LoggerFactory.getLogger(Docs.class);
+
+
@GET
@Path("{any: .*}")
public InputStream toDoc(@Context HttpServletRequest req) throws WebApplicationException {
- logger.trace("Called method to redirect to api-docs/index.html");
+ logger.trace("Called method to redirect to docs/index.html");
String pathInfo = req.getPathInfo();
try {
- if (pathInfo.endsWith("/api-docs")) {
+ if (pathInfo.endsWith("/docs")) {
pathInfo += "/index.html";
}
- if (pathInfo.endsWith("/api-docs/")) {
+ if (pathInfo.endsWith("/docs/")) {
pathInfo += "index.html";
}