net.dontdrinkandroot.lastfm.api.ws.fetcher
Class DefaultFetcher
java.lang.Object
net.dontdrinkandroot.lastfm.api.ws.fetcher.AbstractFetcher
net.dontdrinkandroot.lastfm.api.ws.fetcher.DefaultFetcher
- All Implemented Interfaces:
- Fetcher
public class DefaultFetcher
- extends AbstractFetcher
- implements Fetcher
This class is responsible for actually fetching the data from last.fm and converting it to a dom
Document.
- Author:
- Philip W. Sorst
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultFetcher
public DefaultFetcher()
throws javax.xml.parsers.ParserConfigurationException
- Throws:
javax.xml.parsers.ParserConfigurationException
get
public LastfmResponse get(java.util.Map<java.lang.String,java.lang.String> parameters)
throws LastfmWebServicesException
- Description copied from interface:
Fetcher
- Perform a get request to the Last.fm API.
- Specified by:
get in interface Fetcher
- Parameters:
parameters - A Key/Value map of HTTP parameters.
- Returns:
- The response returned from Last.fm.
- Throws:
LastfmWebServicesException - Thrown on any fetching errors encountered.
post
public LastfmResponse post(java.util.Map<java.lang.String,java.lang.String> parameters)
throws LastfmWebServicesException
- Description copied from interface:
Fetcher
- Perform a post request to the Last.fm API.
- Specified by:
post in interface Fetcher
- Parameters:
parameters - A Key/Value map of HTTP parameters.
- Returns:
- The response returned from Last.fm.
- Throws:
LastfmWebServicesException - Thrown on any fetching errors encountered.
getWebRequestsPerSecond
public final double getWebRequestsPerSecond()
- Description copied from interface:
Fetcher
- Get the current number of requests per second. The returned value depends on the
implementation and can mean the requests/sec over a specific interval or overall.
- Specified by:
getWebRequestsPerSecond in interface Fetcher
- Returns:
- The number of requests that this fetcher performed per second.
fetchResponse
protected LastfmResponse fetchResponse(java.net.HttpURLConnection conn)
throws LastfmWebServicesException
- Throws:
LastfmWebServicesException
Copyright © 2013 dontdrinkandroot. All Rights Reserved.