1 /* 2 * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/routing/RouteInfo.java $ 3 * $Revision: 652200 $ 4 * $Date: 2008-04-29 17:22:43 -0700 (Tue, 29 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.routing; 33 34 import java.net.InetAddress; 35 36 import org.apache.http.HttpHost; 37 38 39 /** 40 * Read-only interface for route information. 41 * 42 * @author <a href="mailto:rolandw at apache.org">Roland Weber</a> 43 * 44 * 45 * <!-- empty lines to avoid svn diff problems --> 46 * @version $Revision: 652200 $ 47 * 48 * @since 4.0 49 * 50 * @deprecated Please use {@link java.net.URL#openConnection} instead. 51 * Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a> 52 * for further details. 53 */ 54 @Deprecated 55 public interface RouteInfo { 56 57 /** 58 * The tunnelling type of a route. 59 * Plain routes are established by connecting to the target or 60 * the first proxy. 61 * Tunnelled routes are established by connecting to the first proxy 62 * and tunnelling through all proxies to the target. 63 * Routes without a proxy cannot be tunnelled. 64 */ 65 public enum TunnelType { PLAIN, TUNNELLED } 66 67 /** 68 * The layering type of a route. 69 * Plain routes are established by connecting or tunnelling. 70 * Layered routes are established by layering a protocol such as TLS/SSL 71 * over an existing connection. 72 * Protocols can only be layered over a tunnel to the target, or 73 * or over a direct connection without proxies. 74 * <br/> 75 * Layering a protocol 76 * over a direct connection makes little sense, since the connection 77 * could be established with the new protocol in the first place. 78 * But we don't want to exclude that use case. 79 */ 80 public enum LayerType { PLAIN, LAYERED } 81 82 83 84 /** 85 * Obtains the target host. 86 * 87 * @return the target host 88 */ getTargetHost()89 HttpHost getTargetHost() 90 ; 91 92 93 /** 94 * Obtains the local address to connect from. 95 * 96 * @return the local address, 97 * or <code>null</code> 98 */ getLocalAddress()99 InetAddress getLocalAddress() 100 ; 101 102 103 /** 104 * Obtains the number of hops in this route. 105 * A direct route has one hop. A route through a proxy has two hops. 106 * A route through a chain of <i>n</i> proxies has <i>n+1</i> hops. 107 * 108 * @return the number of hops in this route 109 */ getHopCount()110 int getHopCount() 111 ; 112 113 114 /** 115 * Obtains the target of a hop in this route. 116 * The target of the last hop is the {@link #getTargetHost target host}, 117 * the target of previous hops is the respective proxy in the chain. 118 * For a route through exactly one proxy, target of hop 0 is the proxy 119 * and target of hop 1 is the target host. 120 * 121 * @param hop index of the hop for which to get the target, 122 * 0 for first 123 * 124 * @return the target of the given hop 125 * 126 * @throws IllegalArgumentException 127 * if the argument is negative or not less than 128 * {@link #getHopCount getHopCount()} 129 */ getHopTarget(int hop)130 HttpHost getHopTarget(int hop) 131 ; 132 133 134 /** 135 * Obtains the first proxy host. 136 * 137 * @return the first proxy in the proxy chain, or 138 * <code>null</code> if this route is direct 139 */ getProxyHost()140 HttpHost getProxyHost() 141 ; 142 143 144 /** 145 * Obtains the tunnel type of this route. 146 * If there is a proxy chain, only end-to-end tunnels are considered. 147 * 148 * @return the tunnelling type 149 */ getTunnelType()150 TunnelType getTunnelType() 151 ; 152 153 154 /** 155 * Checks whether this route is tunnelled through a proxy. 156 * If there is a proxy chain, only end-to-end tunnels are considered. 157 * 158 * @return <code>true</code> if tunnelled end-to-end through at least 159 * one proxy, 160 * <code>false</code> otherwise 161 */ isTunnelled()162 boolean isTunnelled() 163 ; 164 165 166 /** 167 * Obtains the layering type of this route. 168 * In the presence of proxies, only layering over an end-to-end tunnel 169 * is considered. 170 * 171 * @return the layering type 172 */ getLayerType()173 LayerType getLayerType() 174 ; 175 176 177 /** 178 * Checks whether this route includes a layered protocol. 179 * In the presence of proxies, only layering over an end-to-end tunnel 180 * is considered. 181 * 182 * @return <code>true</code> if layered, 183 * <code>false</code> otherwise 184 */ isLayered()185 boolean isLayered() 186 ; 187 188 189 /** 190 * Checks whether this route is secure. 191 * 192 * @return <code>true</code> if secure, 193 * <code>false</code> otherwise 194 */ isSecure()195 boolean isSecure() 196 ; 197 198 199 } // interface RouteInfo 200