Package org.faceless.publisher.resource
Interface URLConnectionFactory
- All Known Implementing Classes:
AboutURLConnectionFactory
,ClasspathConnectionFactory
,DataURLConnectionFactory
,FileURLConnectionFactory
,FontDirURLConnectionFactory
,Http1URLConnectionFactory
,LocalFontURLConnectionFactory
,MemoryURLConnectionFactory
,PKCS11ConnectionFactory
,ZipURLConnectionFactory
public interface URLConnectionFactory
The URLConnectionFactory interface defines a method of requesting and loading
content from a particular type of URL. It's analagous to
URLStreamHandler
but not as awful. Subclasses exist for most standard URL schemes, and custom
schemes could theoretically be added by end-users if required.-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close
(URL2 uri, URL2Connection con) Close the specified URLConnection and free any resources allocated by this factory.default long
getExpiry
(URL2 uri, URL2Connection con) Return the absolute expiry time of the resource reeturned by the specified URLConnection, or Long.MAX_VALUE for forever.getURLConnection
(URL2 uri, ReportFactory reportFactory) Return a URLConnection for the specified URI, or null if not possible with this factory.default List<URLConnectionProcessor>
Return the list ofURLConnectionProcessor
objects that will be run on any network connections that are made by thisURLConnectionFactory
.default boolean
Return true if the supplied URL (which will be loadable by this Factory) should be considered trusted.default boolean
isUnchanged
(URL2 uri, URL2Connection con) Return true if a previous resource loaded by this factory should be considered valid, based on the supplied response for a subsequent request for the same resource.default void
setURLConnectionProcessors
(List<URLConnectionProcessor> processors) Set the list ofURLConnectionProcessor
objects that will be run on any network connections that are made by thisURLConnectionFactory
boolean
Return true if this factory can load the specified URI schema (eg http, ftp, jar, jdbc)
-
Method Details
-
setURLConnectionProcessors
Set the list ofURLConnectionProcessor
objects that will be run on any network connections that are made by thisURLConnectionFactory
- Parameters:
processors
- the list of processors - the default implementation ignores this.
-
getURLConnectionProcessors
Return the list ofURLConnectionProcessor
objects that will be run on any network connections that are made by thisURLConnectionFactory
. The default implementation always returns an empty list.- Returns:
- processors the list of processors
-
getURLConnection
Return a URLConnection for the specified URI, or null if not possible with this factory.- Parameters:
uri
- the URIreportFactory
- the ReportFactory that owns this connection- Throws:
IOException
-
supports
Return true if this factory can load the specified URI schema (eg http, ftp, jar, jdbc)- Parameters:
uri
- the URI
-
isUnchanged
Return true if a previous resource loaded by this factory should be considered valid, based on the supplied response for a subsequent request for the same resource. As an example this method should return true if a web server returned a 304 (Not Modified). There is a default implementation which returns true.- Parameters:
uri
- the URIcon
- the URL connection- Throws:
IOException
-
close
Close the specified URLConnection and free any resources allocated by this factory. There is a default implementation which does nothing.- Parameters:
uri
- the URIcon
- the URL connection- Throws:
IOException
-
getExpiry
Return the absolute expiry time of the resource reeturned by the specified URLConnection, or Long.MAX_VALUE for forever. If this is not specified by the headers, the factory may still return a non-zero value to prevent content being cached forever. There is a default implementation which returns Long.MAX_VALUE;- Parameters:
uri
- the URIcon
- the URL connection- Throws:
IOException
-
isTrusted
Return true if the supplied URL (which will be loadable by this Factory) should be considered trusted. The default implementation returns false.- Since:
- 1.3
- See Also:
-