aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-07-21 12:52:45 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-07-21 12:52:45 +0200
commit34289c5982ffdd59e33576a6b47316a6cfb14201 (patch)
treeae419c87de8c664f3eef32a8540bad0d083a3242 /pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets
parentea4180c0a643ca741fd8432faf9913706935e4d6 (diff)
downloadpdf-as-4-34289c5982ffdd59e33576a6b47316a6cfb14201.tar.gz
pdf-as-4-34289c5982ffdd59e33576a6b47316a6cfb14201.tar.bz2
pdf-as-4-34289c5982ffdd59e33576a6b47316a6cfb14201.zip
removed imports, added logging information
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java2
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java108
2 files changed, 60 insertions, 50 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java
index 39078529..121fbc88 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java
@@ -89,6 +89,7 @@ public class ExternSignServlet extends HttpServlet {
String errorUrl = PdfAsParameterExtractor.getInvokeErrorURL(request);
PdfAsHelper.setErrorURL(request, response, errorUrl);
+
try {
// Mandatory Parameters on Get Request:
String invokeUrl = PdfAsParameterExtractor.getInvokeURL(request);
@@ -296,6 +297,7 @@ public class ExternSignServlet extends HttpServlet {
PdfAsHelper.startSignature(request, response, getServletContext(), pdfData, connector,
PdfAsHelper.buildPosString(request, response), transactionId, PdfAsParameterExtractor
.getSigType(request));
+ return;
} else if (connector.equals("jks") || connector.equals("moa")) {
// start synchronous siganture creation
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java
index 85ee1897..544f6c83 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java
@@ -30,12 +30,11 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.http.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.gv.egiz.pdfas.api.ws.PDFASSignRequest;
import at.gv.egiz.pdfas.api.ws.PDFASSignParameters.Connector;
+import at.gv.egiz.pdfas.api.ws.PDFASSignRequest;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter.SignatureVerificationLevel;
import at.gv.egiz.pdfas.web.config.WebConfiguration;
@@ -43,7 +42,6 @@ import at.gv.egiz.pdfas.web.exception.PdfAsStoreException;
import at.gv.egiz.pdfas.web.exception.PdfAsWebException;
import at.gv.egiz.pdfas.web.helper.DigestHelper;
import at.gv.egiz.pdfas.web.helper.PdfAsHelper;
-import at.gv.egiz.pdfas.web.helper.PdfAsParameterExtractor;
import at.gv.egiz.pdfas.web.store.RequestStore;
public class UIEntryPointServlet extends HttpServlet {
@@ -77,80 +75,90 @@ public class UIEntryPointServlet extends HttpServlet {
if (storeId == null) {
throw new PdfAsStoreException("Wrong Parameters");
}
-
+
PDFASSignRequest pdfAsRequest = RequestStore.getInstance()
.fetchStoreEntry(storeId);
-
- if(pdfAsRequest == null) {
- throw new PdfAsStoreException("Invalid " + REQUEST_ID_PARAM + " value");
+
+ if (pdfAsRequest == null) {
+ throw new PdfAsStoreException("Invalid " + REQUEST_ID_PARAM
+ + " value");
}
-
+
Connector connector = pdfAsRequest.getParameters().getConnector();
-
+
String invokeUrl = pdfAsRequest.getParameters().getInvokeURL();
PdfAsHelper.setInvokeURL(req, resp, invokeUrl);
-
- String invokeTarget = pdfAsRequest.getParameters().getInvokeTarget();
+
+ String invokeTarget = pdfAsRequest.getParameters()
+ .getInvokeTarget();
PdfAsHelper.setInvokeTarget(req, resp, invokeTarget);
-
+
String errorUrl = pdfAsRequest.getParameters().getInvokeErrorURL();
PdfAsHelper.setErrorURL(req, resp, errorUrl);
-
+
SignatureVerificationLevel lvl = SignatureVerificationLevel.INTEGRITY_ONLY_VERIFICATION;
- if(pdfAsRequest.getVerificationLevel() != null) {
- switch (pdfAsRequest.getVerificationLevel()) {
- case INTEGRITY_ONLY:
- lvl = SignatureVerificationLevel.INTEGRITY_ONLY_VERIFICATION;
- break;
- default:
- lvl = SignatureVerificationLevel.FULL_VERIFICATION;
- break;
- }
+ if (pdfAsRequest.getVerificationLevel() != null) {
+ switch (pdfAsRequest.getVerificationLevel()) {
+ case INTEGRITY_ONLY:
+ lvl = SignatureVerificationLevel.INTEGRITY_ONLY_VERIFICATION;
+ break;
+ default:
+ lvl = SignatureVerificationLevel.FULL_VERIFICATION;
+ break;
+ }
}
PdfAsHelper.setVerificationLevel(req, lvl);
-
- if(pdfAsRequest.getInputData() == null) {
+
+ if (pdfAsRequest.getInputData() == null) {
throw new PdfAsException("No Signature data available");
}
-
- String pdfDataHash = DigestHelper.getHexEncodedHash(pdfAsRequest.getInputData());
-
+
+ String pdfDataHash = DigestHelper.getHexEncodedHash(pdfAsRequest
+ .getInputData());
+
PdfAsHelper.setSignatureDataHash(req, pdfDataHash);
logger.debug("Storing signatures data hash: " + pdfDataHash);
-
+
logger.debug("Starting signature creation with: " + connector);
-
- //IPlainSigner signer;
- if (connector.equals(Connector.BKU) || connector.equals(Connector.ONLINEBKU) || connector.equals(Connector.MOBILEBKU)) {
+
+ // IPlainSigner signer;
+ if (connector.equals(Connector.BKU)
+ || connector.equals(Connector.ONLINEBKU)
+ || connector.equals(Connector.MOBILEBKU)) {
// start asynchronous signature creation
-
- if(connector.equals(Connector.BKU)) {
- if(WebConfiguration.getLocalBKUURL() == null) {
- throw new PdfAsWebException("Invalid connector bku is not supported");
+
+ if (connector.equals(Connector.BKU)) {
+ if (WebConfiguration.getLocalBKUURL() == null) {
+ throw new PdfAsWebException(
+ "Invalid connector bku is not supported");
}
}
-
- if(connector.equals(Connector.ONLINEBKU)) {
- if(WebConfiguration.getLocalBKUURL() == null) {
- throw new PdfAsWebException("Invalid connector onlinebku is not supported");
+
+ if (connector.equals(Connector.ONLINEBKU)) {
+ if (WebConfiguration.getLocalBKUURL() == null) {
+ throw new PdfAsWebException(
+ "Invalid connector onlinebku is not supported");
}
}
-
- if(connector.equals(Connector.MOBILEBKU)) {
- if(WebConfiguration.getLocalBKUURL() == null) {
- throw new PdfAsWebException("Invalid connector mobilebku is not supported");
+
+ if (connector.equals(Connector.MOBILEBKU)) {
+ if (WebConfiguration.getLocalBKUURL() == null) {
+ throw new PdfAsWebException(
+ "Invalid connector mobilebku is not supported");
}
}
-
- PdfAsHelper.startSignature(req, resp, getServletContext(), pdfAsRequest.getInputData(),
- connector.toString(), pdfAsRequest.getParameters().getPosition(),
- pdfAsRequest.getParameters().getTransactionId(),
+
+ PdfAsHelper.startSignature(req, resp, getServletContext(),
+ pdfAsRequest.getInputData(), connector.toString(),
+ pdfAsRequest.getParameters().getPosition(),
+ pdfAsRequest.getParameters().getTransactionId(),
pdfAsRequest.getParameters().getProfile());
} else {
- throw new PdfAsWebException("Invalid connector (" + Connector.BKU + " | " + Connector.ONLINEBKU + " | " + Connector.MOBILEBKU + ")");
+ throw new PdfAsWebException("Invalid connector ("
+ + Connector.BKU + " | " + Connector.ONLINEBKU + " | "
+ + Connector.MOBILEBKU + ")");
}
-
-
+
} catch (Throwable e) {
logger.error("Failed to process Request: ", e);
PdfAsHelper.setSessionException(req, resp, e.getMessage(), e);