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  	public void addHeader(String theName, String theValue);    
38  
39  	/**
40  	 * Execute the request
41  	 * @return the response
42  	 * @throws IOException
43  	 */
44  	public IHttpResponse execute() throws IOException;
45  
46  	/**
47  	 * @return all request headers in lower case
48  	 */
49  	public Map<String, List<String>> getAllHeaders();
50  
51  	/**
52  	 * Return the requestbody 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  	 * @throws IOException 
56  	 */
57  	public String getRequestBodyFromStream() throws IOException;
58  
59  	/**
60  	 * Return the request URI, or null
61  	 */
62  	public String getUri();
63  	
64  	/**
65  	 * Return the HTTP verb (e.g. "GET")
66  	 */
67  	public String getHttpVerbName();
68  	
69  }