summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-11-05 14:42:05 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-11-05 14:42:05 +0000
commit2cf6fcb31e85b0e3b367121219932ec86b205da8 (patch)
tree45f3214a803d25f0b60cad34bd0a8b0b8c24ec5f
parent2b6acde30512e7303ed08c9c4e2276529491a69e (diff)
downloadmocca-2cf6fcb31e85b0e3b367121219932ec86b205da8.tar.gz
mocca-2cf6fcb31e85b0e3b367121219932ec86b205da8.tar.bz2
mocca-2cf6fcb31e85b0e3b367121219932ec86b205da8.zip
help jsp
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@151 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java2
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java45
-rw-r--r--BKUOnline/src/main/webapp/WEB-INF/web.xml11
-rw-r--r--BKUOnline/src/main/webapp/appletPage.jsp2
-rw-r--r--BKUOnline/src/main/webapp/help.jsp7
-rw-r--r--BKUOnline/src/main/webapp/helpfiles/index.html17
6 files changed, 53 insertions, 31 deletions
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
index f3eecdf9..4eab7e89 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
@@ -89,7 +89,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
URL backgroundImgURL = null;
URL helpURL = null;
try {
- helpURL = getURLParameter(HELP_URL, getAppletParameter(SESSION_ID));
+ helpURL = getURLParameter(HELP_URL); //, getAppletParameter(SESSION_ID));
} catch (MalformedURLException ex) {
log.warn("failed to load help URL, disabling help: " + ex.getMessage());
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java
index 6e3167c1..a249a376 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java
@@ -32,39 +32,22 @@ import org.apache.commons.logging.LogFactory;
public abstract class AbstractHelpListener implements ActionListener {
protected final static Log log = LogFactory.getLog(AbstractHelpListener.class);
- protected String helpURLBase;
+// protected String helpURLBase;
+ protected URL baseURL;
protected Locale locale;
public AbstractHelpListener(URL baseURL, Locale locale) {
if (baseURL == null || "".equals(baseURL)) {
throw new RuntimeException("no help URL provided");
}
- this.helpURLBase = baseURL.toString();
+ this.baseURL = baseURL;
this.locale = locale;
}
@Override
public void actionPerformed(ActionEvent e) {
log.debug("received help action: " + e.getActionCommand());
- URL helpURL;
- try {
- String urlString = helpURLBase;
- if (locale != null) {
- urlString = appendParameter(urlString, "locale", locale.toString());
- }
- if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) {
- urlString = appendParameter(urlString, "topic", e.getActionCommand());
- }
- helpURL = new URL(urlString);
- } catch (MalformedURLException ex) {
- try {
- log.error("failed to create help URL: " + ex.getMessage());
- helpURL = new URL(helpURLBase);
- } catch (MalformedURLException ex1) {
- log.error("failed to create default help URL, requested help will not be displayed");
- return;
- }
- }
+ URL helpURL = constructHelpURL(baseURL, e.getActionCommand());
try {
showDocument(helpURL);
} catch (Exception ex) {
@@ -72,12 +55,22 @@ public abstract class AbstractHelpListener implements ActionListener {
}
}
- private String appendParameter(String url, String paramName, String paramValue) {
- if (url.indexOf('?') < 0) {
- return url + "?" + paramName + "=" + paramValue;
- } else {
- return url + "&" + paramName + "=" + paramValue;
+ private URL constructHelpURL(URL baseURL, String helpItem) {
+ URL helpURL = baseURL;
+ log.trace("constructing help URL: " + helpURL);
+ try {
+ if (locale != null) {
+ helpURL = new URL(helpURL, locale.toString() + "/");
+ log.trace("constructing help URL: " + helpURL);
+ }
+ if (helpItem != null && !"".equals(helpItem)) {
+ helpURL = new URL(helpURL, helpItem + ".html");
+ log.trace("constructing help URL: " + helpURL);
+ }
+ } catch (MalformedURLException ex) {
+ log.error("Failed to construct help URL for help item " + helpItem + ": " + ex.getMessage());
}
+ return helpURL;
}
public abstract void showDocument(URL helpDocument) throws Exception;
diff --git a/BKUOnline/src/main/webapp/WEB-INF/web.xml b/BKUOnline/src/main/webapp/WEB-INF/web.xml
index 6b2ec35c..f6fdbefc 100644
--- a/BKUOnline/src/main/webapp/WEB-INF/web.xml
+++ b/BKUOnline/src/main/webapp/WEB-INF/web.xml
@@ -52,6 +52,10 @@
<servlet-name>HashDataInputServlet</servlet-name>
<servlet-class>at.gv.egiz.bku.online.webapp.HashDataInputServlet</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>help</servlet-name>
+ <jsp-file>/help.jsp</jsp-file>
+ </servlet>
<servlet-mapping>
<servlet-name>BKUServlet</servlet-name>
<url-pattern>/http-security-layer-request</url-pattern>
@@ -68,9 +72,10 @@
<servlet-name>HashDataInputServlet</servlet-name>
<url-pattern>/hashDataInput</url-pattern>
</servlet-mapping>
-
-
-
+ <servlet-mapping>
+ <servlet-name>help</servlet-name>
+ <url-pattern>/help/*</url-pattern>
+ </servlet-mapping>
<!-- End BKU Config -->
diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp
index 8ddbed13..ff52fe51 100644
--- a/BKUOnline/src/main/webapp/appletPage.jsp
+++ b/BKUOnline/src/main/webapp/appletPage.jsp
@@ -53,7 +53,7 @@
GuiStyle : '<%=guiStyle%>',
Background : '<%=backgroundImg%>',
WSDL_URL :'../stal?wsdl',
- HelpURL : '../help',
+ HelpURL : '../help/',
HashDataDisplay : 'external',
HashDataURL : '../hashDataInput',
SessionID : '<%=session.getId()%>',
diff --git a/BKUOnline/src/main/webapp/help.jsp b/BKUOnline/src/main/webapp/help.jsp
new file mode 100644
index 00000000..29343171
--- /dev/null
+++ b/BKUOnline/src/main/webapp/help.jsp
@@ -0,0 +1,7 @@
+<%--
+ Document : help
+ Created on : 05.11.2008, 10:55:52
+ Author : Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+--%>
+
+<jsp:include page="/helpfiles/index.html"/>
diff --git a/BKUOnline/src/main/webapp/helpfiles/index.html b/BKUOnline/src/main/webapp/helpfiles/index.html
new file mode 100644
index 00000000..84db59c6
--- /dev/null
+++ b/BKUOnline/src/main/webapp/helpfiles/index.html
@@ -0,0 +1,17 @@
+<!--
+ Document : index
+ Created on : 05.11.2008, 14:09:23
+ Author : Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <title></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+ <body>
+
+ <h2>No help item provided</h2>
+
+ </body>
+</html>