## 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

Field Summary

Fields inherited from class net.dontdrinkandroot.lastfm.api.ws.fetcher.AbstractFetcher
`baseUrl, factory, logger`

Constructor Summary
`DefaultFetcher()`

Method Summary
`protected LastfmResponse` `fetchResponse(java.net.HttpURLConnection conn)`
`LastfmResponse` `get(java.util.Map<java.lang.String,java.lang.String> parameters)` Perform a get request to the Last.fm API.
`double` `getWebRequestsPerSecond()` Get the current number of requests per second.
`LastfmResponse` `post(java.util.Map<java.lang.String,java.lang.String> parameters)` Perform a post request to the Last.fm API.

Methods inherited from class net.dontdrinkandroot.lastfm.api.ws.fetcher.AbstractFetcher
`buildParameterString, buildUrl, openConnection, parseDoc`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultFetcher

    public DefaultFetcher()
                   throws javax.xml.parsers.ParserConfigurationException

Throws:
  `javax.xml.parsers.ParserConfigurationException`

Method Detail

### 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.