org.apache.commons.feedparser.network
Class ResourceRequestFactory

java.lang.Object
  extended by org.apache.commons.feedparser.network.ResourceRequestFactory

public class ResourceRequestFactory
extends Object

Get a ResourceRequest for a given URL. The request is handled based on the URL.

Version:
$Id: ResourceRequestFactory.java 373622 2006-01-30 22:53:00Z mvdb $
Author:
Kevin A. Burton

Field Summary
static int DEFAULT_CONNECT_TIMEOUT
          These properties specify the default connect and read timeout (resp.) for the protocol handler used by java.net.URLConnection.
static int DEFAULT_MAX_REDIRECTS
          Specify the maximum number of redirects to use.
static int DEFAULT_READ_TIMEOUT
           
static int NETWORKADDRESS_CACHE_TTL
          Specified in java.security to indicate the caching policy for successful name lookups from the name service..
 
Constructor Summary
ResourceRequestFactory()
           
 
Method Summary
static void addEventListener(NetworkEventListener listener)
          Add an event listener to this instance of the factory.
static Iterator getNetworkEventListeners()
          Get all event listeners.
static ResourceRequest getResourceRequest(String resource)
           
static ResourceRequest getResourceRequest(String resource, long ifModifiedSince)
           
static ResourceRequest getResourceRequest(String resource, long ifModifiedSince, String etag)
          Get a ResourceRequest for the protocol represented in the resource URL.
static ResourceRequest getResourceRequest(URL resource)
           
static boolean isOffline()
           
static boolean isSupportedScheme(String scheme)
          Return true if we support fetching content with the given scheme.
static boolean isTransparentHTCacheEnabled()
          Return true if we can enable the htcache.
static void setOffline(boolean offline)
          Enable/disable offline operation.
static void setTransparentHTCacheEnabled(boolean enabled)
          When the transparent HTCache is enabled we will keep content local similar to the Mozilla cache and return the cached copy and use if-Modified-Since when necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NETWORKADDRESS_CACHE_TTL

public static int NETWORKADDRESS_CACHE_TTL
Specified in java.security to indicate the caching policy for successful name lookups from the name service.. The value is specified as as integer to indicate the number of seconds to cache the successful lookup. sun.net.inetaddr.ttl: This is a sun private system property which corresponds to networkaddress.cache.ttl. It takes the same value and has the same meaning, but can be set as a command-line option. However, the preferred way is to use the security property mentioned above. A value of -1 indicates "cache forever".


DEFAULT_CONNECT_TIMEOUT

public static int DEFAULT_CONNECT_TIMEOUT
These properties specify the default connect and read timeout (resp.) for the protocol handler used by java.net.URLConnection. sun.net.client.defaultConnectTimeout specifies the timeout (in milliseconds) to establish the connection to the host. For example for http connections it is the timeout when establishing the connection to the http server. For ftp connection it is the timeout when establishing the connection to ftp servers. sun.net.client.defaultReadTimeout specifies the timeout (in milliseconds) when reading from input stream when a connection is established to a resource.


DEFAULT_READ_TIMEOUT

public static int DEFAULT_READ_TIMEOUT

DEFAULT_MAX_REDIRECTS

public static int DEFAULT_MAX_REDIRECTS
Specify the maximum number of redirects to use.

Constructor Detail

ResourceRequestFactory

public ResourceRequestFactory()
Method Detail

getResourceRequest

public static ResourceRequest getResourceRequest(String resource,
                                                 long ifModifiedSince)
                                          throws NetworkException
Throws:
NetworkException

getResourceRequest

public static ResourceRequest getResourceRequest(String resource,
                                                 long ifModifiedSince,
                                                 String etag)
                                          throws NetworkException
Get a ResourceRequest for the protocol represented in the resource URL. It is important that we use a ResourceRequest implementation that supports fetching the URL.

Throws:
NetworkException

getResourceRequest

public static ResourceRequest getResourceRequest(String resource)
                                          throws NetworkException
Throws:
NetworkException
See Also:
getResourceRequest( String )

getResourceRequest

public static ResourceRequest getResourceRequest(URL resource)
                                          throws NetworkException
Throws:
NetworkException
See Also:
getResourceRequest( String )

addEventListener

public static void addEventListener(NetworkEventListener listener)
Add an event listener to this instance of the factory. This provides a mechanism to give default listeners to each new ResourceRequest.


getNetworkEventListeners

public static Iterator getNetworkEventListeners()
Get all event listeners.


isSupportedScheme

public static boolean isSupportedScheme(String scheme)
Return true if we support fetching content with the given scheme. Examples would be "http" and "file"


setTransparentHTCacheEnabled

public static void setTransparentHTCacheEnabled(boolean enabled)
When the transparent HTCache is enabled we will keep content local similar to the Mozilla cache and return the cached copy and use if-Modified-Since when necessary.


isTransparentHTCacheEnabled

public static boolean isTransparentHTCacheEnabled()
Return true if we can enable the htcache.


setOffline

public static void setOffline(boolean offline)
Enable/disable offline operation.


isOffline

public static boolean isOffline()


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.