summaryrefslogtreecommitdiff
path: root/BKULocal
diff options
context:
space:
mode:
Diffstat (limited to 'BKULocal')
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java20
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java30
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java5
-rw-r--r--BKULocal/src/main/webapp/WEB-INF/applicationContext.xml36
4 files changed, 59 insertions, 32 deletions
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
index ebec9c65..e32c9c3d 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package at.gv.egiz.bku.local.gui;
import at.gv.egiz.bku.gui.AbstractHelpListener;
@@ -22,6 +21,7 @@ import java.awt.Desktop;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
+import java.util.Locale;
/**
*
@@ -29,13 +29,25 @@ import java.net.URL;
*/
public class LocalHelpListener extends AbstractHelpListener {
- public LocalHelpListener(URL baseURL, String locale) {
+ protected Desktop desktop;
+
+ public LocalHelpListener(URL baseURL, Locale locale) {
super(baseURL, locale);
+ if (Desktop.isDesktopSupported()) {
+ desktop = Desktop.getDesktop();
+ }
}
@Override
public void showDocument(URL helpDocument) throws IOException, URISyntaxException {
- Desktop.getDesktop().browse(helpDocument.toURI());
+ if (desktop == null) {
+ log.error("Failed to open default browser: Desktop API not available (libgnome installed?)");
+ } else {
+ if (!desktop.isSupported(Desktop.Action.BROWSE)) {
+ log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action");
+ } else {
+ Desktop.getDesktop().browse(helpDocument.toURI());
+ }
+ }
}
-
}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java
index d3530332..4cc7bcd3 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java
@@ -32,30 +32,38 @@ import at.gv.egiz.bku.online.applet.BKUApplet;
import at.gv.egiz.stal.STAL;
import at.gv.egiz.stal.STALFactory;
import java.net.URL;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
public class SMCCSTALFactory implements STALFactory {
- private Locale locale;
+ protected static final Log log = LogFactory.getLog(SMCCSTALFactory.class);
+ protected String helpURL;
+ protected Locale locale;
@Override
public STAL createSTAL() {
-
+
SMCCSTAL stal;
JDialog dialog;
ResourceBundle resourceBundle;
if (locale != null) {
resourceBundle = ResourceBundle.getBundle(BKUApplet.RESOURCE_BUNDLE_BASE,
- locale);
+ locale);
} else {
resourceBundle = ResourceBundle.getBundle(BKUApplet.RESOURCE_BUNDLE_BASE);
}
dialog = new JDialog();
BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI);
- LocalHelpListener helpListener =null;
+ LocalHelpListener helpListener = null;
try {
- helpListener = new LocalHelpListener(new URL("http://localhost:3495/help"), "en");
+ if (helpURL != null) {
+ helpListener = new LocalHelpListener(new URL(helpURL), locale);
+ } else {
+ log.warn("no HELP URL configured, help system disabled");
+ }
} catch (MalformedURLException ex) {
- ex.printStackTrace();
+ log.error("failed to configure help listener: " + ex.getMessage(), ex);
}
gui.init(dialog.getContentPane(), locale.toString(), null, helpListener);
stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog, resourceBundle);
@@ -72,7 +80,7 @@ public class SMCCSTALFactory implements STALFactory {
frameSize.width = screenSize.width;
}
dialog.setLocation((screenSize.width - frameSize.width) / 2,
- (screenSize.height - frameSize.height) / 2);
+ (screenSize.height - frameSize.height) / 2);
return stal;
}
@@ -80,4 +88,12 @@ public class SMCCSTALFactory implements STALFactory {
public void setLocale(Locale locale) {
this.locale = locale;
}
+
+ public String getHelpURL() {
+ return helpURL;
+ }
+
+ public void setHelpURL(String helpURL) {
+ this.helpURL = helpURL;
+ }
}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java
index f19b86b5..62705d1e 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java
@@ -16,7 +16,6 @@
*/
package at.gv.egiz.bku.local.webapp;
-import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
@@ -30,12 +29,10 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.web.HttpRequestHandler;
import at.gv.egiz.bku.binding.BindingProcessorManager;
import at.gv.egiz.bku.binding.HTTPBindingProcessor;
import at.gv.egiz.bku.binding.HttpUtil;
-import at.gv.egiz.bku.utils.StreamUtil;
import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage;
public abstract class BKURequestHandler extends HttpServlet {
@@ -68,7 +65,7 @@ public abstract class BKURequestHandler extends HttpServlet {
bindingProcessor.setHTTPHeaders(headerMap);
bindingProcessor.consumeRequestStream(req.getInputStream());
- // fixxme just for testing
+ // fixxme just for testing
bindingProcessor.run();
if (bindingProcessor.getRedirectURL() != null) {
resp.sendRedirect(bindingProcessor.getRedirectURL());
diff --git a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml
index a951f056..3191f82f 100644
--- a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml
@@ -1,25 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2008 Federal Chancellery Austria and
- Graz University of Technology
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
+<!--
+ Copyright 2008 Federal Chancellery Austria and
+ Graz University of Technology
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="STALFactory" class="at.gv.egiz.bku.local.stal.SMCCSTALFactory"
- scope="singleton" />
+ scope="singleton">
+ <property name="helpURL" value="http://localhost:3495/help"/>
+ </bean>
<bean id="bindingProcessorManager" class="at.gv.egiz.bku.binding.BindingProcessorManagerImpl"