diff --git a/src/main/java/info/bukova/isspst/signapi/JnlpGeneratorImpl.java b/src/main/java/info/bukova/isspst/signapi/JnlpGeneratorImpl.java index 0b90c001..93bbc23f 100644 --- a/src/main/java/info/bukova/isspst/signapi/JnlpGeneratorImpl.java +++ b/src/main/java/info/bukova/isspst/signapi/JnlpGeneratorImpl.java @@ -63,6 +63,7 @@ public class JnlpGeneratorImpl implements JnlpGenerator { root.appendChild(security); Element resources = document.createElement("resources"); + resources.setAttribute("os", "Linux"); Element j2se = document.createElement("j2se"); j2se.setAttribute("version", "1.8+"); Element jar = document.createElement("jar"); @@ -71,6 +72,17 @@ public class JnlpGeneratorImpl implements JnlpGenerator { resources.appendChild(jar); root.appendChild(resources); + Element resourcesWin = document.createElement("resources"); + resourcesWin.setAttribute("os", "Windows"); + Element j2seWin = document.createElement("j2se"); + j2seWin.setAttribute("version", "1.8+"); + Element jarWin = document.createElement("jar"); + jarWin.setAttribute("href", "pdfsignerWin.jar"); + resourcesWin.appendChild(j2seWin); + + resourcesWin.appendChild(jarWin); + root.appendChild(resourcesWin); + Element appDesc = document.createElement("application-desc"); appDesc.setAttribute("main-class", "info.bukova.pdfsigner.Main"); Element argUrl = document.createElement("argument"); diff --git a/src/main/java/info/bukova/isspst/signapi/SigningController.java b/src/main/java/info/bukova/isspst/signapi/SigningController.java index 92fced72..0333d2a7 100644 --- a/src/main/java/info/bukova/isspst/signapi/SigningController.java +++ b/src/main/java/info/bukova/isspst/signapi/SigningController.java @@ -102,7 +102,22 @@ public class SigningController { @RequestMapping(value="/sign/pdfsigner.jar", method= RequestMethod.GET) public void pdfsigner(HttpServletResponse response) { - File inputJar = new File(context.getRealPath("/WEB-INF/signer/PDFSigner.jar")); + sendJar(response, "Linux"); + } + + @RequestMapping(value="/sign/pdfsignerWin.jar", method= RequestMethod.GET) + public void pdfsignerWin(HttpServletResponse response) { + sendJar(response, "Windows"); + } + + private void sendJar(HttpServletResponse response, String os) { + File inputJar; + + if (os.startsWith("Windows")) { + inputJar = new File(context.getRealPath("/WEB-INF/signer/PDFSignerWin.jar")); + } else { + inputJar = new File(context.getRealPath("/WEB-INF/signer/PDFSigner.jar")); + } try { byte[] data = new byte[(int) inputJar.length()]; diff --git a/src/main/webapp/WEB-INF/signer/PDFSignerWin.jar b/src/main/webapp/WEB-INF/signer/PDFSignerWin.jar new file mode 100644 index 00000000..eb95cc26 Binary files /dev/null and b/src/main/webapp/WEB-INF/signer/PDFSignerWin.jar differ