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</code>,
45 * <code>PUT</code>, <code>POST</code>, 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</code>.
52 * <br/>
53 * Note that the URI may be absolute URI (as above) or may be a relative URI.
54 * <p>
55 * Implementations are encouraged to return
56 * the URI that was initially requested.
57 * </p>
58 * <p>
59 * To find the final URI after any redirects have been processed,
60 * please see the section entitled
61 * <a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d4e205">HTTP execution context</a>
62 * in the
63 * <a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html">HttpClient Tutorial</a>
64 * </p>
65 */
66 URI getURI();
67
68 /**
69 * Aborts execution of the request.
70 *
71 * @throws UnsupportedOperationException if the abort operation
72 * is not supported / cannot be implemented.
73 */
74 void abort() throws UnsupportedOperationException;
75
76 /**
77 * Tests if the request execution has been aborted.
78 *
79 * @return <code>true</code> if the request execution has been aborted,
80 * <code>false</code> otherwise.
81 */
82 boolean isAborted();
83
84 }