13713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick/*
23713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick * Copyright (C) 2011 The Android Open Source Project
33713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick *
43713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick * Licensed under the Apache License, Version 2.0 (the "License");
53713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick * you may not use this file except in compliance with the License.
63713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick * You may obtain a copy of the License at
73713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick *
83713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick *      http://www.apache.org/licenses/LICENSE-2.0
93713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick *
103713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick * Unless required by applicable law or agreed to in writing, software
113713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick * distributed under the License is distributed on an "AS IS" BASIS,
123713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick * See the License for the specific language governing permissions and
143713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick * limitations under the License.
153713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick */
163713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick
173713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrickpackage com.android.volley.toolbox;
183713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick
193713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrickimport com.android.volley.AuthFailureError;
203713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrickimport com.android.volley.Request;
213713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick
223713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrickimport org.apache.http.HttpResponse;
233713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick
243713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrickimport java.io.IOException;
253713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrickimport java.util.Map;
263713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick
273713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick/**
283713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick * An HTTP stack abstraction.
293713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick */
303713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrickpublic interface HttpStack {
313713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick    /**
323713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick     * Performs an HTTP request with the given parameters.
333713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick     *
343713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick     * <p>A GET request is sent if request.getPostBody() == null. A POST request is sent otherwise,
353713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick     * and the Content-Type header is set to request.getPostBodyContentType().</p>
363713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick     *
373713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick     * @param request the request to perform
383713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick     * @param additionalHeaders additional headers to be sent together with
393713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick     *         {@link Request#getHeaders()}
403713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick     * @return the HTTP response
413713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick     */
423713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick    public HttpResponse performRequest(Request<?> request, Map<String, String> additionalHeaders)
433713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick        throws IOException, AuthFailureError;
443713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick
453713094c56d25e25df2a508dbee4aea869ffdea1Ficus Kirkpatrick}
46