summaryrefslogtreecommitdiff
path: root/bkucommon/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'bkucommon/src/main/java')
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java3
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnection.java6
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java7
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/binding/LegacyDataUrlConnectionImpl.java11
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/conf/Configurator.java19
5 files changed, 25 insertions, 21 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java
index 7b682136..aaeacd98 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java
@@ -16,6 +16,7 @@
*/
package at.gv.egiz.bku.binding;
+import at.gv.egiz.bku.conf.Configurator;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
@@ -82,7 +83,7 @@ public class DataUrl {
public static void setConfiguration(Properties props) {
configuration = props;
if (configuration != null) {
- String className = configuration.getProperty(DataUrlConnection.DATAURLCONNECTION_CONFIG_P);
+ String className = configuration.getProperty(Configurator.DATAURLCONNECTION_CONFIG_P);
if (className != null) {
try {
log.info("set DataURLConnection class: " + className);
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnection.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnection.java
index 21407cc3..f954a017 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnection.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnection.java
@@ -34,12 +34,6 @@ import at.gv.egiz.bku.slcommands.SLResult;
*/
public interface DataUrlConnection {
- public final static String USERAGENT_CONFIG_P = "UserAgent";
- public static final String USERAGENT_DEFAULT = "citizen-card-environment/1.2 MOCCA/UNKNOWN";
- public static final String USERAGENT_BASE = "citizen-card-environment/1.2 MOCCA/";
-
- public static final String DATAURLCONNECTION_CONFIG_P = "DataURLConnectionImplClass";
-
public static final String FORMPARAM_RESPONSETYPE = "ResponseType";
public static final String DEFAULT_RESPONSETYPE = "HTTP-Security-Layer-RESPONSE";
public static final String FORMPARAM_XMLRESPONSE = "XMLResponse";
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java
index d9a9454e..4c235456 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java
@@ -43,6 +43,7 @@ import org.apache.commons.logging.LogFactory;
import at.gv.egiz.bku.binding.multipart.InputStreamPartSource;
import at.gv.egiz.bku.binding.multipart.SLResultPart;
+import at.gv.egiz.bku.conf.Configurator;
import at.gv.egiz.bku.slcommands.SLResult;
import at.gv.egiz.bku.slcommands.SLResult.SLResultType;
import at.gv.egiz.bku.slexceptions.SLRuntimeException;
@@ -225,12 +226,12 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI {
boundary = "--" + IdFactory.getInstance().createId().toString();
requestHttpHeaders = new HashMap<String, String>();
if ((config != null)
- && (config.getProperty(USERAGENT_CONFIG_P) != null)) {
+ && (config.getProperty(Configurator.USERAGENT_CONFIG_P) != null)) {
requestHttpHeaders.put(HttpUtil.HTTP_HEADER_USER_AGENT, config
- .getProperty(USERAGENT_CONFIG_P));
+ .getProperty(Configurator.USERAGENT_CONFIG_P));
} else {
requestHttpHeaders
- .put(HttpUtil.HTTP_HEADER_USER_AGENT, USERAGENT_DEFAULT);
+ .put(HttpUtil.HTTP_HEADER_USER_AGENT, Configurator.USERAGENT_DEFAULT);
}
requestHttpHeaders.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE,
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/LegacyDataUrlConnectionImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/LegacyDataUrlConnectionImpl.java
index ef9dd199..cfccb7f1 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/LegacyDataUrlConnectionImpl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/LegacyDataUrlConnectionImpl.java
@@ -1,6 +1,7 @@
package at.gv.egiz.bku.binding;
+import at.gv.egiz.bku.conf.Configurator;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -38,7 +39,7 @@ import at.gv.egiz.bku.utils.binding.Protocol;
*/
public class LegacyDataUrlConnectionImpl implements DataUrlConnectionSPI {
- private final static Log log = LogFactory.getLog(DataUrlConnectionImpl.class);
+ private final static Log log = LogFactory.getLog(LegacyDataUrlConnectionImpl.class);
public final static Protocol[] SUPPORTED_PROTOCOLS = { Protocol.HTTP,
Protocol.HTTPS };
@@ -212,13 +213,13 @@ public class LegacyDataUrlConnectionImpl implements DataUrlConnectionSPI {
this.url = url;
requestHttpHeaders = new HashMap<String, String>();
if ((config != null)
- && (config.getProperty(USERAGENT_CONFIG_P) != null)) {
- log.debug("setting User-Agent header: " + config.getProperty(USERAGENT_CONFIG_P));
+ && (config.getProperty(Configurator.USERAGENT_CONFIG_P) != null)) {
+ log.debug("setting User-Agent header: " + config.getProperty(Configurator.USERAGENT_CONFIG_P));
requestHttpHeaders.put(HttpUtil.HTTP_HEADER_USER_AGENT, config
- .getProperty(USERAGENT_CONFIG_P));
+ .getProperty(Configurator.USERAGENT_CONFIG_P));
} else {
requestHttpHeaders
- .put(HttpUtil.HTTP_HEADER_USER_AGENT, USERAGENT_DEFAULT);
+ .put(HttpUtil.HTTP_HEADER_USER_AGENT, Configurator.USERAGENT_DEFAULT);
}
requestHttpHeaders.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE,
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configurator.java b/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configurator.java
index a6c70d2c..6213ffcf 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configurator.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configurator.java
@@ -49,6 +49,13 @@ public abstract class Configurator {
private Log log = LogFactory.getLog(Configurator.class);
+ public final static String USERAGENT_CONFIG_P = "UserAgent";
+ public static final String DATAURLCONNECTION_CONFIG_P = "DataURLConnectionImplClass";
+
+ public static final String USERAGENT_DEFAULT = "citizen-card-environment/1.2 MOCCA/UNKNOWN";
+ public static final String USERAGENT_BASE = "citizen-card-environment/1.2 MOCCA/";
+
+
protected Properties properties;
protected CertValidator certValidator;
@@ -203,22 +210,22 @@ public abstract class Configurator {
}
public void configureVersion() {
- if (properties.getProperty(DataUrlConnection.USERAGENT_CONFIG_P) == null) {
+ if (properties.getProperty(USERAGENT_CONFIG_P) == null) {
Properties p = new Properties();
try {
InputStream is = getManifest();
if (is != null) {
p.load(getManifest());
String version = p.getProperty("Implementation-Build");
- properties.setProperty(DataUrlConnection.USERAGENT_CONFIG_P,
- DataUrlConnection.USERAGENT_BASE + version);
+ properties.setProperty(USERAGENT_CONFIG_P,
+ USERAGENT_BASE + version);
log.debug("Setting user agent to: "
+ properties
- .getProperty(DataUrlConnection.USERAGENT_CONFIG_P));
+ .getProperty(USERAGENT_CONFIG_P));
} else {
log.warn("Cannot read manifest");
- properties.setProperty(DataUrlConnection.USERAGENT_CONFIG_P,
- DataUrlConnection.USERAGENT_DEFAULT);
+ properties.setProperty(USERAGENT_CONFIG_P,
+ USERAGENT_DEFAULT);
}
} catch (IOException e) {
log.error(e);