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 java.net.URI;
031
032import org.apache.http.HttpRequest;
033
034/**
035 * Extended version of the {@link HttpRequest} interface that provides
036 * convenience methods to access request properties such as request URI
037 * and method type.
038 *
039 * @since 4.0
040 */
041public interface HttpUriRequest extends HttpRequest {
042
043    /**
044     * Returns the HTTP method this request uses, such as {@code GET},
045     * {@code PUT}, {@code POST}, or other.
046     */
047    String getMethod();
048
049    /**
050     * Returns the URI this request uses, such as
051     * {@code http://example.org/path/to/file}.
052     * <p>
053     * Note that the URI may be absolute URI (as above) or may be a relative URI.
054     * </p>
055     * <p>
056     * Implementations are encouraged to return
057     * the URI that was initially requested.
058     * </p>
059     * <p>
060     * To find the final URI after any redirects have been processed,
061     * please see the section entitled
062     * <a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d4e205">HTTP execution context</a>
063     * in the
064     * <a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html">HttpClient Tutorial</a>
065     * </p>
066     */
067    URI getURI();
068
069    /**
070     * Aborts execution of the request.
071     *
072     * @throws UnsupportedOperationException if the abort operation
073     *   is not supported / cannot be implemented.
074     */
075    void abort() throws UnsupportedOperationException;
076
077    /**
078     * Tests if the request execution has been aborted.
079     *
080     * @return {@code true} if the request execution has been aborted,
081     *   {@code false} otherwise.
082     */
083    boolean isAborted();
084
085}