001package ca.uhn.fhir.rest.client.api;
002
003/*
004 * #%L
005 * HAPI FHIR - Core Library
006 * %%
007 * Copyright (C) 2014 - 2017 University Health Network
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023import java.io.IOException;
024import java.util.List;
025import java.util.Map;
026
027/**
028 * Http Request. Allows addition of headers and execution of the request.
029 */
030public interface IHttpRequest {
031        
032        /**
033         * Add a header to the request
034         * @param theName the header name
035         * @param theValue the header value
036         */
037        public void addHeader(String theName, String theValue);    
038
039        /**
040         * Execute the request
041         * @return the response
042         * @throws IOException
043         */
044        public IHttpResponse execute() throws IOException;
045
046        /**
047         * @return all request headers in lower case
048         */
049        public Map<String, List<String>> getAllHeaders();
050
051        /**
052         * Return the requestbody as a string.
053         * If this is not supported by the underlying technology, null is returned 
054         * @return a string representation of the request or null if not supported or empty.
055         * @throws IOException 
056         */
057        public String getRequestBodyFromStream() throws IOException;
058
059        /**
060         * Return the request URI, or null
061         */
062        public String getUri();
063        
064        /**
065         * Return the HTTP verb (e.g. "GET")
066         */
067        public String getHttpVerbName();
068        
069}