org.japtproxy.fetcher
Class FetcherHttp

java.lang.Object
  extended by org.japtproxy.fetcher.FetcherHttp
All Implemented Interfaces:
Fetcher

public class FetcherHttp
extends java.lang.Object
implements Fetcher

The FetcherHttp is responsible for fetching files from http resources.

Version:
$LastChangedRevision:79 $
Author:
Oliver J. Siegmar

Constructor Summary
FetcherHttp()
           
 
Method Summary
protected  org.apache.commons.httpclient.Credentials buildCredentials(java.lang.String userInfo)
           
protected  org.apache.commons.httpclient.Credentials buildNTCredentials(java.lang.String userPart, java.lang.String password)
           
protected  void configureProxy(org.apache.commons.httpclient.HostConfiguration hostConfiguration, java.lang.String proxy)
           
 FetchedResourceHttp fetch(java.net.URL targetResource, long lastModified)
          Fetches an external resource.
 void init()
          Initialize the FetcherHttp fetcher.
 void setConfiguration(Configuration configuration)
           
 void setConnectionTimeout(int connectionTimeout)
           
 void setHttpClient(org.apache.commons.httpclient.HttpClient httpClient)
           
 void setSocketTimeout(int socketTimeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FetcherHttp

public FetcherHttp()
Method Detail

setConfiguration

public void setConfiguration(Configuration configuration)

setHttpClient

public void setHttpClient(org.apache.commons.httpclient.HttpClient httpClient)

setSocketTimeout

public void setSocketTimeout(int socketTimeout)

setConnectionTimeout

public void setConnectionTimeout(int connectionTimeout)

init

@PostConstruct
public void init()
          throws InitializationException
Initialize the FetcherHttp fetcher.

Parameters:
configuration - the configuration used to initialize.
Throws:
InitializationException - is thrown if the initialization goes wrong.

configureProxy

protected void configureProxy(org.apache.commons.httpclient.HostConfiguration hostConfiguration,
                              java.lang.String proxy)
                       throws InitializationException
Throws:
InitializationException

buildCredentials

protected org.apache.commons.httpclient.Credentials buildCredentials(java.lang.String userInfo)
                                                              throws InitializationException
Throws:
InitializationException

buildNTCredentials

protected org.apache.commons.httpclient.Credentials buildNTCredentials(java.lang.String userPart,
                                                                       java.lang.String password)
                                                                throws InitializationException
Throws:
InitializationException

fetch

public FetchedResourceHttp fetch(java.net.URL targetResource,
                                 long lastModified)
                          throws java.io.IOException,
                                 ResourceUnavailableException
Fetches an external resource.

Specified by:
fetch in interface Fetcher
Parameters:
targetResource - the resource to fetch.
lastModified - the lastModified timestamp of the local object.
Returns:
the fetched resource.
Throws:
java.io.IOException - is thrown if the fetch fails.
ResourceUnavailableException - is thrown if the resource was not found.


Copyright © 2006-2008. All Rights Reserved.