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.hc.core5.http;
29  
30  import java.net.URI;
31  import java.net.URISyntaxException;
32  
33  import org.apache.hc.core5.net.URIAuthority;
34  
35  /**
36   * A request message from a client to a server includes, within the
37   * first line of that message, the method to be applied to the resource,
38   * the identifier of the resource, and the protocol version in use.
39   *
40   * @since 4.0
41   */
42  public interface HttpRequest extends HttpMessage {
43  
44      /**
45       * Returns method of this request message.
46       *
47       * @return  the request method.
48       */
49      String getMethod();
50  
51      /**
52       * Returns URI path of this request message or {@code null} if not set.
53       *
54       * @return  the request URI or {@code null}.
55       */
56      String getPath();
57  
58      /**
59       * Sets URI path of this request message.
60       *
61       * @param path The URI path of this request message.
62       * @since 5.0
63       */
64      void setPath(String path);
65  
66      /**
67       * Returns scheme of this request message.
68       *
69       * @return  the scheme or {@code null}.
70       * @since 5.0
71       */
72      String getScheme();
73  
74      /**
75       * Sets scheme of this request message.
76       *
77       * @param scheme The scheme of this request message.
78       * @since 5.0
79       */
80      void setScheme(String scheme);
81  
82      /**
83       * Returns authority of this request message.
84       *
85       * @return  the authority or {@code null}.
86       * @since 5.0
87       */
88      URIAuthority getAuthority();
89  
90      /**
91       * Sets authority of this request message.
92       *
93       * @param authority The authority of this request message.
94       * @since 5.0
95       */
96      void setAuthority(URIAuthority authority);
97  
98      /**
99       * Returns request URI of this request message. It may be an absolute or relative URI.
100      * Applicable to HTTP/1.1 version or earlier.
101      *
102      * @return  the request URI.
103      * @since 5.0
104      */
105     String getRequestUri();
106 
107     /**
108      * Returns full request URI of this request message.
109      *
110      * @return  the request URI.
111      * @throws URISyntaxException Thrown when a string could not be parsed as a URI reference.
112      * @since 5.0
113      */
114     URI getUri() throws URISyntaxException;
115 
116     /**
117      * Sets the full request URI of this request message.
118      *
119      * @param requestUri the request URI.
120      * @since 5.0
121      */
122     void setUri(final URI requestUri);
123 
124 }