fixed error pages

This commit is contained in:
Massimiliano Assante 2021-09-17 18:10:22 +02:00
parent c60631935e
commit ea610b4e63
3 changed files with 39 additions and 2 deletions

View File

@ -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");

View File

@ -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"%>
<portlet:defineObjects />
<liferay-theme:defineObjects />
<portlet:renderURL var="normalState"
windowState="<%=LiferayWindowState.NORMAL.toString()%>" />
<p class="lead">
We're sorry, it seems that too much time is passed since your order on Blue-Cloud Data Discovery &amp; Access Service. <br>
Please close this page and trigger the move to VRE again from Blue-Cloud Data Discovery &amp; Access Service application.
</p>
<a class="btn btn-large btn-primary" href="https://blue-cloud.d4science.org/"><i
class="icon icon-angle-left"></i>&nbsp;Close</a>

View File

@ -16,9 +16,9 @@
windowState="<%=LiferayWindowState.NORMAL.toString()%>" />
<p class="lead">
We're sorry, yhere was an error performing this operation. Try again, if the error occurs again please report this issue to <a href="https://support.d4science.org" target="_blank">https://support.d4science.org</a>
We're sorry, there was an error performing this operation. Try again, if the error occurs again please report this issue to <a href="https://support.d4science.org" target="_blank">https://support.d4science.org</a>
</p>
<a class="btn btn-large btn-primary" href="${normalState}"><i
<a class="btn btn-large btn-primary" href="https://blue-cloud.d4science.org/"><i
class="icon icon-angle-left"></i>&nbsp;Close</a>