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:
parent
2d72dfcf59
commit
2599d46959
8
pom.xml
8
pom.xml
|
@ -1,5 +1,4 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
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">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
|
@ -99,6 +98,11 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- jersey -->
|
<!-- jersey -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jersey.ext</groupId>
|
||||||
|
<artifactId>jersey-mvc-jsp</artifactId>
|
||||||
|
<version>2.13</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.ws.rs</groupId>
|
<groupId>javax.ws.rs</groupId>
|
||||||
<artifactId>javax.ws.rs-api</artifactId>
|
<artifactId>javax.ws.rs-api</artifactId>
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.datatransfer.resolver;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
import org.glassfish.jersey.server.ResourceConfig;
|
import org.glassfish.jersey.server.ResourceConfig;
|
||||||
|
import org.glassfish.jersey.server.mvc.jsp.JspMvcFeature;
|
||||||
|
|
||||||
@Path("uri-resolver")
|
@Path("uri-resolver")
|
||||||
public class UriResolver extends ResourceConfig {
|
public class UriResolver extends ResourceConfig {
|
||||||
|
@ -10,7 +11,9 @@ public class UriResolver extends ResourceConfig {
|
||||||
public UriResolver() {
|
public UriResolver() {
|
||||||
// Register all resources present under the package.
|
// Register all resources present under the package.
|
||||||
packages("org.gcube.datatransfer.resolver.services","org.gcube.datatransfer.resolver.requesthandler");
|
packages("org.gcube.datatransfer.resolver.services","org.gcube.datatransfer.resolver.requesthandler");
|
||||||
|
property(JspMvcFeature.TEMPLATES_BASE_PATH, "/WEB-INF/jsp");
|
||||||
|
register(JspMvcFeature.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,8 @@ public class StorageIDResolver {
|
||||||
* @return the storage id
|
* @return the storage id
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
//@Path("{storage-id:(?!index.jsp)[^/?$]*}")
|
@Path("{storage-id:(?!index)[^/?$]*}")
|
||||||
@Path("{storage-id}")
|
//@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) {
|
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");
|
logger.info("resolve Storage-Id called");
|
||||||
//Checking mandatory parameter storageId
|
//Checking mandatory parameter storageId
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,6 +6,7 @@ package org.gcube.datatransfer.resolver.services.error;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -20,6 +21,7 @@ import lombok.experimental.Builder;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Builder
|
@Builder
|
||||||
|
@XmlType (propOrder={"name","httpErrorCode","message","reportedBy"})
|
||||||
public class ErrorReport implements Serializable{
|
public class ErrorReport implements Serializable{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.io.Serializable;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -26,6 +27,7 @@ import lombok.experimental.Builder;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@Builder
|
@Builder
|
||||||
|
@XmlType (propOrder={"request","method","success","error", "help"})
|
||||||
public class ExceptionReport implements Serializable{
|
public class ExceptionReport implements Serializable{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue