aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-web/src/main')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PDFASSession.java2
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java179
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java67
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java96
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java2
-rw-r--r--pdf-as-web/src/main/resources/resources/log4j.properties15
-rw-r--r--pdf-as-web/src/main/resources/template_sl.html85
-rw-r--r--pdf-as-web/src/main/webapp/WEB-INF/web.xml10
8 files changed, 406 insertions, 50 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PDFASSession.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PDFASSession.java
index 9207847d..dd914384 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PDFASSession.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PDFASSession.java
@@ -3,6 +3,7 @@ package at.gv.egiz.pdfas.web.helper;
import java.io.Serializable;
import at.gv.egiz.pdfas.lib.api.Configuration;
+import at.gv.egiz.pdfas.lib.api.PdfAs;
import at.gv.egiz.pdfas.lib.api.StatusRequest;
import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
@@ -13,6 +14,7 @@ public class PDFASSession implements Serializable {
private StatusRequest statusRequest;
private SignParameter signParameter;
private Configuration config;
+ private PdfAs pdfAs;
public PDFASSession(SignParameter parameter) {
this.signParameter = parameter;
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
new file mode 100644
index 00000000..cec6caeb
--- /dev/null
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
@@ -0,0 +1,179 @@
+package at.gv.egiz.pdfas.web.helper;
+
+import iaik.cms.ecc.IaikEccProvider;
+import iaik.security.ecc.provider.ECCProvider;
+import iaik.security.provider.IAIK;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.xml.bind.JAXBElement;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringEscapeUtils;
+
+import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource;
+import at.gv.egiz.pdfas.lib.api.Configuration;
+import at.gv.egiz.pdfas.lib.api.PdfAs;
+import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
+import at.gv.egiz.pdfas.lib.api.StatusRequest;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
+import at.gv.egiz.pdfas.sigs.pades.PAdESSigner;
+import at.gv.egiz.sl.CreateCMSSignatureRequestType;
+import at.gv.egiz.sl.CreateCMSSignatureResponseType;
+import at.gv.egiz.sl.InfoboxAssocArrayPairType;
+import at.gv.egiz.sl.InfoboxReadRequestType;
+import at.gv.egiz.sl.InfoboxReadResponseType;
+import at.gv.egiz.sl.ObjectFactory;
+import at.gv.egiz.sl.util.BKUSLConnector;
+import at.gv.egiz.sl.util.SLMarschaller;
+
+public class PdfAsHelper {
+
+ private static final String PDF_CONFIG = "PDF_CONFIG";
+ private static final String PDF_STATUS = "PDF_STATUS";
+ private static final String PDF_SL_CONNECTOR = "PDF_SL_CONNECTOR";
+
+ private static PdfAs pdfAs;
+ private static ObjectFactory of = new ObjectFactory();
+
+ static {
+ pdfAs = PdfAsFactory.createPdfAs(new File("/home/afitzek/.pdfas"));
+ IAIK.getInstance();
+ ECCProvider.addAsProvider();
+ }
+
+ public static void startSignature(HttpServletRequest request,
+ HttpServletResponse response, byte[] pdfData) throws Exception {
+
+ HttpSession session = request.getSession();
+
+ Configuration config = pdfAs.getConfiguration();
+ session.setAttribute(PDF_CONFIG, config);
+ BKUSLConnector bkuSLConnector = new BKUSLConnector(config);
+ SignParameter signParameter = PdfAsFactory.createSignParameter(config,
+ new ByteArrayDataSource(pdfData));
+ signParameter.setPlainSigner(new PAdESSigner(bkuSLConnector));
+
+ session.setAttribute(PDF_SL_CONNECTOR, bkuSLConnector);
+
+ StatusRequest statusRequest = pdfAs.startSign(signParameter);
+ session.setAttribute(PDF_STATUS, statusRequest);
+
+ PdfAsHelper.process(request, response);
+ }
+
+ private static byte[] getCertificate(
+ InfoboxReadResponseType infoboxReadResponseType) {
+ byte[] data = null;
+ if (infoboxReadResponseType.getAssocArrayData() != null) {
+ List<InfoboxAssocArrayPairType> pairs = infoboxReadResponseType
+ .getAssocArrayData().getPair();
+ Iterator<InfoboxAssocArrayPairType> pairIterator = pairs.iterator();
+ while(pairIterator.hasNext()) {
+ InfoboxAssocArrayPairType pair = pairIterator.next();
+ if(pair.getKey().equals("SecureSignatureKeypair")) {
+ return pair.getBase64Content();
+ }
+ }
+ }
+ // SecureSignatureKeypair
+
+ return data;
+ }
+
+ public static void injectCertificate(HttpServletRequest request,
+ HttpServletResponse response,
+ InfoboxReadResponseType infoboxReadResponseType) throws Exception {
+
+ HttpSession session = request.getSession();
+ StatusRequest statusRequest = (StatusRequest)session.getAttribute(PDF_STATUS);
+
+ statusRequest.setCertificate(getCertificate(infoboxReadResponseType));
+ statusRequest = pdfAs.process(statusRequest);
+ session.setAttribute(PDF_STATUS, statusRequest);
+
+ PdfAsHelper.process(request, response);
+ }
+
+ public static void injectSignature(HttpServletRequest request,
+ HttpServletResponse response,
+ CreateCMSSignatureResponseType createCMSSignatureResponseType)
+ throws Exception {
+
+ HttpSession session = request.getSession();
+ StatusRequest statusRequest = (StatusRequest) session
+ .getAttribute(PDF_STATUS);
+
+ statusRequest.setSigature(createCMSSignatureResponseType
+ .getCMSSignature());
+ statusRequest = pdfAs.process(statusRequest);
+ session.setAttribute(PDF_STATUS, statusRequest);
+
+ PdfAsHelper.process(request, response);
+ }
+
+ public static void process(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ HttpSession session = request.getSession();
+ StatusRequest statusRequest = (StatusRequest) session
+ .getAttribute(PDF_STATUS);
+ BKUSLConnector bkuSLConnector = (BKUSLConnector) session
+ .getAttribute(PDF_SL_CONNECTOR);
+ Configuration config = (Configuration) session.getAttribute(PDF_CONFIG);
+
+ if (statusRequest.needCertificate()) {
+ // build SL Request to read certificate
+ InfoboxReadRequestType readCertificateRequest = bkuSLConnector
+ .createInfoboxReadRequest();
+
+ JAXBElement<InfoboxReadRequestType> readRequest = of
+ .createInfoboxReadRequest(readCertificateRequest);
+
+ String url = request.getContextPath() + "/DataURL;jsessionid="
+ + session.getId();
+ String fullurl = request.getScheme() + "://"
+ + request.getServerName() + ":" + request.getServerPort()
+ + url;
+ String slRequest = SLMarschaller.marshalToString(readRequest);
+ String template = getTemplateSL();
+ template = template.replace("##BKU##",
+ "http://127.0.0.1:3495/http-security-layer-request");
+ template = template.replace("##XMLRequest##",
+ StringEscapeUtils.escapeHtml4(slRequest));
+ template = template.replace("##DataURL##", fullurl);
+ response.getWriter().write(template);
+ response.getWriter().close();
+ } else if (statusRequest.needSignature()) {
+ // build SL Request for cms signature
+ CreateCMSSignatureRequestType createCMSSignatureRequestType =
+ bkuSLConnector.createCMSRequest(statusRequest.getSignatureData(),
+ statusRequest.getSignatureDataByteRange());
+
+ String slRequest = SLMarschaller.marshalToString(of
+ .createCreateCMSSignatureRequest(createCMSSignatureRequestType));
+
+ response.setContentType("text/xml");
+ response.getWriter().write(slRequest);
+ response.getWriter().close();
+
+ } else if (statusRequest.isReady()) {
+ // TODO: store pdf document redirect to Finish URL
+ } else {
+ // TODO: invalid state
+ }
+ }
+
+ private static String getTemplateSL() throws IOException {
+ String xml = FileUtils.readFileToString(FileUtils
+ .toFile(PdfAsHelper.class.getResource("/template_sl.html")));
+ return xml;
+ }
+
+}
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java
index 93586c1a..a8dfb053 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java
@@ -1,37 +1,76 @@
package at.gv.egiz.pdfas.web.servlets;
import java.io.IOException;
+
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.xml.bind.JAXBElement;
+
+import at.gv.egiz.pdfas.lib.api.StatusRequest;
+import at.gv.egiz.pdfas.web.helper.PdfAsHelper;
+import at.gv.egiz.sl.CreateCMSSignatureResponseType;
+import at.gv.egiz.sl.ErrorResponseType;
+import at.gv.egiz.sl.InfoboxReadResponseType;
+import at.gv.egiz.sl.util.SLMarschaller;
/**
* Servlet implementation class DataURL
*/
public class DataURLServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
-
- /**
- * @see HttpServlet#HttpServlet()
- */
- public DataURLServlet() {
- super();
- // TODO Auto-generated constructor stub
- }
/**
- * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
+ * @see HttpServlet#HttpServlet()
*/
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // TODO Auto-generated method stub
+ public DataURLServlet() {
+ super();
+ // TODO Auto-generated constructor stub
}
/**
- * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
+ * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
+ * response)
*/
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // TODO Auto-generated method stub
+ protected void doGet(HttpServletRequest request,
+ HttpServletResponse response) throws ServletException, IOException {
+ this.process(request, response);
+ }
+
+ /**
+ * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
+ * response)
+ */
+ protected void doPost(HttpServletRequest request,
+ HttpServletResponse response) throws ServletException, IOException {
+ this.process(request, response);
+ }
+
+ protected void process(HttpServletRequest request,
+ HttpServletResponse response) throws ServletException, IOException {
+ try {
+
+ String xmlResponse = request.getParameter("XMLResponse");
+
+ System.out.println(xmlResponse);
+
+ JAXBElement jaxbObject = (JAXBElement) SLMarschaller.unmarshalFromString(xmlResponse);
+ if(jaxbObject.getValue() instanceof InfoboxReadResponseType) {
+ InfoboxReadResponseType infoboxReadResponseType = (InfoboxReadResponseType)jaxbObject.getValue();
+ PdfAsHelper.injectCertificate(request, response, infoboxReadResponseType);
+ } else if(jaxbObject.getValue() instanceof CreateCMSSignatureResponseType) {
+ CreateCMSSignatureResponseType createCMSSignatureResponseType = (CreateCMSSignatureResponseType)jaxbObject.getValue();
+ PdfAsHelper.injectSignature(request, response, createCMSSignatureResponseType);
+ } else if(jaxbObject.getValue() instanceof ErrorResponseType) {
+ ErrorResponseType errorResponseType = (ErrorResponseType)jaxbObject.getValue();
+ // TODO: store error and redirect user
+ System.out.println("ERROR: " + errorResponseType.getErrorCode() + " " + errorResponseType.getInfo());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
}
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java
index 9ea6f354..5d3c2e34 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java
@@ -1,26 +1,36 @@
package at.gv.egiz.pdfas.web.servlets;
+import java.io.File;
import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.attribute.DosFileAttributes;
+import java.util.Iterator;
+import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
-import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource;
-import at.gv.egiz.pdfas.lib.api.Configuration;
-import at.gv.egiz.pdfas.lib.api.PdfAs;
-import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
-import at.gv.egiz.pdfas.lib.api.StatusRequest;
-import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+
+import at.gv.egiz.pdfas.web.helper.PdfAsHelper;
/**
* Servlet implementation class Sign
*/
public class SignServlet extends HttpServlet {
+
private static final long serialVersionUID = 1L;
+ private static final String UPLOAD_DIRECTORY = "upload";
+ private static final int THRESHOLD_SIZE = 1024 * 1024 * 3; // 3MB
+ private static final int MAX_FILE_SIZE = 1024 * 1024 * 40; // 40MB
+ private static final int MAX_REQUEST_SIZE = 1024 * 1024 * 50; // 50MB
+
/**
* Default constructor.
*/
@@ -29,39 +39,65 @@ public class SignServlet extends HttpServlet {
}
/**
- * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
- * response)
- */
- protected void doGet(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
- response.getWriter()
- .println(
- "<html><head><title>Hello</title></head><body>BODY</body></html>");
- }
-
- /**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
- // TODO Auto-generated method stub
+ try {
+ doParameters(request, response);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected void doParameters(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ // checks if the request actually contains upload file
+ if (!ServletFileUpload.isMultipartContent(request)) {
+ PrintWriter writer = response.getWriter();
+ writer.println("Request does not contain upload data");
+ writer.flush();
+ return;
+ }
+
+ // configures upload settings
+ DiskFileItemFactory factory = new DiskFileItemFactory();
+ factory.setSizeThreshold(THRESHOLD_SIZE);
+ factory.setRepository(new File(System.getProperty("java.io.tmpdir")));
+
+ ServletFileUpload upload = new ServletFileUpload(factory);
+ upload.setFileSizeMax(MAX_FILE_SIZE);
+ upload.setSizeMax(MAX_REQUEST_SIZE);
+
+ // constructs the directory path to store upload file
+ String uploadPath = getServletContext().getRealPath("")
+ + File.separator + UPLOAD_DIRECTORY;
+ // creates the directory if it does not exist
+ File uploadDir = new File(uploadPath);
+ if (!uploadDir.exists()) {
+ uploadDir.mkdir();
+ }
+
+ List formItems = upload.parseRequest(request);
+ byte[] filecontent = null;
+ if(formItems.size() != 1) {
+ // TODO: no file uploaded!
+ } else {
+ FileItem item = (FileItem) formItems.get(0);
+ filecontent = item.get();
+ }
+
+ doSignature(request, response, filecontent);
}
protected void doSignature(HttpServletRequest request,
HttpServletResponse response, byte[] pdfData) {
try {
- PdfAs pdfAs = PdfAsFactory.createPdfAs(null);
- // TODO: Build configuration and Sign Parameters
- Configuration config = pdfAs.getConfiguration();
- SignParameter signParameter = PdfAsFactory.createSignParameter(
- config, new ByteArrayDataSource(pdfData));
-
-
-
- StatusRequest statusRequest = pdfAs.startSign(signParameter);
-
- } catch (PdfAsException e) {
+ // TODO: read Parameters ...
+ PdfAsHelper.startSignature(request, response, pdfData);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
e.printStackTrace();
}
}
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java
index d4303a5f..119bd2cb 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java
@@ -50,7 +50,7 @@ public class VerifyServlet extends HttpServlet {
VerifyParameter parameter = PdfAsFactory.createVerifyParameter(conf, new ByteArrayDataSource(pdfData));
parameter.setWhichSignature(whichSignature);
- List<VerifyResult> results = pdfAs.verify(parameter);
+ //List<VerifyResult> results = pdfAs.verify(parameter);
// Create HTML Snippet for each Verification Result
// Put these results into the web page
diff --git a/pdf-as-web/src/main/resources/resources/log4j.properties b/pdf-as-web/src/main/resources/resources/log4j.properties
new file mode 100644
index 00000000..696db3ef
--- /dev/null
+++ b/pdf-as-web/src/main/resources/resources/log4j.properties
@@ -0,0 +1,15 @@
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, A1
+
+log4j.logger.at.gv.egiz=DEBUG
+#log4j.A1.at.gv.egiz=true
+
+log4j.logger.developer=DEBUG
+#log4j.A1.developer=true
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n \ No newline at end of file
diff --git a/pdf-as-web/src/main/resources/template_sl.html b/pdf-as-web/src/main/resources/template_sl.html
new file mode 100644
index 00000000..e53652e5
--- /dev/null
+++ b/pdf-as-web/src/main/resources/template_sl.html
@@ -0,0 +1,85 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="de">
+<head>
+<title></title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<style type="text/css">
+div.frameT {
+ width: 100%;
+ padding: 0;
+ display: table;
+ height: 100%;
+ position: absolute;
+ top: 0;
+ left: 0;
+ margin: 0;
+}
+
+div.frameTC {
+ padding: 0;
+ vertical-align: middle;
+ display: table-cell;
+ margin: 0;
+}
+
+div.content {
+ width: 600px;
+ background-color: #fff;
+ margin: 0 auto;
+ text-align: left;
+ padding: 10px;
+}
+</style>
+<script language="javascript" type="text/javascript">
+ function onAnmeldeSubmit() {
+ document.CustomizedForm.submit();
+ document.CustomizedForm.Senden.disabled=true;
+ document.CustomizedForm.Senden.hidden = "hidden";
+ var target = document.getElementById('spin');
+ var spinner = new Spinner(opts).spin(target);
+ }
+ </script>
+</head>
+<body onload="onAnmeldeSubmit()">
+ <div class="frameT">
+ <div class="frameTC">
+ <div class="content">
+ <form name="CustomizedForm" action="##BKU##" method="post"
+ enctype="multipart/form-data">
+ <input class="button" type="submit" value="Starte Anmeldung"
+ name="Senden"> <input type="hidden"
+ name="XMLRequest" value="##XMLRequest##"> <input
+ type="hidden" name="DataURL" value="##DataURL##">
+ </form>
+ <span id="spin" style="display:block;
+ width:100px;
+ height: 100%;
+ margin: 0 auto;"> </span>
+ </div>
+ </div>
+ </div>
+ <script language="javascript" type="text/javascript">
+ //spin.min.js
+ (function(t,e){if(typeof exports=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else t.Spinner=e()})(this,function(){"use strict";var t=["webkit","Moz","ms","O"],e={},i;function o(t,e){var i=document.createElement(t||"div"),o;for(o in e)i[o]=e[o];return i}function n(t){for(var e=1,i=arguments.length;e<i;e++)t.appendChild(arguments[e]);return t}var r=function(){var t=o("style",{type:"text/css"});n(document.getElementsByTagName("head")[0],t);return t.sheet||t.styleSheet}();function s(t,o,n,s){var a=["opacity",o,~~(t*100),n,s].join("-"),f=.01+n/s*100,l=Math.max(1-(1-t)/o*(100-f),t),u=i.substring(0,i.indexOf("Animation")).toLowerCase(),d=u&&"-"+u+"-"||"";if(!e[a]){r.insertRule("@"+d+"keyframes "+a+"{"+"0%{opacity:"+l+"}"+f+"%{opacity:"+t+"}"+(f+.01)+"%{opacity:1}"+(f+o)%100+"%{opacity:"+t+"}"+"100%{opacity:"+l+"}"+"}",r.cssRules.length);e[a]=1}return a}function a(e,i){var o=e.style,n,r;i=i.charAt(0).toUpperCase()+i.slice(1);for(r=0;r<t.length;r++){n=t[r]+i;if(o[n]!==undefined)return n}if(o[i]!==undefined)return i}function f(t,e){for(var i in e)t.style[a(t,i)||i]=e[i];return t}function l(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)if(t[o]===undefined)t[o]=i[o]}return t}function u(t){var e={x:t.offsetLeft,y:t.offsetTop};while(t=t.offsetParent)e.x+=t.offsetLeft,e.y+=t.offsetTop;return e}function d(t,e){return typeof t=="string"?t:t[e%t.length]}var p={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:1/4,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};function c(t){if(typeof this=="undefined")return new c(t);this.opts=l(t||{},c.defaults,p)}c.defaults={};l(c.prototype,{spin:function(t){this.stop();var e=this,n=e.opts,r=e.el=f(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),s=n.radius+n.length+n.width,a,l;if(t){t.insertBefore(r,t.firstChild||null);l=u(t);a=u(r);f(r,{left:(n.left=="auto"?l.x-a.x+(t.offsetWidth>>1):parseInt(n.left,10)+s)+"px",top:(n.top=="auto"?l.y-a.y+(t.offsetHeight>>1):parseInt(n.top,10)+s)+"px"})}r.setAttribute("role","progressbar");e.lines(r,e.opts);if(!i){var d=0,p=(n.lines-1)*(1-n.direction)/2,c,h=n.fps,m=h/n.speed,y=(1-n.opacity)/(m*n.trail/100),g=m/n.lines;(function v(){d++;for(var t=0;t<n.lines;t++){c=Math.max(1-(d+(n.lines-t)*g)%m*y,n.opacity);e.opacity(r,t*n.direction+p,c,n)}e.timeout=e.el&&setTimeout(v,~~(1e3/h))})()}return e},stop:function(){var t=this.el;if(t){clearTimeout(this.timeout);if(t.parentNode)t.parentNode.removeChild(t);this.el=undefined}return this},lines:function(t,e){var r=0,a=(e.lines-1)*(1-e.direction)/2,l;function u(t,i){return f(o(),{position:"absolute",width:e.length+e.width+"px",height:e.width+"px",background:t,boxShadow:i,transformOrigin:"left",transform:"rotate("+~~(360/e.lines*r+e.rotate)+"deg) translate("+e.radius+"px"+",0)",borderRadius:(e.corners*e.width>>1)+"px"})}for(;r<e.lines;r++){l=f(o(),{position:"absolute",top:1+~(e.width/2)+"px",transform:e.hwaccel?"translate3d(0,0,0)":"",opacity:e.opacity,animation:i&&s(e.opacity,e.trail,a+r*e.direction,e.lines)+" "+1/e.speed+"s linear infinite"});if(e.shadow)n(l,f(u("#000","0 0 4px "+"#000"),{top:2+"px"}));n(t,n(l,u(d(e.color,r),"0 0 1px rgba(0,0,0,.1)")))}return t},opacity:function(t,e,i){if(e<t.childNodes.length)t.childNodes[e].style.opacity=i}});function h(){function t(t,e){return o("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',e)}r.addRule(".spin-vml","behavior:url(#default#VML)");c.prototype.lines=function(e,i){var o=i.length+i.width,r=2*o;function s(){return f(t("group",{coordsize:r+" "+r,coordorigin:-o+" "+-o}),{width:r,height:r})}var a=-(i.width+i.length)*2+"px",l=f(s(),{position:"absolute",top:a,left:a}),u;function p(e,r,a){n(l,n(f(s(),{rotation:360/i.lines*e+"deg",left:~~r}),n(f(t("roundrect",{arcsize:i.corners}),{width:o,height:i.width,left:i.radius,top:-i.width>>1,filter:a}),t("fill",{color:d(i.color,e),opacity:i.opacity}),t("stroke",{opacity:0}))))}if(i.shadow)for(u=1;u<=i.lines;u++)p(u,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(u=1;u<=i.lines;u++)p(u);return n(e,l)};c.prototype.opacity=function(t,e,i,o){var n=t.firstChild;o=o.shadow&&o.lines||0;if(n&&e+o<n.childNodes.length){n=n.childNodes[e+o];n=n&&n.firstChild;n=n&&n.firstChild;if(n)n.opacity=i}}}var m=f(o("group"),{behavior:"url(#default#VML)"});if(!a(m,"transform")&&m.adj)h();else i=a(m,"animation");return c});
+
+ var opts = {
+ lines: 13, // The number of lines to draw
+ length: 22, // The length of each line
+ width: 9, // The line thickness
+ radius: 40, // The radius of the inner circle
+ corners: 1, // Corner roundness (0..1)
+ rotate: 27, // The rotation offset
+ direction: 1, // 1: clockwise, -1: counterclockwise
+ color: '#000', // #rgb or #rrggbb or array of colors
+ speed: 1.2, // Rounds per second
+ trail: 56, // Afterglow percentage
+ shadow: false, // Whether to render a shadow
+ hwaccel: false, // Whether to use hardware acceleration
+ className: 'spinner', // The CSS class to assign to the spinner
+ zIndex: 2e9, // The z-index (defaults to 2000000000)
+ top: 'auto', // Top position relative to parent in px
+ left: 'auto' // Left position relative to parent in px
+ };
+ </script>
+</body>
+</html>
diff --git a/pdf-as-web/src/main/webapp/WEB-INF/web.xml b/pdf-as-web/src/main/webapp/WEB-INF/web.xml
index 13149b7f..44298afe 100644
--- a/pdf-as-web/src/main/webapp/WEB-INF/web.xml
+++ b/pdf-as-web/src/main/webapp/WEB-INF/web.xml
@@ -45,13 +45,13 @@
<servlet-name>ProvidePDF</servlet-name>
<display-name>ProvidePDF</display-name>
<description></description>
- <servlet-class>at.gv.egiz.pdfas.web.servlets.ProvidePDF</servlet-class>
+ <servlet-class>at.gv.egiz.pdfas.web.servlets.ProvidePDFServlet</servlet-class>
</servlet>
<servlet>
- <servlet-name>DataURL</servlet-name>
- <display-name>DataURL</display-name>
+ <servlet-name>DataURLServlet</servlet-name>
+ <display-name>DataURLServlet</display-name>
<description></description>
- <servlet-class>at.gv.egiz.pdfas.web.servlets.DataURL</servlet-class>
+ <servlet-class>at.gv.egiz.pdfas.web.servlets.DataURLServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>VerifyServlet</servlet-name>
@@ -78,7 +78,7 @@
<url-pattern>/ProvidePDF</url-pattern>
</servlet-mapping>
<servlet-mapping>
- <servlet-name>DataURL</servlet-name>
+ <servlet-name>DataURLServlet</servlet-name>
<url-pattern>/DataURL</url-pattern>
</servlet-mapping>
<servlet-mapping>