From ea610b4e638f8b6d9764203eba45a7b10c7367a1 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Fri, 17 Sep 2021 18:10:22 +0200 Subject: [PATCH] fixed error pages --- .../user/bluecloud/DdasVreIntegration.java | 12 +++++++++ .../html/error_pages/bc-token-expired.jsp | 25 +++++++++++++++++++ .../html/error_pages/operation-error.jsp | 4 +-- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 src/main/webapp/html/error_pages/bc-token-expired.jsp 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. +

+ + + Close diff --git a/src/main/webapp/html/error_pages/operation-error.jsp b/src/main/webapp/html/error_pages/operation-error.jsp index 923a7f1..a1ae835 100644 --- a/src/main/webapp/html/error_pages/operation-error.jsp +++ b/src/main/webapp/html/error_pages/operation-error.jsp @@ -16,9 +16,9 @@ windowState="<%=LiferayWindowState.NORMAL.toString()%>" />

- 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