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: * * * @param request the incoming request which shall be forwarded * @param publicURLPrefix the public URL prefix to be substituted by the real URL prefix * @param realURLPrefix the URL prefix to substitute the public URL prefix * @param sslSocketFactory factory to be used for creating an SSL socket in case * of a URL for scheme "https:"; *
if 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); }