diff --git a/src/main/java/org/gcube/portlets/user/bluecloud/DdasVreIntegration.java b/src/main/java/org/gcube/portlets/user/bluecloud/DdasVreIntegration.java
index 96b5151..16138cc 100644
--- a/src/main/java/org/gcube/portlets/user/bluecloud/DdasVreIntegration.java
+++ b/src/main/java/org/gcube/portlets/user/bluecloud/DdasVreIntegration.java
@@ -52,6 +52,7 @@ public class DdasVreIntegration extends MVCPortlet {
private static String ENCODED_OTP_PARAM = "b3Rw";
private static final String OPERATION_ERROR = "/html/error_pages/operation-error.jsp";
+ private static final String TOKEN_EXPIRED = "/html/error_pages/bc-token-expired.jsp";
/**
*
*/
@@ -64,6 +65,11 @@ public class DdasVreIntegration extends MVCPortlet {
System.out.println("Read OTP="+otp);
if (otp != null && !otp.equals("")) {
JsonElement brokerRequest = checkRequest(otp);
+ if (brokerRequest == null) {//the token is expired or there was no request, return to the JSP token expired page
+ PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(TOKEN_EXPIRED);
+ dispatcher.include(renderRequest, response);
+ return;
+ }
GCubeUser currentUser = getCurrentUser(renderRequest);
log.debug("current user is + " + currentUser.getUsername() + " sending request to conductor ...");
try {
@@ -76,7 +82,13 @@ public class DdasVreIntegration extends MVCPortlet {
if (!result) { //redirect to error page
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(OPERATION_ERROR);
dispatcher.include(renderRequest, response);
+ return;
}
+ } else {
+ //the token is missing in the request URL
+ PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(TOKEN_EXPIRED);
+ dispatcher.include(renderRequest, response);
+ return;
}
}
response.setContentType("text/html");
diff --git a/src/main/webapp/html/error_pages/bc-token-expired.jsp b/src/main/webapp/html/error_pages/bc-token-expired.jsp
new file mode 100644
index 0000000..bfaa4e3
--- /dev/null
+++ b/src/main/webapp/html/error_pages/bc-token-expired.jsp
@@ -0,0 +1,25 @@
+<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui"%>
+<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui"%>
+<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme"%>
+<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%>
+<%@page import="com.liferay.portal.kernel.servlet.SessionErrors"%>
+<%@page import="com.liferay.portal.kernel.servlet.SessionMessages"%>
+<%@page import="com.liferay.portal.model.User"%>
+<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
+
+ We're sorry, it seems that too much time is passed since your order on Blue-Cloud Data Discovery & Access Service.
+ Please close this page and trigger the move to VRE again from Blue-Cloud Data Discovery & Access Service application.
+
- We're sorry, yhere was an error performing this operation. Try again, if the error occurs again please report this issue to https://support.d4science.org + We're sorry, there was an error performing this operation. Try again, if the error occurs again please report this issue to https://support.d4science.org
- Close