com.google.api.client.http
Interface HttpParser

All Known Implementing Classes:
AtomParser, JsonHttpParser, ProtoHttpParser, UrlEncodedParser, XmlHttpParser

public interface HttpParser

Parses HTTP response content into an data class of key/value pairs.

Implementations should normally be thread-safe.

Since:
1.0
Author:
Yaniv Inbar

Method Summary
 String getContentType()
          Returns the content type.
<T> T
parse(HttpResponse response, Class<T> dataClass)
          Parses the given HTTP response into a new instance of the the given data class of key/value pairs.
 

Method Detail

getContentType

String getContentType()
Returns the content type.


parse

<T> T parse(HttpResponse response,
            Class<T> dataClass)
        throws IOException
Parses the given HTTP response into a new instance of the the given data class of key/value pairs.

How the parsing is performed is not restricted by this interface, and is instead defined by the concrete implementation. Implementations should check HttpResponse.isSuccessStatusCode() to know whether they are parsing a success or error response.

Throws:
IOException


Copyright © 2011-2012 Google. All Rights Reserved.