summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2020-07-01 12:40:24 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2020-07-01 12:40:24 +0200
commitfd6ffb7bf3ffbc00bb96c0eb215d89edbbb021e3 (patch)
tree9d30caea5b5099d1f0fe289b4d44771c6d5f3362 /eaaf_core/src/main
parent234cee5815f8688d45146b792ebe3c8015a7dc74 (diff)
downloadEAAF-Components-fd6ffb7bf3ffbc00bb96c0eb215d89edbbb021e3.tar.gz
EAAF-Components-fd6ffb7bf3ffbc00bb96c0eb215d89edbbb021e3.tar.bz2
EAAF-Components-fd6ffb7bf3ffbc00bb96c0eb215d89edbbb021e3.zip
update log message in case of SL2.0 VDA connection error
Diffstat (limited to 'eaaf_core/src/main')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java39
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java43
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java18
3 files changed, 58 insertions, 42 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java
index 3d093a9f..32d1e66e 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java
@@ -31,17 +31,6 @@ import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.FileItemFactory;
-import org.apache.commons.fileupload.FileUploadException;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-import org.apache.commons.lang3.ArrayUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.ResourceLoader;
-
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IRequestStorage;
import at.gv.egiz.eaaf.core.api.data.EaafConstants;
@@ -55,6 +44,17 @@ import at.gv.egiz.eaaf.core.impl.idp.controller.ProtocolFinalizationController;
import at.gv.egiz.eaaf.core.impl.idp.process.springweb.AbstractTask;
import at.gv.egiz.eaaf.core.impl.utils.DataUrlBuilder;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.commons.lang3.ArrayUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ResourceLoader;
+
/**
* Task based counterpart to {@link AuthServlet}, providing the same utility
* methods (error handling, parameter parsing etc.).
@@ -268,4 +268,21 @@ public abstract class AbstractAuthServletTask extends AbstractTask {
return url + "&" + param;
}
}
+
+ /**
+ * Get a {@link Boolean} parameter from http request.
+ *
+ * @param httpReq http Request object
+ * @param paramName http Parameter name
+ * @return <code>true</code> if the parameter exists and the <code>Boolean.parseBoolean(value)</code>
+ * evaluates to <code>true</code>, otherwise <code>false</code>
+ */
+ protected boolean evaluteBooleanReqParam(final HttpServletRequest httpReq, final String paramName) {
+ final String value = httpReq.getParameter(paramName);
+ if (value != null) {
+ return Boolean.parseBoolean(value);
+ } else {
+ return false;
+ }
+ }
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
index fbf19429..72fa1faf 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
@@ -29,17 +29,6 @@ import javax.naming.ConfigurationException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.text.StringEscapeUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.lang.NonNull;
-import org.springframework.lang.Nullable;
-import org.springframework.stereotype.Service;
-
import at.gv.egiz.components.eventlog.api.EventConstants;
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IRequestStorage;
@@ -76,6 +65,17 @@ import at.gv.egiz.eaaf.core.impl.idp.controller.ProtocolFinalizationController;
import at.gv.egiz.eaaf.core.impl.idp.controller.protocols.RequestImpl;
import at.gv.egiz.eaaf.core.impl.utils.ServletUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.text.StringEscapeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.lang.NonNull;
+import org.springframework.lang.Nullable;
+import org.springframework.stereotype.Service;
+
@Service
public class ProtocolAuthenticationService implements IProtocolAuthenticationService {
private static final Logger log = LoggerFactory.getLogger(ProtocolAuthenticationService.class);
@@ -213,7 +213,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
revisionsLogger.logEvent(EventConstants.TRANSACTION_DESTROYED,
pendingReq.getUniqueTransactionIdentifier());
}
-
+
}
@Override
@@ -276,6 +276,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
// return error to Web browser
if (throwable instanceof EaafException || throwable instanceof ProcessExecutionException) {
internalMoaidExceptionHandler(req, resp, (Exception) throwable, false);
+
} else {
// write generic message for general exceptions
final String msg =
@@ -289,34 +290,34 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
@Override
public void forwardToErrorHandler(Pair<IRequest, Throwable> errorToHandle, String errorKey,
final HttpServletRequest req, final HttpServletResponse resp) throws GuiBuildException {
- IGuiBuilderConfiguration parentHopGuiConfig =
+ final IGuiBuilderConfiguration parentHopGuiConfig =
evaluateRequiredErrorHandlingMethod(errorToHandle.getFirst(), errorKey);
if (parentHopGuiConfig != null) {
log.trace("iFrame to parent hop requested. Building GUI step for error handling ... ");
guiBuilder.build(req, resp, parentHopGuiConfig, "iFrame-to-parent");
-
- } else {
+
+ } else {
// build up redirect URL
final String redirectUrl = generateErrorRedirectUrl(req, errorKey);
resp.setContentType("text/html");
resp.setStatus(302);
resp.addHeader("Location", redirectUrl);
log.debug("REDIRECT TO: " + redirectUrl);
-
+
}
}
-
+
private IGuiBuilderConfiguration evaluateRequiredErrorHandlingMethod(IRequest first, String errorId) {
if (first != null && first.isProcessInIframe()) {
- return guiConfigFactory.getDefaultIFrameParentHopGui(first,
+ return guiConfigFactory.getDefaultIFrameParentHopGui(first,
"/" + ProtocolFinalizationController.ENDPOINT_ERRORHANDLING,
errorId);
-
+
}
return null;
}
-
+
private String generateErrorRedirectUrl(final HttpServletRequest req, String errorKey) {
String redirectUrl = null;
redirectUrl = ServletUtils.getBaseUrl(req);
@@ -325,7 +326,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
return redirectUrl;
}
-
+
public void setGuiBuilder(final IGuiFormBuilder guiBuilder) {
this.guiBuilder = guiBuilder;
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
index fc62af45..e9687833 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java
@@ -26,13 +26,6 @@ import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.text.StringEscapeUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-
import at.gv.egiz.components.eventlog.api.EventConstants;
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IStatusMessenger;
@@ -49,6 +42,13 @@ import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
import at.gv.egiz.eaaf.core.impl.data.Pair;
import at.gv.egiz.eaaf.core.impl.utils.Random;
+import org.apache.commons.text.StringEscapeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+
/**
* Basic application controller that implements core error-handling.
*
@@ -69,7 +69,7 @@ public abstract class AbstractController {
protected ITransactionStorage transactionStorage;
@Autowired(required = true)
protected IStatusMessenger statusMessager;
-
+
@Autowired
protected IRevisionLogger revisionsLogger;
@@ -150,8 +150,6 @@ public abstract class AbstractController {
try {
final String errorKey = storeErrorAndGetErrorToken(errorToHandle);
protAuthService.forwardToErrorHandler(errorToHandle, errorKey, req, resp);
-
- return;
} catch (final Exception e) {
log.warn("Default error-handling FAILED. Exception can not be stored ....", e);