1 /*
2 * ====================================================================
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 * ====================================================================
20 *
21 * This software consists of voluntary contributions made by many
22 * individuals on behalf of the Apache Software Foundation. For more
23 * information on the Apache Software Foundation, please see
24 * <http://www.apache.org/>.
25 *
26 */
27
28 package org.apache.http.client.methods;
29
30 import java.net.URI;
31
32 import org.apache.http.HttpRequest;
33
34 /**
35 * Extended version of the {@link HttpRequest} interface that provides
36 * convenience methods to access request properties such as request URI
37 * and method type.
38 *
39 * @since 4.0
40 */
41 public interface HttpUriRequest extends HttpRequest {
42
43 /**
44 * Returns the HTTP method this request uses, such as {@code GET},
45 * {@code PUT}, {@code POST}, or other.
46 */
47 String getMethod();
48
49 /**
50 * Returns the URI this request uses, such as
51 * {@code http://example.org/path/to/file}.
52 * <p>
53 * Note that the URI may be absolute URI (as above) or may be a relative URI.
54 * </p>
55 * <p>
56 * Implementations are encouraged to return
57 * the URI that was initially requested.
58 * </p>
59 * <p>
60 * To find the final URI after any redirects have been processed,
61 * please see the section entitled
62 * <a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d4e205">HTTP execution context</a>
63 * in the
64 * <a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html">HttpClient Tutorial</a>
65 * </p>
66 */
67 URI getURI();
68
69 /**
70 * Aborts execution of the request.
71 *
72 * @throws UnsupportedOperationException if the abort operation
73 * is not supported / cannot be implemented.
74 */
75 void abort() throws UnsupportedOperationException;
76
77 /**
78 * Tests if the request execution has been aborted.
79 *
80 * @return {@code true} if the request execution has been aborted,
81 * {@code false} otherwise.
82 */
83 boolean isAborted();
84
85 }