Search in sources :

Example 56 with HttpEntity

use of org.apache.http.HttpEntity in project musicbrainz-android by jdamcd.

the class MusicBrainzWebClient method lookupCollection.

@Override
public UserCollection lookupCollection(String mbid) throws IOException {
    HttpEntity entity = get(QueryBuilder.collectionLookup(mbid));
    UserCollection collection = responseParser.parseCollectionLookup(entity.getContent());
    entity.consumeContent();
    return collection;
}
Also used : HttpEntity(org.apache.http.HttpEntity) UserCollection(org.musicbrainz.android.api.data.UserCollection)

Example 57 with HttpEntity

use of org.apache.http.HttpEntity in project musicbrainz-android by jdamcd.

the class MusicBrainzWebClient method lookupUserData.

@Override
public UserData lookupUserData(Entity entityType, String mbid) throws IOException {
    HttpEntity entity = get(QueryBuilder.userData(entityType, mbid));
    UserData userData = responseParser.parseUserData(entity.getContent());
    entity.consumeContent();
    return userData;
}
Also used : HttpEntity(org.apache.http.HttpEntity) UserData(org.musicbrainz.android.api.data.UserData)

Example 58 with HttpEntity

use of org.apache.http.HttpEntity in project musicbrainz-android by jdamcd.

the class MusicBrainzWebClient method lookupRating.

@Override
public float lookupRating(Entity type, String mbid) throws IOException {
    HttpEntity entity = get(QueryBuilder.ratingLookup(type, mbid));
    float rating = responseParser.parseRatingLookup(entity.getContent());
    entity.consumeContent();
    return rating;
}
Also used : HttpEntity(org.apache.http.HttpEntity)

Example 59 with HttpEntity

use of org.apache.http.HttpEntity in project musicbrainz-android by jdamcd.

the class MusicBrainzWebClient method searchLabel.

@Override
public LinkedList<LabelSearchResult> searchLabel(String searchTerm) throws IOException {
    HttpEntity entity = get(QueryBuilder.labelSearch(searchTerm));
    LinkedList<LabelSearchResult> labels = responseParser.parseLabelSearch(entity.getContent());
    entity.consumeContent();
    return labels;
}
Also used : LabelSearchResult(org.musicbrainz.android.api.data.LabelSearchResult) HttpEntity(org.apache.http.HttpEntity)

Example 60 with HttpEntity

use of org.apache.http.HttpEntity in project musicbrainz-android by jdamcd.

the class MusicBrainzWebClient method lookupArtist.

@Override
public Artist lookupArtist(String mbid) throws IOException {
    HttpEntity entity = get(QueryBuilder.artistLookup(mbid));
    Artist artist = responseParser.parseArtist(entity.getContent());
    entity.consumeContent();
    artist.setReleaseGroups(browseArtistReleaseGroups(mbid));
    return artist;
}
Also used : Artist(org.musicbrainz.android.api.data.Artist) HttpEntity(org.apache.http.HttpEntity)

Aggregations

HttpEntity (org.apache.http.HttpEntity)518 HttpResponse (org.apache.http.HttpResponse)185 HttpGet (org.apache.http.client.methods.HttpGet)152 IOException (java.io.IOException)144 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)105 Test (org.junit.Test)93 HttpPost (org.apache.http.client.methods.HttpPost)84 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)83 InputStream (java.io.InputStream)71 ArrayList (java.util.ArrayList)69 Header (org.apache.http.Header)64 StatusLine (org.apache.http.StatusLine)61 URI (java.net.URI)58 NameValuePair (org.apache.http.NameValuePair)58 DefaultHttpClient (org.apache.http.impl.client.DefaultHttpClient)58 BasicNameValuePair (org.apache.http.message.BasicNameValuePair)58 HttpClient (org.apache.http.client.HttpClient)55 StringEntity (org.apache.http.entity.StringEntity)51 InputStreamReader (java.io.InputStreamReader)44 BufferedReader (java.io.BufferedReader)41