/*
* Copyright 2003 Federal Chancellery Austria
* MOA-ID has been developed in a cooperation between BRZ, the Federal
* Chancellery Austria - ICT staff unit, 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.egovernment.moa.id.proxy;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.util.Vector;
import javax.net.ssl.SSLSocketFactory;
import javax.servlet.http.HttpServletRequest;
/**
* Builder for {@link java.net.URLConnection} objects used to forward requests
* to the remote online application.
*
* @author Paul Ivancsics
* @version $Id$
*/
public interface ConnectionBuilder {
/**
* Builds an HttpURLConnection to a {@link java.net.URL} which is derived
* from an {@link HttpServletRequest} URL, by substitution of a
* public URL prefix for the real URL prefix.
* The HttpURLConnection has been created by {@link java.net.URL#openConnection}, but
* it has not yet been connected to by {@link java.net.URLConnection#connect}.
* The field settings of the HttpURLConnection are:
*
allowUserInteraction = false
doInput = true
doOutput = true
requestMethod = request.getMethod()
useCaches = false
"https:"
;
* null
, the default SSL socket factory would be used
* @param parameters parameters to be forwarded
* @return a URLConnection created by {@link java.net.URL#openConnection}, connecting to
* the requested URL with publicURLPrefix
substituted by realURLPrefix
* @throws IOException if an I/O exception occurs during opening the connection
* @see java.net.URL#openConnection()
* @see com.sun.net.ssl.HttpsURLConnection#getDefaultSSLSocketFactory()
*/
public HttpURLConnection buildConnection(
HttpServletRequest request,
String publicURLPrefix,
String realURLPrefix,
SSLSocketFactory sslSocketFactory,
Vector parameters) throws IOException;
/**
* Disconnects the HttpURLConnection if necessary.
* The implementation of the Connectionbuilder decides wether
* if this should be happen or not.
*
* @param con the HttpURLConnection which is normaly to be closed
*/
public void disconnect(HttpURLConnection con);
}