View Javadoc
1   package ca.uhn.fhir.rest.client.api;
2   
3   /*
4    * #%L
5    * HAPI FHIR - Core Library
6    * %%
7    * Copyright (C) 2014 - 2018 University Health Network
8    * %%
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   * 
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   * 
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   * #L%
21   */
22  
23  import java.io.IOException;
24  import java.util.List;
25  import java.util.Map;
26  
27  /**
28   * Http Request. Allows addition of headers and execution of the request.
29   */
30  public interface IHttpRequest {
31  	
32  	/**
33  	 * Add a header to the request
34  	 * @param theName the header name
35  	 * @param theValue the header value
36  	 */
37  	void addHeader(String theName, String theValue);
38  
39  	/**
40  	 * Execute the request
41  	 * @return the response
42  	 */
43  	IHttpResponse execute() throws IOException;
44  
45  	/**
46  	 * @return all request headers in lower case. Note that this method
47  	 * returns an <b>immutable</b> Map
48  	 */
49  	Map<String, List<String>> getAllHeaders();
50  
51  	/**
52  	 * Return the request body as a string.
53  	 * If this is not supported by the underlying technology, null is returned 
54  	 * @return a string representation of the request or null if not supported or empty.
55  	 */
56  	String getRequestBodyFromStream() throws IOException;
57  
58  	/**
59  	 * Return the request URI, or null
60  	 */
61  	String getUri();
62  	
63  	/**
64  	 * Return the HTTP verb (e.g. "GET")
65  	 */
66  	String getHttpVerbName();
67  	
68  }