git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@71352 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
79f7a79df7
commit
8dc99d7083
|
@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author andrea
|
* @author Andrea Manzi(CERN)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class HttpResolver extends HttpServlet {
|
public class HttpResolver extends HttpServlet {
|
||||||
|
@ -45,17 +45,18 @@ public class HttpResolver extends HttpServlet {
|
||||||
|
|
||||||
String uri = request.getParameter("smp-uri");
|
String uri = request.getParameter("smp-uri");
|
||||||
|
|
||||||
|
if (uri == null || uri.equals("")) {
|
||||||
|
logger.debug("URI not found");
|
||||||
|
response.sendError(404);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uri = uri.replace(" ","+");//the char + is removed when the servlet is doing unescaping of the query paramenters, we just put it back
|
uri = uri.replace(" ","+");//the char + is removed when the servlet is doing unescaping of the query paramenters, we just put it back
|
||||||
|
|
||||||
logger.debug("URI = "+ uri);
|
logger.debug("URI = "+ uri);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (uri == null || uri.equals("")) {
|
|
||||||
// the document has not id - not found
|
|
||||||
response.sendError(404);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
OutputStream out = response.getOutputStream();
|
OutputStream out = response.getOutputStream();
|
||||||
|
|
||||||
|
@ -77,7 +78,9 @@ public class HttpResolver extends HttpServlet {
|
||||||
in = uc.getInputStream();
|
in = uc.getInputStream();
|
||||||
}
|
}
|
||||||
catch(Exception e){
|
catch(Exception e){
|
||||||
e.printStackTrace();
|
response.sendError(404);
|
||||||
|
logger.error("Exception:", e);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,6 +93,8 @@ public class HttpResolver extends HttpServlet {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("Exception:", e);
|
logger.error("Exception:", e);
|
||||||
|
response.sendError(404);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue