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 * @since 5.0 62 */ 63 void setPath(String path); 64 65 /** 66 * Returns scheme of this request message. 67 * 68 * @return the scheme or {@code null}. 69 * 70 * @since 5.0 71 */ 72 String getScheme(); 73 74 /** 75 * Sets scheme of this request message. 76 * 77 * @since 5.0 78 */ 79 void setScheme(String scheme); 80 81 /** 82 * Returns authority of this request message. 83 * 84 * @return the authority or {@code null}. 85 * 86 * @since 5.0 87 */ 88 URIAuthority getAuthority(); 89 90 /** 91 * Sets authority of this request message. 92 * 93 * @since 5.0 94 */ 95 void setAuthority(URIAuthority authority); 96 97 /** 98 * Returns request URI of this request message. It may be an absolute or relative URI. 99 * Applicable to HTTP/1.1 version or earlier. 100 * 101 * @return the request URI. 102 * 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 * 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 * 121 * @since 5.0 122 */ 123 void setUri(final URI requestUri); 124 125 }