#21093 changed status code from 204 to 200
This commit is contained in:
parent
78784473f6
commit
6038760a39
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -4,18 +4,22 @@
|
|||
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-5-0-SNAPSHOT] - 2021-30-03
|
||||
## [v2-5-0-SNAPSHOT] - 2021-04-08
|
||||
|
||||
**New features**
|
||||
|
||||
[Task #20993] Supported new resource "Wekeo Interface" - gettoken.
|
||||
[#20993] Supported new resource "Wekeo Interface" - gettoken.
|
||||
|
||||
**Bug fixes**
|
||||
|
||||
[#21093] StorageHubResolver HEAD request does not support Content-Length
|
||||
|
||||
|
||||
## [v2-4-1] - 2021-01-13
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
[Task #19942] Fixing master build fails
|
||||
[#19942] Fixing master build fails
|
||||
|
||||
|
||||
## [v2-4-0] [r4-24-0]- 2020-06-18
|
||||
|
|
|
@ -71,7 +71,7 @@ public class StorageHubResolver {
|
|||
|
||||
ItemManagerClient client = AbstractPlugin.item().build();
|
||||
StreamDescriptor descriptor = client.resolvePublicLink(id);
|
||||
ResponseBuilder response = Response.noContent();
|
||||
ResponseBuilder response = Response.ok();
|
||||
response = new StorageHubMetadataResponseBuilder(req, response).fillMetadata(descriptor, id, CONTENT_DISPOSITION_VALUE.attachment);
|
||||
return response.build();
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package org.gcube.datatransfer.resolver.services;
|
|||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
|
@ -181,23 +183,29 @@ public class WekeoResolver {
|
|||
}
|
||||
|
||||
@GET
|
||||
@Produces({MediaType.TEXT_HTML})
|
||||
@Path("")
|
||||
@Produces(MediaType.TEXT_HTML)
|
||||
public Response getIndex(@Context HttpServletRequest req) {
|
||||
logger.info(this.getClass().getSimpleName()+" getIndex starts...");
|
||||
public InputStream index(@Context HttpServletRequest req) throws WebApplicationException{
|
||||
|
||||
StringBuilder wekeoResponse = new StringBuilder();
|
||||
wekeoResponse.append("<h1>Welcome to Wekeo Resolver</h1>");
|
||||
wekeoResponse.append("<div>See documentation at: "+helpURI +"</div>");
|
||||
String wekeoGetTokenURL = String.format("%s/%s", Util.getServerURL(req), "wekeo/gettoken");
|
||||
wekeoResponse.append("<div>Go to <i>gettoken</i> request: "+wekeoGetTokenURL +"</div>");
|
||||
String indexFile = "/WEB-INF/jsp/wekeo.jsp";
|
||||
|
||||
String theResponse = wekeoResponse.toString();
|
||||
logger.info("debug: \n"+theResponse);
|
||||
return Response.ok(theResponse).build();
|
||||
try{
|
||||
logger.info(UriResolverIndex.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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reads the wekeo endpoint information from IS. {The SE name is: @link WekeoResolver#RUNTIME_WKEO_RESOURCE_NAME}
|
||||
*
|
||||
|
@ -225,7 +233,7 @@ public class WekeoResolver {
|
|||
if(toReturn.size()==0){
|
||||
String errorMessage = String.format("Missing the RR with Name '%s' and Category '%s' in the scope '%s'. Please contact the support.",RUNTIME_WKEO_RESOURCE_NAME,CATEGORY_WEKEO_TYPE,ScopeProvider.instance.get());
|
||||
logger.error(errorMessage);
|
||||
throw ExceptionManager.internalErrorException(req, errorMessage, AnalyticsCreateResolver.class, helpURI);
|
||||
throw ExceptionManager.internalErrorException(req, errorMessage, WekeoResolver.class, helpURI);
|
||||
}
|
||||
|
||||
String wekeoUsername = null;
|
||||
|
@ -247,7 +255,7 @@ public class WekeoResolver {
|
|||
}catch(Exception e){
|
||||
String errorMessage = "Error occurred on reading the "+RUNTIME_WKEO_RESOURCE_NAME+" SE registered in the scope: "+ScopeProvider.instance.get();
|
||||
logger.error(errorMessage, e);
|
||||
throw ExceptionManager.internalErrorException(req, errorMessage, AnalyticsCreateResolver.class, helpURI);
|
||||
throw ExceptionManager.internalErrorException(req, errorMessage, WekeoResolver.class, helpURI);
|
||||
|
||||
}finally{
|
||||
if(callerScope!=null){
|
||||
|
|
|
@ -58,8 +58,10 @@ public class StorageHubMetadataResponseBuilder {
|
|||
responseBuilder.header("Content-Location", contentLocation);
|
||||
|
||||
//Managing "Content-Type"
|
||||
if (streamDescriptor.getContentType()!= null && !streamDescriptor.getContentType().isEmpty())
|
||||
if (streamDescriptor.getContentType()!= null && !streamDescriptor.getContentType().isEmpty()) {
|
||||
|
||||
responseBuilder.header("Content-Type", streamDescriptor.getContentType());
|
||||
}
|
||||
|
||||
//Managing "Content-Lenght"
|
||||
if(streamDescriptor.getContentLenght()>0) {
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body {
|
||||
background-color: #f8f6f2;
|
||||
color: #225f97;
|
||||
font-family: 'Droid Sans', arial, sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.mydiv {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 600px;
|
||||
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; */
|
||||
/* background-color: #9b9b9b; */
|
||||
position: fixed;
|
||||
text-align: center;
|
||||
/* vertical-align: middle; */
|
||||
}
|
||||
|
||||
.myTitle {
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="mydiv">
|
||||
<img alt=""
|
||||
src="https://www.d4science.org/image/layout_set_logo?img_id=12630" />
|
||||
<div class="myTitle">The Wekeo Resolver</div>
|
||||
<div>Available Operations:
|
||||
<ul>
|
||||
<li> getToken at <%=request.getRequestURL()%>/gettoken
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p>
|
||||
See wiki page at <a
|
||||
href="https://gcube.wiki.gcube-system.org/gcube/URI_Resolver#Wekeo_Resolver" target="_blank">gCube Wiki Wekeo
|
||||
Resolver</a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue