1 /* 2 * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ClientConnectionOperator.java $ 3 * $Revision: 645850 $ 4 * $Date: 2008-04-08 04:08:52 -0700 (Tue, 08 Apr 2008) $ 5 * 6 * ==================================================================== 7 * Licensed to the Apache Software Foundation (ASF) under one 8 * or more contributor license agreements. See the NOTICE file 9 * distributed with this work for additional information 10 * regarding copyright ownership. The ASF licenses this file 11 * to you under the Apache License, Version 2.0 (the 12 * "License"); you may not use this file except in compliance 13 * with the License. You may obtain a copy of the License at 14 * 15 * http://www.apache.org/licenses/LICENSE-2.0 16 * 17 * Unless required by applicable law or agreed to in writing, 18 * software distributed under the License is distributed on an 19 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 * KIND, either express or implied. See the License for the 21 * specific language governing permissions and limitations 22 * under the License. 23 * ==================================================================== 24 * 25 * This software consists of voluntary contributions made by many 26 * individuals on behalf of the Apache Software Foundation. For more 27 * information on the Apache Software Foundation, please see 28 * <http://www.apache.org/>. 29 * 30 */ 31 32 package org.apache.http.conn; 33 34 import java.io.IOException; 35 import java.net.InetAddress; 36 37 import org.apache.http.HttpHost; 38 import org.apache.http.conn.scheme.SocketFactory; 39 import org.apache.http.params.HttpParams; 40 import org.apache.http.protocol.HttpContext; 41 42 43 44 /** 45 * Interface for opening {@link OperatedClientConnection connections}. 46 * This interface encapsulates the logic to create sockets and to 47 * open or update the connection with the new socket. 48 * Implementations will most likely make use of 49 * {@link SocketFactory socket factories}. 50 * <br/> 51 * The methods in this interface allow the creation of plain and layered 52 * sockets. Creating a tunnelled connection through a proxy, however, 53 * is not within the scope of the operator. 54 * 55 * @author <a href="mailto:rolandw at apache.org">Roland Weber</a> 56 * 57 * 58 * <!-- empty lines to avoid svn diff problems --> 59 * @version $Revision: 645850 $ $Date: 2008-04-08 04:08:52 -0700 (Tue, 08 Apr 2008) $ 60 * 61 * @since 4.0 62 * 63 * @deprecated Please use {@link java.net.URL#openConnection} instead. 64 * Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a> 65 * for further details. 66 */ 67 @Deprecated 68 public interface ClientConnectionOperator { 69 70 71 /** 72 * Creates a new connection that can be operated. 73 * 74 * @return a new, unopened connection for use with this operator 75 */ createConnection()76 OperatedClientConnection createConnection() 77 ; 78 79 80 /** 81 * Opens a connection to the given target host. 82 * 83 * @param conn the connection to open 84 * @param target the target host to connect to 85 * @param local the local address to route from, or 86 * <code>null</code> for the default 87 * @param context the context for the connection 88 * @param params the parameters for the connection 89 * 90 * @throws IOException in case of a problem 91 */ openConnection(OperatedClientConnection conn, HttpHost target, InetAddress local, HttpContext context, HttpParams params)92 void openConnection(OperatedClientConnection conn, 93 HttpHost target, 94 InetAddress local, 95 HttpContext context, 96 HttpParams params) 97 throws IOException 98 ; 99 100 101 /** 102 * Updates a connection with a layered secure connection. 103 * The typical use of this method is to update a tunnelled plain 104 * connection (HTTP) to a secure TLS/SSL connection (HTTPS). 105 * 106 * @param conn the open connection to update 107 * @param target the target host for the updated connection. 108 * The connection must already be open or tunnelled 109 * to the host and port, but the scheme of the target 110 * will be used to create a layered connection. 111 * @param context the context for the connection 112 * @param params the parameters for the updated connection 113 * 114 * @throws IOException in case of a problem 115 */ updateSecureConnection(OperatedClientConnection conn, HttpHost target, HttpContext context, HttpParams params)116 void updateSecureConnection(OperatedClientConnection conn, 117 HttpHost target, 118 HttpContext context, 119 HttpParams params) 120 throws IOException 121 ; 122 123 124 } // interface ClientConnectionOperator 125 126