From 90f7f3ea1674e7cd5ead84247ca881ca101ba72a Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 11 Feb 2009 20:03:29 +0000 Subject: div. changes for A-Trust Activation Support (User-Agent header, GetStatusRequest, ...) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@296 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/binding/DataUrlConnection.java | 118 +++++++++++---------- 1 file changed, 61 insertions(+), 57 deletions(-) (limited to 'bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnection.java') 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 c6ffa32a..21407cc3 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 @@ -14,8 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.binding; - +package at.gv.egiz.bku.binding; + import java.io.IOException; import java.io.InputStream; import java.net.SocketTimeoutException; @@ -23,62 +23,66 @@ import java.net.URL; import java.security.cert.X509Certificate; import at.gv.egiz.bku.slcommands.SLResult; - -/** - * Transmit a security layer result to DataURL via HTTP POST, encoded as multipart/form-data. - * The HTTP header user-agent is set to citizen-card-environment/1.2 BKU2 1.0. - * The form-parameter ResponseType is set to HTTP-Security-Layer-RESPONSE. - * All other headers/parameters are set by the caller. - * - * @author clemens - */ -public interface DataUrlConnection { - - public static final String DEFAULT_USERAGENT = "citizen-card-environment/1.2 MOCCA Unknown"; - public static final String FORMPARAM_RESPONSETYPE = "ResponseType"; - public static final String DEFAULT_RESPONSETYPE = "HTTP-Security-Layer-RESPONSE"; - public static final String FORMPARAM_XMLRESPONSE = "XMLResponse"; - public static final String FORMPARAM_BINARYRESPONSE = "BinaryResponse"; - - public static final String XML_RESPONSE_ENCODING = "UTF-8"; - public final static String USER_AGENT_PROPERTY_KEY="UserAgent"; - +/** + * Transmit a security layer result to DataURL via HTTP POST, encoded as multipart/form-data. + * The HTTP header user-agent is set to citizen-card-environment/1.2 BKU2 1.0. + * The form-parameter ResponseType is set to HTTP-Security-Layer-RESPONSE. + * All other headers/parameters are set by the caller. + * + * @author clemens + */ +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"; + public static final String FORMPARAM_BINARYRESPONSE = "BinaryResponse"; + + public static final String XML_RESPONSE_ENCODING = "UTF-8"; + + public String getProtocol(); - public URL getUrl(); - - /** - * Set a HTTP Header. - * @param key - * @param value multiple values are assumed to have the correct formatting (comma-separated list) - */ - public void setHTTPHeader(String key, String value); - - /** - * Set a form-parameter. - * @param name - * @param data - * @param contentType may be null - * @param charSet may be null - * @param transferEncoding may be null - */ - public void setHTTPFormParameter(String name, InputStream data, String contentType, String charSet, String transferEncoding); - - /** - * @pre httpHeaders != null - * @throws java.net.SocketTimeoutException - * @throws java.io.IOException - */ - public void connect() throws SocketTimeoutException, IOException; - - public X509Certificate getServerCertificate(); - - /** - * @pre connection != null - * @throws java.io.IOException - */ - public void transmit(SLResult slResult) throws IOException; - - public DataUrlResponse getResponse() throws IOException; + public URL getUrl(); + + /** + * Set a HTTP Header. + * @param key + * @param value multiple values are assumed to have the correct formatting (comma-separated list) + */ + public void setHTTPHeader(String key, String value); + + /** + * Set a form-parameter. + * @param name + * @param data + * @param contentType may be null + * @param charSet may be null + * @param transferEncoding may be null + */ + public void setHTTPFormParameter(String name, InputStream data, String contentType, String charSet, String transferEncoding); + + /** + * @pre httpHeaders != null + * @throws java.net.SocketTimeoutException + * @throws java.io.IOException + */ + public void connect() throws SocketTimeoutException, IOException; + + public X509Certificate getServerCertificate(); + + /** + * @pre connection != null + * @throws java.io.IOException + */ + public void transmit(SLResult slResult) throws IOException; + + public DataUrlResponse getResponse() throws IOException; } \ No newline at end of file -- cgit v1.2.3