001/*
002 * ====================================================================
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *   http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied.  See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 * ====================================================================
020 *
021 * This software consists of voluntary contributions made by many
022 * individuals on behalf of the Apache Software Foundation.  For more
023 * information on the Apache Software Foundation, please see
024 * <http://www.apache.org/>.
025 *
026 */
027
028package org.apache.http.client.methods;
029
030import org.apache.http.conn.ClientConnectionRequest;
031import org.apache.http.conn.ConnectionReleaseTrigger;
032
033import java.io.IOException;
034
035
036/**
037 * Interface representing an HTTP request that can be aborted by shutting
038 * down the underlying HTTP connection.
039 *
040 * @since 4.0
041 *
042 * @deprecated (4.3) use {@link HttpExecutionAware}
043 */
044@Deprecated
045public interface AbortableHttpRequest {
046
047    /**
048     * Sets the {@link org.apache.http.conn.ClientConnectionRequest}
049     * callback that can be used to abort a long-lived request for a connection.
050     * If the request is already aborted, throws an {@link IOException}.
051     *
052     * @see org.apache.http.conn.ClientConnectionManager
053     */
054    void setConnectionRequest(ClientConnectionRequest connRequest) throws IOException;
055
056    /**
057     * Sets the {@link ConnectionReleaseTrigger} callback that can
058     * be used to abort an active connection.
059     * Typically, this will be the
060     *   {@link org.apache.http.conn.ManagedClientConnection} itself.
061     * If the request is already aborted, throws an {@link IOException}.
062     */
063    void setReleaseTrigger(ConnectionReleaseTrigger releaseTrigger) throws IOException;
064
065    /**
066     * Aborts this http request. Any active execution of this method should
067     * return immediately. If the request has not started, it will abort after
068     * the next execution. Aborting this request will cause all subsequent
069     * executions with this request to fail.
070     *
071     * @see org.apache.http.client.HttpClient#execute(HttpUriRequest)
072     * @see org.apache.http.client.HttpClient#execute(org.apache.http.HttpHost,
073     *      org.apache.http.HttpRequest)
074     * @see org.apache.http.client.HttpClient#execute(HttpUriRequest,
075     *      org.apache.http.protocol.HttpContext)
076     * @see org.apache.http.client.HttpClient#execute(org.apache.http.HttpHost,
077     *      org.apache.http.HttpRequest, org.apache.http.protocol.HttpContext)
078     */
079    void abort();
080
081}
082