View Javadoc

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   *
40   * <!-- empty lines to avoid svn diff problems -->
41   * @since 4.0
42   */
43  public interface HttpUriRequest extends HttpRequest {
44  
45      /**
46       * Returns the HTTP method this request uses, such as <code>GET</code>,
47       * <code>PUT</code>, <code>POST</code>, or other.
48       */
49      String getMethod();
50  
51      /**
52       * Returns the URI this request uses, such as
53       * <code>http://example.org/path/to/file</code>.
54       * <br/>
55       * Note that the URI may be absolute URI (as above) or may be a relative URI.
56       * <p>
57       * Implementations are encouraged to return
58       * the URI that was initially requested.
59       * </p>
60       * <p>
61       * To find the final URI after any redirects have been processed,
62       * please see the section entitled
63       * <a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d4e205">HTTP execution context</a>
64       * in the
65       * <a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html">HttpClient Tutorial</a>
66       * </p>
67       */
68      URI getURI();
69  
70      /**
71       * Aborts execution of the request.
72       *
73       * @throws UnsupportedOperationException if the abort operation
74       *   is not supported / cannot be implemented.
75       */
76      void abort() throws UnsupportedOperationException;
77  
78      /**
79       * Tests if the request execution has been aborted.
80       *
81       * @return <code>true</code> if the request execution has been aborted,
82       *   <code>false</code> otherwise.
83       */
84      boolean isAborted();
85  
86  }