mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-17 07:26:47 +00:00
Javadoc updates and code cleanups
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@766758 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
af182ce5e9
commit
4f51cdcf24
@ -36,28 +36,20 @@
|
||||
import net.jcip.annotations.NotThreadSafe;
|
||||
|
||||
/**
|
||||
* Basic implementation of {@link EofSensorWatcher EofSensorWatcher}.
|
||||
* The underlying connection is released on close or EOF.
|
||||
*
|
||||
*
|
||||
*
|
||||
* <!-- empty lines to avoid svn diff problems -->
|
||||
* @version $Revision$
|
||||
* Basic implementation of {@link EofSensorWatcher}. The underlying connection
|
||||
* is released on close or EOF.
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
@NotThreadSafe
|
||||
public class BasicEofSensorWatcher implements EofSensorWatcher {
|
||||
|
||||
|
||||
/** The connection to auto-release. */
|
||||
protected final ManagedClientConnection managedConn;
|
||||
|
||||
/** Whether to keep the connection alive. */
|
||||
protected final boolean attemptReuse;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new watcher for auto-releasing a connection.
|
||||
*
|
||||
@ -74,8 +66,6 @@ public BasicEofSensorWatcher(ManagedClientConnection conn,
|
||||
attemptReuse = reuse;
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface EofSensorWatcher
|
||||
public boolean eofDetected(InputStream wrapped)
|
||||
throws IOException {
|
||||
|
||||
@ -92,8 +82,6 @@ public boolean eofDetected(InputStream wrapped)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface EofSensorWatcher
|
||||
public boolean streamClosed(InputStream wrapped)
|
||||
throws IOException {
|
||||
|
||||
@ -110,8 +98,6 @@ public boolean streamClosed(InputStream wrapped)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface EofSensorWatcher
|
||||
public boolean streamAbort(InputStream wrapped)
|
||||
throws IOException {
|
||||
|
||||
@ -119,4 +105,4 @@ public boolean streamAbort(InputStream wrapped)
|
||||
return false;
|
||||
}
|
||||
|
||||
} // class BasicEofSensorWatcher
|
||||
}
|
||||
|
@ -39,18 +39,12 @@
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.entity.HttpEntityWrapper;
|
||||
|
||||
|
||||
/**
|
||||
* An entity that releases a {@link ManagedClientConnection connection}.
|
||||
* A {@link ManagedClientConnection} will
|
||||
* typically <i>not</i> return a managed entity, but you can replace
|
||||
* the unmanaged entity in the response with a managed one.
|
||||
*
|
||||
*
|
||||
*
|
||||
* <!-- empty lines to avoid svn diff problems -->
|
||||
* @version $Revision$
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
@NotThreadSafe
|
||||
@ -63,7 +57,6 @@ public class BasicManagedEntity extends HttpEntityWrapper
|
||||
/** Whether to keep the connection alive. */
|
||||
protected final boolean attemptReuse;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new managed entity that can release a connection.
|
||||
*
|
||||
@ -87,26 +80,18 @@ public BasicManagedEntity(HttpEntity entity,
|
||||
this.attemptReuse = reuse;
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpEntity
|
||||
@Override
|
||||
public boolean isRepeatable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpEntity
|
||||
@Override
|
||||
public InputStream getContent() throws IOException {
|
||||
|
||||
return new EofSensorInputStream(wrappedEntity.getContent(), this);
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpEntity
|
||||
@Override
|
||||
public void consumeContent() throws IOException {
|
||||
|
||||
if (managedConn == null)
|
||||
return;
|
||||
|
||||
@ -121,26 +106,17 @@ public void consumeContent() throws IOException {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpEntity
|
||||
@Override
|
||||
public void writeTo(final OutputStream outstream) throws IOException {
|
||||
super.writeTo(outstream);
|
||||
consumeContent();
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface ConnectionReleaseTrigger
|
||||
public void releaseConnection()
|
||||
throws IOException {
|
||||
|
||||
public void releaseConnection() throws IOException {
|
||||
this.consumeContent();
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface ConnectionReleaseTrigger
|
||||
public void abortConnection()
|
||||
throws IOException {
|
||||
public void abortConnection() throws IOException {
|
||||
|
||||
if (managedConn != null) {
|
||||
try {
|
||||
@ -151,11 +127,7 @@ public void abortConnection()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface EofSensorWatcher
|
||||
public boolean eofDetected(InputStream wrapped)
|
||||
throws IOException {
|
||||
|
||||
public boolean eofDetected(InputStream wrapped) throws IOException {
|
||||
try {
|
||||
if (attemptReuse && (managedConn != null)) {
|
||||
// there may be some cleanup required, such as
|
||||
@ -169,11 +141,7 @@ public boolean eofDetected(InputStream wrapped)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface EofSensorWatcher
|
||||
public boolean streamClosed(InputStream wrapped)
|
||||
throws IOException {
|
||||
|
||||
public boolean streamClosed(InputStream wrapped) throws IOException {
|
||||
try {
|
||||
if (attemptReuse && (managedConn != null)) {
|
||||
// this assumes that closing the stream will
|
||||
@ -187,18 +155,13 @@ public boolean streamClosed(InputStream wrapped)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface EofSensorWatcher
|
||||
public boolean streamAbort(InputStream wrapped)
|
||||
throws IOException {
|
||||
|
||||
public boolean streamAbort(InputStream wrapped) throws IOException {
|
||||
if (managedConn != null) {
|
||||
managedConn.abortConnection();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Releases the connection gracefully.
|
||||
* The connection attribute will be nullified.
|
||||
@ -219,4 +182,4 @@ protected void releaseManagedConnection()
|
||||
}
|
||||
}
|
||||
|
||||
} // class BasicManagedEntity
|
||||
}
|
||||
|
@ -31,19 +31,17 @@
|
||||
|
||||
package org.apache.http.conn;
|
||||
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.http.conn.routing.HttpRoute;
|
||||
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||
|
||||
/**
|
||||
* Management interface for {@link ManagedClientConnection client connections}.
|
||||
*
|
||||
*
|
||||
*
|
||||
* <!-- empty lines to avoid svn diff problems -->
|
||||
* @version $Revision$
|
||||
* Management interface for {@link ManagedClientConnection client connections}.
|
||||
* The purpose of an HTTP connection manager is to serve as a factory for new
|
||||
* HTTP connections, manage persistent connections and synchronize access to
|
||||
* persistent connections making sure that only one thread of execution can
|
||||
* have access to a connection at a time.
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
@ -54,18 +52,14 @@ public interface ClientConnectionManager {
|
||||
*
|
||||
* @return the scheme registry, never <code>null</code>
|
||||
*/
|
||||
SchemeRegistry getSchemeRegistry()
|
||||
;
|
||||
|
||||
SchemeRegistry getSchemeRegistry();
|
||||
|
||||
/**
|
||||
* Returns a new {@link ClientConnectionRequest}, from which a
|
||||
* {@link ManagedClientConnection} can be obtained or the request can be
|
||||
* aborted.
|
||||
*/
|
||||
ClientConnectionRequest requestConnection(HttpRoute route, Object state)
|
||||
;
|
||||
|
||||
ClientConnectionRequest requestConnection(HttpRoute route, Object state);
|
||||
|
||||
/**
|
||||
* Releases a connection for use by others.
|
||||
@ -83,9 +77,7 @@ ClientConnectionRequest requestConnection(HttpRoute route, Object state)
|
||||
*
|
||||
* @see #closeExpiredConnections()
|
||||
*/
|
||||
void releaseConnection(ManagedClientConnection conn, long validDuration, TimeUnit timeUnit)
|
||||
;
|
||||
|
||||
void releaseConnection(ManagedClientConnection conn, long validDuration, TimeUnit timeUnit);
|
||||
|
||||
/**
|
||||
* Closes idle connections in the pool.
|
||||
@ -101,8 +93,7 @@ void releaseConnection(ManagedClientConnection conn, long validDuration, TimeUni
|
||||
*
|
||||
* @see #closeExpiredConnections()
|
||||
*/
|
||||
void closeIdleConnections(long idletime, TimeUnit tunit)
|
||||
;
|
||||
void closeIdleConnections(long idletime, TimeUnit tunit);
|
||||
|
||||
/**
|
||||
* Closes all expired connections in the pool.
|
||||
@ -118,8 +109,6 @@ void closeIdleConnections(long idletime, TimeUnit tunit)
|
||||
* This includes closing all connections, whether they are currently
|
||||
* used or not.
|
||||
*/
|
||||
void shutdown()
|
||||
;
|
||||
void shutdown();
|
||||
|
||||
|
||||
} // interface ClientConnectionManager
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.conn.scheme.SocketFactory;
|
||||
@ -40,11 +41,10 @@
|
||||
import org.apache.http.protocol.HttpContext;
|
||||
|
||||
/**
|
||||
* Interface for opening {@link OperatedClientConnection connections}.
|
||||
* This interface encapsulates the logic to create sockets and to
|
||||
* open or update the connection with the new socket.
|
||||
* Implementations will most likely make use of
|
||||
* {@link SocketFactory socket factories}.
|
||||
* ClientConnectionOperator represents a strategy for creating
|
||||
* {@link OperatedClientConnection} instances and updating the underlying
|
||||
* {@link Socket} of those objects. Implementations will most likely make use
|
||||
* of {@link SocketFactory}s to create {@link Socket} instances.
|
||||
* <br/>
|
||||
* The methods in this interface allow the creation of plain and layered
|
||||
* sockets. Creating a tunnelled connection through a proxy, however,
|
||||
|
@ -33,13 +33,11 @@
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Interface for releasing a connection.
|
||||
* This can be implemented by various "trigger" objects which are
|
||||
* associated with a connection, for example
|
||||
* a {@link EofSensorInputStream stream}
|
||||
* or an {@link BasicManagedEntity entity}
|
||||
* Interface for releasing a connection. This can be implemented by various
|
||||
* "trigger" objects which are associated with a connection, for example
|
||||
* a {@link EofSensorInputStream stream} or an {@link BasicManagedEntity entity}
|
||||
* or the {@link ManagedClientConnection connection} itself.
|
||||
* <br/>
|
||||
* <p>
|
||||
* The methods in this interface can safely be called multiple times.
|
||||
* The first invocation releases the connection, subsequent calls
|
||||
* are ignored.
|
||||
|
@ -34,8 +34,8 @@
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* A watcher for {@link EofSensorInputStream EofSensorInputStream}.
|
||||
* Each stream will notify its watcher at most once.
|
||||
* A watcher for {@link EofSensorInputStream}. Each stream will notify its
|
||||
* watcher at most once.
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
|
@ -53,7 +53,6 @@
|
||||
public interface ManagedClientConnection extends
|
||||
HttpClientConnection, HttpInetConnection, ConnectionReleaseTrigger {
|
||||
|
||||
|
||||
/**
|
||||
* Indicates whether this connection is secure.
|
||||
* The return value is well-defined only while the connection is open.
|
||||
|
@ -34,11 +34,8 @@
|
||||
-->
|
||||
</head>
|
||||
<body>
|
||||
The client-side connection management and handling API
|
||||
at the heart of what is referred to as <i>HttpConn</i>.
|
||||
This component provides interfaces and implementations for
|
||||
opening and managing connections.
|
||||
|
||||
The client-side connection management and handling API that provides interfaces
|
||||
and implementations for opening and managing client side HTTP connections.
|
||||
<p>
|
||||
The lowest layer of connection handling is comprised of
|
||||
{@link org.apache.http.conn.OperatedClientConnection OperatedClientConnection}
|
||||
@ -46,41 +43,37 @@
|
||||
{@link org.apache.http.conn.ClientConnectionOperator ClientConnectionOperator}.
|
||||
The connection interface extends the core
|
||||
{@link org.apache.http.HttpClientConnection HttpClientConnection}
|
||||
by operations to set and update a socket.
|
||||
An operator encapsulates the logic to open and layer sockets,
|
||||
typically using a {@link org.apache.http.conn.scheme.SocketFactory SocketFactory}.
|
||||
The socket factory for a protocol
|
||||
{@link org.apache.http.conn.scheme.Scheme Scheme}
|
||||
such as "http" or "https" can be looked up in a
|
||||
{@link org.apache.http.conn.scheme.SchemeRegistry SchemeRegistry}.
|
||||
Applications without a need for sophisticated connection management
|
||||
can use this layer directly.
|
||||
by operations to set and update a socket. An operator encapsulates the logic to
|
||||
open and layer sockets, typically using a
|
||||
{@link org.apache.http.conn.scheme.SocketFactory}. The socket factory for
|
||||
a protocol {@link org.apache.http.conn.scheme.Scheme} such as "http" or "https"
|
||||
can be looked up in a {@link org.apache.http.conn.scheme.SchemeRegistry}.
|
||||
Applications without a need for sophisticated connection management can use
|
||||
this layer directly.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
On top of that lies the connection management layer. A
|
||||
{@link org.apache.http.conn.ClientConnectionManager ClientConnectionManager}
|
||||
internally manages operated connections, but hands out instances of
|
||||
{@link org.apache.http.conn.ManagedClientConnection ManagedClientConnection}.
|
||||
{@link org.apache.http.conn.ClientConnectionManager} internally manages
|
||||
operated connections, but hands out instances of
|
||||
{@link org.apache.http.conn.ManagedClientConnection}.
|
||||
This interface abstracts from the underlying socket operations and
|
||||
provides convenient methods for opening and updating sockets in order
|
||||
to establish a {@link org.apache.http.conn.routing.HttpRoute route}.
|
||||
The operator is encapsulated by the connection manager and called
|
||||
automatically.
|
||||
|
||||
<br/>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
Connections obtained from a manager have to be returned after use.
|
||||
This can be {@link org.apache.http.conn.ConnectionReleaseTrigger triggered}
|
||||
on various levels, either by releasing the
|
||||
{@link org.apache.http.conn.ManagedClientConnection
|
||||
connection}
|
||||
directly, or by calling a method on an
|
||||
{@link org.apache.http.conn.BasicManagedEntity entity}
|
||||
received from the connection, or by closing the
|
||||
{@link org.apache.http.conn.EofSensorInputStream stream}
|
||||
from which that entity is being read.
|
||||
|
||||
on various levels, either by releasing the
|
||||
{@link org.apache.http.conn.ManagedClientConnection connection} directly,
|
||||
or by calling a method on
|
||||
an {@link org.apache.http.conn.BasicManagedEntity entity} received from
|
||||
the connection, or by closing the
|
||||
{@link org.apache.http.conn.EofSensorInputStream stream} from which
|
||||
that entity is being read.
|
||||
</p>
|
||||
<p>
|
||||
Connection managers will try to keep returned connections alive in
|
||||
order to re-use them for subsequent requests along the same route.
|
||||
The managed connection interface and all triggers for connection release
|
||||
|
@ -34,7 +34,7 @@
|
||||
-->
|
||||
</head>
|
||||
<body>
|
||||
Parameters for configuring <i>HttpConn</i>.
|
||||
|
||||
Parameters for configuring HTTP connection and connection management
|
||||
related classes.
|
||||
</body>
|
||||
</html>
|
||||
|
@ -34,8 +34,7 @@
|
||||
-->
|
||||
</head>
|
||||
<body>
|
||||
The client-side route representation and tracking API, part of <i>HttpConn</i>.
|
||||
|
||||
The client-side route representation and tracking API.
|
||||
<p>
|
||||
An {@link org.apache.http.conn.routing.HttpRoute HttpRoute}
|
||||
is the path along which a request has to be sent to the server.
|
||||
@ -48,15 +47,11 @@
|
||||
{@link org.apache.http.conn.routing.HttpRouteDirector HttpRouteDirector}
|
||||
determines the next step to take.
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
The {@link org.apache.http.conn.routing.HttpRoutePlanner HttpRoutePlanner}
|
||||
is responsible for determining a route to a given target host.
|
||||
Implementations must know about proxies to use, and about exemptions
|
||||
for hosts that should be contacted directly without a proxy.
|
||||
</p>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -0,0 +1,42 @@
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
/*
|
||||
* $HeadURL:$
|
||||
* $Revision:$
|
||||
* $Date:$
|
||||
*
|
||||
* ====================================================================
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
-->
|
||||
</head>
|
||||
<body>
|
||||
{@link org.apache.http.conn.scheme.Scheme} class represents a protocol
|
||||
scheme such as "http" or "https" and contains a number of protocol properties
|
||||
such as the default port and the socket factory to be used to creating
|
||||
{@link java.net.Socket}s for the given protocol
|
||||
</body>
|
||||
</html>
|
@ -30,7 +30,6 @@
|
||||
|
||||
package org.apache.http.impl.conn;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.net.InetAddress;
|
||||
@ -49,7 +48,6 @@
|
||||
import org.apache.http.conn.ManagedClientConnection;
|
||||
import org.apache.http.conn.ClientConnectionManager;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract adapter from {@link OperatedClientConnection operated} to
|
||||
* {@link ManagedClientConnection managed} client connections.
|
||||
@ -58,26 +56,20 @@
|
||||
* by derived classes. Operations for querying the connection state
|
||||
* are delegated to the wrapped connection if there is one, or
|
||||
* return a default value if there is none.
|
||||
* <br/>
|
||||
* <p>
|
||||
* This adapter tracks the checkpoints for reusable communication states,
|
||||
* as indicated by {@link #markReusable markReusable} and queried by
|
||||
* {@link #isMarkedReusable isMarkedReusable}.
|
||||
* All send and receive operations will automatically clear the mark.
|
||||
* <br/>
|
||||
* <p>
|
||||
* Connection release calls are delegated to the connection manager,
|
||||
* if there is one. {@link #abortConnection abortConnection} will
|
||||
* clear the reusability mark first. The connection manager is
|
||||
* expected to tolerate multiple calls to the release method.
|
||||
*
|
||||
*
|
||||
*
|
||||
* <!-- empty lines to avoid svn diff problems -->
|
||||
* @version $Revision$ $Date$
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public abstract class AbstractClientConnAdapter
|
||||
implements ManagedClientConnection {
|
||||
public abstract class AbstractClientConnAdapter implements ManagedClientConnection {
|
||||
|
||||
/** Thread that requested this connection. */
|
||||
private final Thread executionThread;
|
||||
@ -163,7 +155,6 @@ protected final void assertValid(
|
||||
}
|
||||
}
|
||||
|
||||
// non-javadoc, see interface HttpConnection
|
||||
public boolean isOpen() {
|
||||
OperatedClientConnection conn = getWrappedConnection();
|
||||
if (conn == null)
|
||||
@ -172,8 +163,6 @@ public boolean isOpen() {
|
||||
return conn.isOpen();
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpConnection
|
||||
public boolean isStale() {
|
||||
if (aborted)
|
||||
return true;
|
||||
@ -184,32 +173,24 @@ public boolean isStale() {
|
||||
return conn.isStale();
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpConnection
|
||||
public void setSocketTimeout(int timeout) {
|
||||
OperatedClientConnection conn = getWrappedConnection();
|
||||
assertValid(conn);
|
||||
conn.setSocketTimeout(timeout);
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpConnection
|
||||
public int getSocketTimeout() {
|
||||
OperatedClientConnection conn = getWrappedConnection();
|
||||
assertValid(conn);
|
||||
return conn.getSocketTimeout();
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpConnection
|
||||
public HttpConnectionMetrics getMetrics() {
|
||||
OperatedClientConnection conn = getWrappedConnection();
|
||||
assertValid(conn);
|
||||
return conn.getMetrics();
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpClientConnection
|
||||
public void flush()
|
||||
throws IOException {
|
||||
|
||||
@ -220,8 +201,6 @@ public void flush()
|
||||
conn.flush();
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpClientConnection
|
||||
public boolean isResponseAvailable(int timeout)
|
||||
throws IOException {
|
||||
|
||||
@ -232,8 +211,6 @@ public boolean isResponseAvailable(int timeout)
|
||||
return conn.isResponseAvailable(timeout);
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpClientConnection
|
||||
public void receiveResponseEntity(HttpResponse response)
|
||||
throws HttpException, IOException {
|
||||
|
||||
@ -245,8 +222,6 @@ public void receiveResponseEntity(HttpResponse response)
|
||||
conn.receiveResponseEntity(response);
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpClientConnection
|
||||
public HttpResponse receiveResponseHeader()
|
||||
throws HttpException, IOException {
|
||||
|
||||
@ -258,8 +233,6 @@ public HttpResponse receiveResponseHeader()
|
||||
return conn.receiveResponseHeader();
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpClientConnection
|
||||
public void sendRequestEntity(HttpEntityEnclosingRequest request)
|
||||
throws HttpException, IOException {
|
||||
|
||||
@ -271,8 +244,6 @@ public void sendRequestEntity(HttpEntityEnclosingRequest request)
|
||||
conn.sendRequestEntity(request);
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpClientConnection
|
||||
public void sendRequestHeader(HttpRequest request)
|
||||
throws HttpException, IOException {
|
||||
|
||||
@ -284,44 +255,36 @@ public void sendRequestHeader(HttpRequest request)
|
||||
conn.sendRequestHeader(request);
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpInetConnection
|
||||
public InetAddress getLocalAddress() {
|
||||
OperatedClientConnection conn = getWrappedConnection();
|
||||
assertValid(conn);
|
||||
return conn.getLocalAddress();
|
||||
}
|
||||
|
||||
// non-javadoc, see interface HttpInetConnection
|
||||
public int getLocalPort() {
|
||||
OperatedClientConnection conn = getWrappedConnection();
|
||||
assertValid(conn);
|
||||
return conn.getLocalPort();
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpInetConnection
|
||||
public InetAddress getRemoteAddress() {
|
||||
OperatedClientConnection conn = getWrappedConnection();
|
||||
assertValid(conn);
|
||||
return conn.getRemoteAddress();
|
||||
}
|
||||
|
||||
// non-javadoc, see interface HttpInetConnection
|
||||
public int getRemotePort() {
|
||||
OperatedClientConnection conn = getWrappedConnection();
|
||||
assertValid(conn);
|
||||
return conn.getRemotePort();
|
||||
}
|
||||
|
||||
// non-javadoc, see interface ManagedClientConnection
|
||||
public boolean isSecure() {
|
||||
OperatedClientConnection conn = getWrappedConnection();
|
||||
assertValid(conn);
|
||||
return conn.isSecure();
|
||||
}
|
||||
|
||||
// non-javadoc, see interface ManagedClientConnection
|
||||
public SSLSession getSSLSession() {
|
||||
OperatedClientConnection conn = getWrappedConnection();
|
||||
assertValid(conn);
|
||||
@ -336,17 +299,14 @@ public SSLSession getSSLSession() {
|
||||
return result;
|
||||
}
|
||||
|
||||
// non-javadoc, see interface ManagedClientConnection
|
||||
public void markReusable() {
|
||||
markedReusable = true;
|
||||
}
|
||||
|
||||
// non-javadoc, see interface ManagedClientConnection
|
||||
public void unmarkReusable() {
|
||||
markedReusable = false;
|
||||
}
|
||||
|
||||
// non-javadoc, see interface ManagedClientConnection
|
||||
public boolean isMarkedReusable() {
|
||||
return markedReusable;
|
||||
}
|
||||
@ -359,14 +319,12 @@ public void setIdleDuration(long duration, TimeUnit unit) {
|
||||
}
|
||||
}
|
||||
|
||||
// non-javadoc, see interface ConnectionReleaseTrigger
|
||||
public void releaseConnection() {
|
||||
if (connManager != null) {
|
||||
connManager.releaseConnection(this, duration, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
// non-javadoc, see interface ConnectionReleaseTrigger
|
||||
public void abortConnection() {
|
||||
if (aborted) {
|
||||
return;
|
||||
@ -395,4 +353,4 @@ public void abortConnection() {
|
||||
}
|
||||
}
|
||||
|
||||
} // class AbstractClientConnAdapter
|
||||
}
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
package org.apache.http.impl.conn;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.http.HttpHost;
|
||||
@ -41,8 +40,6 @@
|
||||
import org.apache.http.conn.ClientConnectionOperator;
|
||||
import org.apache.http.conn.OperatedClientConnection;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A pool entry for use by connection manager implementations.
|
||||
* Pool entries work in conjunction with an
|
||||
@ -52,16 +49,11 @@
|
||||
* {@link HttpRoute route} established.
|
||||
* The adapter delegates methods for establishing the route to
|
||||
* its pool entry.
|
||||
* <br/>
|
||||
* <p>
|
||||
* If the managed connections is released or revoked, the adapter
|
||||
* gets disconnected, but the pool entry still contains the
|
||||
* underlying connection and the established route.
|
||||
*
|
||||
*
|
||||
*
|
||||
* <!-- empty lines to avoid svn diff problems -->
|
||||
* @version $Revision$
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public abstract class AbstractPoolEntry {
|
||||
@ -176,8 +168,7 @@ public void open(HttpRoute route,
|
||||
localTracker.connectProxy(proxy, this.connection.isSecure());
|
||||
}
|
||||
|
||||
} // open
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tracks tunnelling of the connection to the target.
|
||||
@ -209,9 +200,7 @@ public void tunnelTarget(boolean secure, HttpParams params)
|
||||
this.connection.update(null, tracker.getTargetHost(),
|
||||
secure, params);
|
||||
this.tracker.tunnelTarget(secure);
|
||||
|
||||
} // tunnelTarget
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tracks tunnelling of the connection to a chained proxy.
|
||||
@ -245,13 +234,9 @@ public void tunnelProxy(HttpHost next, boolean secure, HttpParams params)
|
||||
throw new IllegalStateException("Connection not open.");
|
||||
}
|
||||
|
||||
// LOG.debug?
|
||||
|
||||
this.connection.update(null, next, secure, params);
|
||||
this.tracker.tunnelProxy(next, secure);
|
||||
|
||||
} // tunnelProxy
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Layers a protocol on top of an established tunnel.
|
||||
@ -296,8 +281,7 @@ public void layerProtocol(HttpContext context, HttpParams params)
|
||||
|
||||
this.tracker.layerProtocol(this.connection.isSecure());
|
||||
|
||||
} // layerProtocol
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuts down the entry.
|
||||
@ -310,6 +294,5 @@ protected void shutdownEntry() {
|
||||
state = null;
|
||||
}
|
||||
|
||||
|
||||
} // class AbstractPoolEntry
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
package org.apache.http.impl.conn;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.http.HttpHost;
|
||||
@ -40,8 +39,6 @@
|
||||
import org.apache.http.conn.ClientConnectionManager;
|
||||
import org.apache.http.conn.OperatedClientConnection;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Abstract adapter from pool {@link AbstractPoolEntry entries} to
|
||||
* {@link org.apache.http.conn.ManagedClientConnection managed}
|
||||
@ -52,11 +49,6 @@
|
||||
* will clear the tracked route in the pool entry and call the
|
||||
* respective method of the wrapped connection.
|
||||
*
|
||||
*
|
||||
*
|
||||
* <!-- empty lines to avoid svn diff problems -->
|
||||
* @version $Revision$ $Date$
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public abstract class AbstractPooledConnAdapter extends AbstractClientConnAdapter {
|
||||
@ -64,7 +56,6 @@ public abstract class AbstractPooledConnAdapter extends AbstractClientConnAdapte
|
||||
/** The wrapped pool entry. */
|
||||
protected volatile AbstractPoolEntry poolEntry;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new connection adapter.
|
||||
*
|
||||
@ -77,7 +68,6 @@ protected AbstractPooledConnAdapter(ClientConnectionManager manager,
|
||||
this.poolEntry = entry;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Asserts that this adapter is still attached.
|
||||
*
|
||||
@ -100,8 +90,6 @@ protected void detach() {
|
||||
poolEntry = null;
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface ManagedHttpConnection
|
||||
public HttpRoute getRoute() {
|
||||
|
||||
assertAttached();
|
||||
@ -109,7 +97,6 @@ public HttpRoute getRoute() {
|
||||
null : poolEntry.tracker.toRoute();
|
||||
}
|
||||
|
||||
// non-javadoc, see interface ManagedHttpConnection
|
||||
public void open(HttpRoute route,
|
||||
HttpContext context, HttpParams params)
|
||||
throws IOException {
|
||||
@ -118,8 +105,6 @@ public void open(HttpRoute route,
|
||||
poolEntry.open(route, context, params);
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface ManagedHttpConnection
|
||||
public void tunnelTarget(boolean secure, HttpParams params)
|
||||
throws IOException {
|
||||
|
||||
@ -127,8 +112,6 @@ public void tunnelTarget(boolean secure, HttpParams params)
|
||||
poolEntry.tunnelTarget(secure, params);
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface ManagedHttpConnection
|
||||
public void tunnelProxy(HttpHost next, boolean secure, HttpParams params)
|
||||
throws IOException {
|
||||
|
||||
@ -136,8 +119,6 @@ public void tunnelProxy(HttpHost next, boolean secure, HttpParams params)
|
||||
poolEntry.tunnelProxy(next, secure, params);
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface ManagedHttpConnection
|
||||
public void layerProtocol(HttpContext context, HttpParams params)
|
||||
throws IOException {
|
||||
|
||||
@ -145,9 +126,6 @@ public void layerProtocol(HttpContext context, HttpParams params)
|
||||
poolEntry.layerProtocol(context, params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// non-javadoc, see interface HttpConnection
|
||||
public void close() throws IOException {
|
||||
if (poolEntry != null)
|
||||
poolEntry.shutdownEntry();
|
||||
@ -158,7 +136,6 @@ public void close() throws IOException {
|
||||
}
|
||||
}
|
||||
|
||||
// non-javadoc, see interface HttpConnection
|
||||
public void shutdown() throws IOException {
|
||||
if (poolEntry != null)
|
||||
poolEntry.shutdownEntry();
|
||||
@ -169,19 +146,14 @@ public void shutdown() throws IOException {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface ManagedClientConnection
|
||||
public Object getState() {
|
||||
assertAttached();
|
||||
return poolEntry.getState();
|
||||
}
|
||||
|
||||
|
||||
// non-javadoc, see interface ManagedClientConnection
|
||||
public void setState(final Object state) {
|
||||
assertAttached();
|
||||
poolEntry.setState(state);
|
||||
}
|
||||
|
||||
|
||||
} // class AbstractPooledConnAdapter
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
/*
|
||||
* $HeadURL:$
|
||||
* $Revision:$
|
||||
* $Date:$
|
||||
*
|
||||
* ====================================================================
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
-->
|
||||
</head>
|
||||
<body>
|
||||
Default implementations for interfaces in
|
||||
{@link org.apache.http.impl.conn org.apache.http.impl.conn} and related classes.
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user