Added index.jsp but not working at the moment

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@173762 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-10-22 16:32:29 +00:00
parent 2d72dfcf59
commit 2599d46959
8 changed files with 81 additions and 37 deletions

View File

@ -1,5 +1,4 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@ -99,6 +98,11 @@
</dependency>
<!-- jersey -->
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-mvc-jsp</artifactId>
<version>2.13</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>

View File

@ -3,6 +3,7 @@ package org.gcube.datatransfer.resolver;
import javax.ws.rs.Path;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.mvc.jsp.JspMvcFeature;
@Path("uri-resolver")
public class UriResolver extends ResourceConfig {
@ -10,7 +11,9 @@ public class UriResolver extends ResourceConfig {
public UriResolver() {
// Register all resources present under the package.
packages("org.gcube.datatransfer.resolver.services","org.gcube.datatransfer.resolver.requesthandler");
property(JspMvcFeature.TEMPLATES_BASE_PATH, "/WEB-INF/jsp");
register(JspMvcFeature.class);
}
}

View File

@ -61,8 +61,8 @@ public class StorageIDResolver {
* @return the storage id
*/
@GET
//@Path("{storage-id:(?!index.jsp)[^/?$]*}")
@Path("{storage-id}")
@Path("{storage-id:(?!index)[^/?$]*}")
//@Path("{storage-id}")
public Response getStorageId(@Context HttpServletRequest httpRequest, @PathParam(STORAGE_ID) String storageId, @QueryParam(ConstantsResolver.FILE_NAME) String fileName, @QueryParam(ConstantsResolver.CONTENT_TYPE) String contentType, @QueryParam(ConstantsResolver.VALIDATION) Boolean validation) {
logger.info("resolve Storage-Id called");
//Checking mandatory parameter storageId

View File

@ -0,0 +1,43 @@
/**
*
*/
package org.gcube.datatransfer.resolver.services;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response.Status;
import org.gcube.datatransfer.resolver.services.exceptions.InternalServerException;
import org.glassfish.jersey.server.mvc.Viewable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Oct 22, 2018
*/
@Path("/")
public class UriResolverIndex {
private static Logger logger = LoggerFactory.getLogger(UriResolverIndex.class);
@GET
@Produces(MediaType.TEXT_HTML)
@Path("index")
public Viewable index(@Context HttpServletRequest req, @PathParam("index") String info){
try{
logger.info("UriResolverIndex called");
return new Viewable("/index");
}catch(Exception e){
logger.error("Error on getting index.jsp", e);
throw new InternalServerException(req, Status.NOT_FOUND, "Index.jsp not found", UriResolverIndex.class, null);
}
}
}

View File

@ -1,32 +0,0 @@
/**
*
*/
package org.gcube.datatransfer.resolver.services;
import java.net.URI;
import java.net.URISyntaxException;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Oct 22, 2018
*/
@Path("/")
public class UriResolverInfo {
@GET
@Path("info")
public Response getInfo(){
try{
return Response.seeOther(new URI("index.jsp")).build();
}catch(URISyntaxException e){
throw new WebApplicationException("Impossible to get URI Resolver Info");
}
}
}

View File

@ -6,6 +6,7 @@ package org.gcube.datatransfer.resolver.services.error;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -20,6 +21,7 @@ import lombok.experimental.Builder;
@Getter
@Setter
@Builder
@XmlType (propOrder={"name","httpErrorCode","message","reportedBy"})
public class ErrorReport implements Serializable{
/**

View File

@ -7,6 +7,7 @@ import java.io.Serializable;
import java.net.URI;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -26,6 +27,7 @@ import lombok.experimental.Builder;
@Getter
@Setter
@Builder
@XmlType (propOrder={"request","method","success","error", "help"})
public class ExceptionReport implements Serializable{
/**

View File

@ -0,0 +1,22 @@
<!DOCTYPE HTML>
<html lang="en-US">
<!-- <head> -->
<!-- <meta charset="UTF-8"> -->
<!-- <meta http-equiv="refresh" content="0; url=https://dev4.d4science.org/ckan"> -->
<!-- <script type="text/javascript"> window.location.href = "https://dev4.d4science.org/ckan" -->
<!-- </script> -->
<!-- <title>Page Redirection</title> -->
<!-- </head> -->
<!-- <body> -->
<!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
<!-- If you are not redirected automatically, follow the <a href='https://dev4.d4science.org/ckan'>link to example</a> -->
<!-- </body> -->
<body>
<h2>The URI resolver</h2>
<p>
See wiki page: <a
href="https://gcube.wiki.gcube-system.org/gcube/index.php/URI_Resolver">URI
Resolver gCube Wiki</a>
</p>
</body>
</html>