ResponseHandler.java revision d42abb2fd917184764daf22f5f299e848b8701d7
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/*
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/ResponseHandler.java $
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * $Revision: 677240 $
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * $Date: 2008-07-16 04:25:47 -0700 (Wed, 16 Jul 2008) $
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * ====================================================================
7ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch *
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  Licensed to the Apache Software Foundation (ASF) under one or more
95e3f23d412006dc4db4e659864679f29341e113fTorne (Richard Coles) *  contributor license agreements.  See the NOTICE file distributed with
105e3f23d412006dc4db4e659864679f29341e113fTorne (Richard Coles) *  this work for additional information regarding copyright ownership.
11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) *  The ASF licenses this file to You under the Apache License, Version 2.0
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  (the "License"); you may not use this file except in compliance with
13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) *  the License.  You may obtain a copy of the License at
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *      http://www.apache.org/licenses/LICENSE-2.0
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  Unless required by applicable law or agreed to in writing, software
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  distributed under the License is distributed on an "AS IS" BASIS,
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
207dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch *  See the License for the specific language governing permissions and
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  limitations under the License.
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * ====================================================================
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) *
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This software consists of voluntary contributions made by many
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * individuals on behalf of the Apache Software Foundation.  For more
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * information on the Apache Software Foundation, please see
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * <http://www.apache.org/>.
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)package org.apache.http.client;
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)import java.io.IOException;
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)import org.apache.http.HttpResponse;
36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/**
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Handler that encapsulates the process of generating a response object
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * from a {@link HttpResponse}.
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @since 4.0
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @deprecated Please use {@link java.net.URL#openConnection} instead.
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *     Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a>
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *     for further details.
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@Deprecated
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)public interface ResponseHandler<T> {
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /**
532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)     * Processes an {@link HttpResponse} and returns some value
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)     * corresponding to that response.
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)     *
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)     * @param response The response to process
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)     * @return A value determined by the response
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)     *
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)     * @throws ClientProtocolException in case of an http protocol error
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)     * @throws IOException in case of a problem or the connection was aborted
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)     */
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    T handleResponse(HttpResponse response) throws ClientProtocolException, IOException;
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)