diff options
-rw-r--r-- | BKUHelp/src/main/webapp/help/404.html | 52 | ||||
-rw-r--r-- | BKUHelp/src/main/webapp/help/404h.html | 52 | ||||
-rw-r--r-- | BKUHelp/src/main/webapp/help/de/404.html | 52 | ||||
-rw-r--r-- | BKUHelp/src/main/webapp/help/de/404h.html | 52 | ||||
-rw-r--r-- | BKULocal/src/main/webapp/WEB-INF/web.xml | 4 | ||||
-rw-r--r-- | BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java | 108 | ||||
-rw-r--r-- | BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java | 2 | ||||
-rw-r--r-- | BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/WebappErrorHandler.java | 80 |
8 files changed, 389 insertions, 13 deletions
diff --git a/BKUHelp/src/main/webapp/help/404.html b/BKUHelp/src/main/webapp/help/404.html new file mode 100644 index 00000000..1c2ad9bc --- /dev/null +++ b/BKUHelp/src/main/webapp/help/404.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>CitizenCard - Help</title> + <link href="css/help.css" rel="stylesheet" type="text/css" /> + <link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon"/> + </head> + + <body class="twoColElsLtHdr"> + + <div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="img/welcome.png" alt="applet screenshot" width="190" height="130"/></p> + <p>Help icon above CitizenCard dialog</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>CitizenCard-Environment Help</h1> + <p>Page not found.</p> + <p> + The context-dependent CitizenCard Environment help is available via + the help icon in the top right corner above the CitizenCard dialog. + Alternatively, the individual help pages can be accessed and also bookmarked directly from the browser. + </p> + <p>Answers to frequently asked questions can be found in the following help pages: </p> + <ul> + <li><a href="help.install.cacert.html">CA certificate installation (MOCCA Webstart only)</a></li> + <li><a href="error.pcsc.html">PC/SC installation error</a></li> + <li><a href="cardnotsupported.html">Supported signature cards</a></li> + <li><a href="help.cardpin.html">Accessing protected card data (pin entry)</a></li> + <li><a href="help.signpin.html">Signature creation</a></li> + <li><a href="help.retry.html">Wrong PIN</a></li> + <li><a href="help.hashdataviewer.html">Signature data display</a></li> + <li><a href="help.pin.mgmt.html">PIN management</a></li> + <li><a href="help.change.pin.html">Change PIN</a></li> + </ul> + <p>If you don't find answers to your questions in those pages, you can find a support Forum + for the citizen card at <a href="https://www.buergerkarte.at/mvnforum/mvnforum/index">www.buergerkarte.at</a>.</p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> + <!-- end #container --></div> + </body> +</html> diff --git a/BKUHelp/src/main/webapp/help/404h.html b/BKUHelp/src/main/webapp/help/404h.html new file mode 100644 index 00000000..ec744da4 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/404h.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>CitizenCard - Help</title> + <link href="css/help.css" rel="stylesheet" type="text/css" /> + <link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon"/> + </head> + + <body class="twoColElsLtHdr"> + + <div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="img/welcome.png" alt="applet screenshot" width="190" height="130"/></p> + <p>Help icon above CitizenCard dialog</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>CitizenCard-Environment Help</h1> + <p>Sorry, no context specific help was found.</p> + <p> + The context-dependent CitizenCard Environment help is available via + the help icon in the top right corner above the CitizenCard dialog. + Alternatively, the individual help pages can be accessed and also bookmarked directly from the browser. + </p> + <p>Answers to frequently asked questions can be found in the following help pages: </p> + <ul> + <li><a href="help.install.cacert.html">CA certificate installation (MOCCA Webstart only)</a></li> + <li><a href="error.pcsc.html">PC/SC installation error</a></li> + <li><a href="cardnotsupported.html">Supported signature cards</a></li> + <li><a href="help.cardpin.html">Accessing protected card data (pin entry)</a></li> + <li><a href="help.signpin.html">Signature creation</a></li> + <li><a href="help.retry.html">Wrong PIN</a></li> + <li><a href="help.hashdataviewer.html">Signature data display</a></li> + <li><a href="help.pin.mgmt.html">PIN management</a></li> + <li><a href="help.change.pin.html">Change PIN</a></li> + </ul> + <p>If you don't find answers to your questions in those pages, you can find a support Forum + for the citizen card at <a href="https://www.buergerkarte.at/mvnforum/mvnforum/index">www.buergerkarte.at</a>.</p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> + <!-- end #container --></div> + </body> +</html> diff --git a/BKUHelp/src/main/webapp/help/de/404.html b/BKUHelp/src/main/webapp/help/de/404.html new file mode 100644 index 00000000..a491bce3 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/de/404.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>Bürgerkarte - Hilfe</title> + <link href="../css/help.css" rel="stylesheet" type="text/css" /> + <link rel="shortcut icon" href="../img/chip16.ico" type="image/x-icon"/> + </head> + + <body class="twoColElsLtHdr"> + + <div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="img/welcome.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p>Hilfe-Icon rechts oben im Bürgerkartendialog</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Hilfe zur Bürgerkartenumgebung </h1> + <p>Seite nicht gefunden.</p> + <p>Die Bürgerkartenumgebung bietet eine kontextabhängige Hilfe, + die jederzeit über das Hilfe-Icon rechts oben im Bürgerkartendialog abrufbar ist. + Alternativ können die einzelnen Hilfeseiten auch direkt in jedem Browser angezeigt - und zu den Lesezeichen hinzugefügt - werden. + </p> + <p>Häufige gestellte Fragen werden in den folgenden Hilfeseiten behandelt:</p> + <ul> + <li><a href="help.install.cacert.html">Installation des CA Zertifikats (nur lokale Bürgerkartenumgebung)</a></li> + <li><a href="error.pcsc.html">Fehler bei der PC/SC Installation</a></li> + <li><a href="cardnotsupported.html">Unterstützte Signaturkarten</a></li> + <li><a href="help.cardpin.html">Auslesen der Daten auf der Bürgerkarte</a></li> + <li><a href="help.signpin.html">Erstellen einer elektronischen Signatur</a></li> + <li><a href="help.retry.html">Falsche PIN</a></li> + <li><a href="help.hashdataviewer.html">Anzeige der Signaturdaten</a></li> + <li><a href="help.pin.mgmt.html">PIN Verwaltung</a></li> + <li><a href="help.change.pin.html">Ändern der PIN</a></li> + </ul> + <p>Wenn Sie auf diesen Seiten keine Antwort auf ihre Fragen finden, gibt es unter + <a href="https://www.buergerkarte.at/mvnforum/mvnforum/index">www.buergerkarte.at</a> ein Support-Forum + für die Bürgerkarte.</p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> + <!-- end #container --></div> + </body> +</html> diff --git a/BKUHelp/src/main/webapp/help/de/404h.html b/BKUHelp/src/main/webapp/help/de/404h.html new file mode 100644 index 00000000..09a20847 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/de/404h.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>Bürgerkarte - Hilfe</title> + <link href="../css/help.css" rel="stylesheet" type="text/css" /> + <link rel="shortcut icon" href="../img/chip16.ico" type="image/x-icon"/> + </head> + + <body class="twoColElsLtHdr"> + + <div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="img/welcome.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p>Hilfe-Icon rechts oben im Bürgerkartendialog</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Hilfe zur Bürgerkartenumgebung </h1> + <p>Es konnte keine kontextabhängige Hilfe gefunden werden.</p> + <p>Die Bürgerkartenumgebung bietet eine kontextabhängige Hilfe, + die jederzeit über das Hilfe-Icon rechts oben im Bürgerkartendialog abrufbar ist. + Alternativ können die einzelnen Hilfeseiten auch direkt in jedem Browser angezeigt - und zu den Lesezeichen hinzugefügt - werden. + </p> + <p>Häufige gestellte Fragen werden in den folgenden Hilfeseiten behandelt:</p> + <ul> + <li><a href="help.install.cacert.html">Installation des CA Zertifikats (nur lokale Bürgerkartenumgebung)</a></li> + <li><a href="error.pcsc.html">Fehler bei der PC/SC Installation</a></li> + <li><a href="cardnotsupported.html">Unterstützte Signaturkarten</a></li> + <li><a href="help.cardpin.html">Auslesen der Daten auf der Bürgerkarte</a></li> + <li><a href="help.signpin.html">Erstellen einer elektronischen Signatur</a></li> + <li><a href="help.retry.html">Falsche PIN</a></li> + <li><a href="help.hashdataviewer.html">Anzeige der Signaturdaten</a></li> + <li><a href="help.pin.mgmt.html">PIN Verwaltung</a></li> + <li><a href="help.change.pin.html">Ändern der PIN</a></li> + </ul> + <p>Wenn Sie auf diesen Seiten keine Antwort auf ihre Fragen finden, gibt es unter + <a href="https://www.buergerkarte.at/mvnforum/mvnforum/index">www.buergerkarte.at</a> ein Support-Forum + für die Bürgerkarte.</p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> + <!-- end #container --></div> + </body> +</html> diff --git a/BKULocal/src/main/webapp/WEB-INF/web.xml b/BKULocal/src/main/webapp/WEB-INF/web.xml index acfb5278..5704e687 100644 --- a/BKULocal/src/main/webapp/WEB-INF/web.xml +++ b/BKULocal/src/main/webapp/WEB-INF/web.xml @@ -69,4 +69,8 @@ <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> + <error-page> + <error-code>404</error-code> + <location>/help/404.html</location> + </error-page> </web-app> diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java index 216c6228..07c5d792 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java @@ -41,6 +41,8 @@ import java.security.AllPermission; import java.security.KeyStore;
import java.security.Permissions;
import java.security.cert.Certificate;
+import java.util.Locale; + import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.nio.SelectChannelConnector;
@@ -66,8 +68,17 @@ public class Container { }
}
private Server server;
- private WebAppContext webapp;
- private Certificate caCertificate;
+ private WebAppContext webapp; + private WebappErrorHandler errorHandler;
+ private Certificate caCertificate; + private File tempDir; + + private Locale locale = null; + + public void init(Locale locale) throws IOException { + this.locale = locale; + init(); + } public void init() throws IOException {
// System.setProperty("DEBUG", "true");
@@ -103,7 +114,7 @@ public class Container { sslConnector.setKeyPassword(passwd);
//avoid jetty's ClassCastException: iaik.security.ecc.ecdsa.ECPublicKey cannot be cast to java.security.interfaces.ECPublicKey
- String[] RFC4492CipherSuites = new String[]{
+ String[] RFC4492CipherSuites = new String[] {
"TLS_ECDH_ECDSA_WITH_NULL_SHA",
"TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
"TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
@@ -139,10 +150,14 @@ public class Container { webapp.setLogUrlOnStart(true);
webapp.setContextPath("/");
webapp.setExtractWAR(true);
- webapp.setParentLoaderPriority(false);
-
- webapp.setWar(copyWebapp(webapp.getTempDirectory()));
-// webapp.setPermissions(getPermissions(webapp.getTempDirectory()));
+ webapp.setParentLoaderPriority(false); + + errorHandler = new WebappErrorHandler(locale); + webapp.setErrorHandler(errorHandler);
+ + tempDir = webapp.getTempDirectory();
+ webapp.setWar(copyWebapp(tempDir));
+// webapp.setPermissions(getPermissions(tempDir));
server.setHandler(webapp);
server.setGracefulShutdown(1000 * 3);
@@ -186,7 +201,70 @@ public class Container { new StreamCopier(is, os).copyStream();
os.close();
return webapp.getPath();
- }
+ } + +// private boolean deleteRecursive(File f) +// { +// if (f.isDirectory()) +// { +// String[] children = f.list(); +// for (String child : children) { +// if (!deleteRecursive(new File(f, child))) +// return false; +// } +// } +// return f.delete(); +// } +// +// private void deleteOnExitRecursive(File f) +// { +// if (f.isDirectory()) +// { +// String[] children = f.list(); +// for (String child : children) +// deleteOnExitRecursive(new File(f, child)); +// } +// f.deleteOnExit(); +// } +// +// /** +// * Workaround for Jetty problem where temporary directory +// * doesn't get deleted under Windows due to locking issues. +// * +// * @param tempDir Temporary directory to delete +// */ +// private void deleteTempDir(final File tempDir) { +// try { +// if (tempDir.exists()) { +// log.debug("Temp directory still exists - trying to delete"); +// if (!deleteRecursive(tempDir)) +// { +// log.debug("Deleting temp directory failed - adding shutdown hook"); +// Runtime.getRuntime().addShutdownHook( +// new Thread() { +// public void run() { +// log.debug("Shutdown hook executing"); +// if (tempDir.exists()) { +// log.debug("Temp directory still exists - trying to delete"); +// if (!deleteRecursive(tempDir)) +// { +// log.debug("Deleting temp directory failed"); +// deleteOnExitRecursive(tempDir); +// } +// else +// log.debug("Successfully deleted temp directory"); +// } +// } +// } +// ); +// } +// else +// log.debug("Successfully deleted temp directory"); +// } +// } catch (SecurityException ex) { +// log.debug("Temp directory access failed", ex); +// } +// }
/**
* grant all permissions, since we need read/write access to save signature data files anywhere (JFileChooser) in the local filesystem
@@ -221,13 +299,19 @@ public class Container { return server.isRunning();
}
- public void stop() throws Exception {
- server.stop();
+ public void stop() throws Exception { +// log.debug("Container: stop called"); + server.stop(); + +// deleteTempDir(tempDir); }
public void destroy() {
+// log.debug("Container: destroy called"); server.destroy();
- }
+ +// deleteTempDir(tempDir); +}
public void join() throws InterruptedException {
server.join();
@@ -248,5 +332,5 @@ public class Container { log.error("Failed to load local ca certificate", ex);
log.warn("automated web certificate installation will not be available");
}
- }
+ } }
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java index 95d76a4a..f9500f8c 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java @@ -201,7 +201,7 @@ public class Launcher implements BKUControllerInterface { private void startServer() throws Exception { log.info("init servlet container and MOCCA webapp"); server = new Container(); - server.init(); + server.init(status.getLocale()); server.start(); } diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/WebappErrorHandler.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/WebappErrorHandler.java new file mode 100644 index 00000000..c11f5345 --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/WebappErrorHandler.java @@ -0,0 +1,80 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint + * initiative of the Federal Chancellery Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + +package at.gv.egiz.bku.webstart; + +import java.io.IOException; +import java.util.Locale; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.mortbay.jetty.HttpConnection; +import org.mortbay.jetty.HttpMethods; +import org.mortbay.jetty.servlet.ErrorPageErrorHandler; +import org.mortbay.jetty.servlet.ServletHandler; + +/** + * @author tkellner_local + * + */ +public class WebappErrorHandler extends ErrorPageErrorHandler { + private String link404, link404help; + + public WebappErrorHandler(Locale locale) { + super(); + + link404 = "/help/404.html"; + link404help = "/help/404h.html"; + if (locale != null) + { + String language = locale.getLanguage(); + if (!language.isEmpty()) + { + link404 = "/help/" + language + "/404.html"; + link404help = "/help/" + language + "/404h.html"; + } + } + } + + @Override + public void handle(String target, HttpServletRequest request, + HttpServletResponse response, int dispatch) throws IOException { + String method = request.getMethod(); + if(!method.equals(HttpMethods.GET) && !method.equals(HttpMethods.POST)) + { + HttpConnection.getCurrentConnection().getRequest().setHandled(true); + return; + } + + Integer code=(Integer)request.getAttribute(ServletHandler.__J_S_ERROR_STATUS_CODE); + if (code.equals(404)) + { + HttpConnection.getCurrentConnection().getRequest().setHandled(true); + response.sendRedirect(request.getRequestURI().startsWith("/help") ? link404help : link404); + return; + } + + super.handle(target, request, response, dispatch); + } +} |