restyled a bit the infromative text

This commit is contained in:
Massimiliano Assante 2021-09-24 15:48:47 +02:00
parent 107f84dc8c
commit 1a6730c5e2
2 changed files with 24 additions and 11 deletions

View File

@ -10,7 +10,6 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
@ -90,6 +89,11 @@ public class DdasVreIntegration extends MVCPortlet {
GCubeUser currentUser = getCurrentUser(renderRequest);
log.debug("current user is + " + currentUser.getUsername() + " sending request to conductor ...");
try {
Integer userOrderNumber = brokerRequest.getAsJsonObject().get("orderNumber").getAsInt();
String userOrderName = brokerRequest.getAsJsonObject().get("userOrderName").getAsString();
renderRequest.setAttribute("orderData", userOrderName + ", order number " + userOrderNumber); //pass to the JSP
result = sendRequestToConductor(brokerRequest, currentUser, renderRequest);
} catch (Exception e) {
// TODO Auto-generated catch block
@ -176,13 +180,15 @@ public class DdasVreIntegration extends MVCPortlet {
os.write(jsonString.getBytes("UTF-8"));
os.flush();
os.close();
StringBuilder sb = new StringBuilder();
int httpResultCode = connection.getResponseCode();
log.trace("HTTP Response code: " + httpResultCode);
log.trace("Reading response");
boolean ok = true;
int httpResultCode = -1;
try {
httpResultCode = connection.getResponseCode();
log.trace("HTTP Response code: " + httpResultCode);
log.trace("Reading response");
InputStreamReader isr = null;
if (httpResultCode == HttpURLConnection.HTTP_OK) {
isr = new InputStreamReader(connection.getInputStream(), "UTF-8");
@ -197,6 +203,10 @@ public class DdasVreIntegration extends MVCPortlet {
}
br.close();
isr.close();
} catch (java.net.SocketTimeoutException e) {
log.warn("Read timout may have occurred, however I think it went through anyways.");
return true;
}
if (ok) {
log.info("Post to Conductor is OK" + httpResultCode);
log.trace("Response message from server: {}" + sb.toString());

View File

@ -14,21 +14,24 @@
<liferay-theme:defineObjects />
<portlet:defineObjects />
<%
Boolean responseResultSuccess = (Boolean) renderRequest.getAttribute("theResult");
String orderData = (String) renderRequest.getAttribute("orderData");
pageContext.setAttribute("orderData", orderData);
pageContext.setAttribute("responseResultSuccess", responseResultSuccess);
%>
<c:choose>
<c:when test="${not responseResultSuccess}">
<p class="lead">
Ouch, we're sorry an error occurred. Please report the issue on <a href="https://support.d4science.org">https://support.d4science.org</a>
Ouch, we're sorry an error occurred. Please report the issue on <a
href="https://support.d4science.org">https://support.d4science.org</a>
</p>
</c:when>
<c:otherwise>
<p class="lead">Hi! Your data is being retrieved and saved to your
workspace area, you will receive a notification e-email when
the download process is completed.</p>
<p class="lead">Your order <c:out value="${orderData}"></c:out>, is being retrieved and the dataset are being saved to your
workspace area, you will receive an e-email when the
download process is completed. You may close this Tab now.</p>
</c:otherwise>
</c:choose>