All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.jetty.client.HttpClientTransport Maven / Gradle / Ivy

There is a newer version: 11.0.0.beta1
Show newest version
//
//  ========================================================================
//  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
//  ------------------------------------------------------------------------
//  All rights reserved. This program and the accompanying materials
//  are made available under the terms of the Eclipse Public License v1.0
//  and Apache License v2.0 which accompanies this distribution.
//
//      The Eclipse Public License is available at
//      http://www.eclipse.org/legal/epl-v10.html
//
//      The Apache License v2.0 is available at
//      http://www.opensource.org/licenses/apache2.0.php
//
//  You may elect to redistribute this code under either of these licenses.
//  ========================================================================
//

package org.eclipse.jetty.client;

import java.net.SocketAddress;
import java.util.Map;

import org.eclipse.jetty.io.ClientConnectionFactory;

/**
 * {@link HttpClientTransport} represents what transport implementations should provide
 * in order to plug-in a different transport for {@link HttpClient}.
 * 

* While the {@link HttpClient} APIs define the HTTP semantic (request, response, headers, etc.) * how a HTTP exchange is carried over the network depends on implementations of this class. *

* The default implementation uses the HTTP protocol to carry over the network the HTTP exchange, * but the HTTP exchange may also be carried using the SPDY protocol or the FCGI protocol or, in future, * other protocols. */ public interface HttpClientTransport extends ClientConnectionFactory { public static final String HTTP_DESTINATION_CONTEXT_KEY = "http.destination"; public static final String HTTP_CONNECTION_PROMISE_CONTEXT_KEY = "http.connection.promise"; /** * Sets the {@link HttpClient} instance on this transport. *

* This is needed because of a chicken-egg problem: in order to create the {@link HttpClient} * a {@link HttpClientTransport} is needed, that therefore cannot have a reference yet to the * {@link HttpClient}. * * @param client the {@link HttpClient} that uses this transport. */ public void setHttpClient(HttpClient client); /** * Creates a new, transport-specific, {@link HttpDestination} object. *

* {@link HttpDestination} controls the destination-connection cardinality: protocols like * HTTP have 1-N cardinality, while multiplexed protocols like SPDY have a 1-1 cardinality. * * @param origin the destination origin * @return a new, transport-specific, {@link HttpDestination} object */ public HttpDestination newHttpDestination(Origin origin); /** * Establishes a physical connection to the given {@code address}. * * @param address the address to connect to * @param context the context information to establish the connection */ public void connect(SocketAddress address, Map context); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy