diff options
author | Bryce McKinlay <mckinlay@redhat.com> | 2004-07-23 01:21:40 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2004-07-23 02:21:40 +0100 |
commit | f1f90ae0dee37c133fb46ed973c1eddfcea023fa (patch) | |
tree | d02b2df079e500b6c08b6fc1f2a09b28c804beca /libjava/java | |
parent | ef453534c4765aeca6b44c6b496f5a02458ebb1d (diff) | |
download | gcc-f1f90ae0dee37c133fb46ed973c1eddfcea023fa.zip gcc-f1f90ae0dee37c133fb46ed973c1eddfcea023fa.tar.gz gcc-f1f90ae0dee37c133fb46ed973c1eddfcea023fa.tar.bz2 |
Makefile.am (ordinary_java_source_files): Add DefaultContentHandlerFactory.java.
2004-07-22 Bryce McKinlay <mckinlay@redhat.com>
* Makefile.am (ordinary_java_source_files): Add
DefaultContentHandlerFactory.java.
* Makefile.in: Rebuilt.
* java/net/URLConnection.java (defaultFactory): New field.
(getContent):
(getContentHandler): Renamed from 'setContentHandler'. Try
defaultFactory after user-set factory, if any. Search for content
handler implementations in gnu.java.net.content, not
gnu.gcj.content.
* gnu/java/net/protocol/file/Connection.java (getHeaderField):
Implemented.
(getLastModified): Implemented.
(getPermission): Create file permission here, instead of in
constructor.
* gnu/java/net/protocol/gcjlib/Connection.java (getHeaderField):
Implemented.
* gnu/java/net/protocol/jar/Connection.java (getHeaderField):
Implemented.
(getLastModified): Implemented.
* gnu/java/awt/ClasspathToolkit.java (createImageProducer): New.
Default implementation.
* gnu/java/awt/peer/gtk/GtkToolkit.java (createImageProducer): New.
Implement using GdkPixbufDecoder.
From-SVN: r85069
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/net/URLConnection.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libjava/java/net/URLConnection.java b/libjava/java/net/URLConnection.java index 7b5f6a5..4bf52b8 100644 --- a/libjava/java/net/URLConnection.java +++ b/libjava/java/net/URLConnection.java @@ -116,6 +116,9 @@ public abstract class URLConnection */ private static boolean defaultUseCaches = true; + private static ContentHandlerFactory defaultFactory + = new gnu.java.net.DefaultContentHandlerFactory(); + /** * This variable determines whether or not interaction is allowed with * the user. For example, to prompt for a username and password. @@ -436,7 +439,7 @@ public abstract class URLConnection // guessContentTypeFromName() and guessContentTypeFromStream methods // as well as FileNameMap class & fileNameMap field & get/set methods. String type = getContentType(); - ContentHandler ch = setContentHandler(type); + ContentHandler ch = getContentHandler(type); if (ch == null) return getInputStream(); @@ -963,7 +966,7 @@ public abstract class URLConnection fileNameMap = map; } - private ContentHandler setContentHandler(String contentType) + private ContentHandler getContentHandler(String contentType) { ContentHandler handler; @@ -981,12 +984,17 @@ public abstract class URLConnection else return null; - // If a non-default factory has been set, use it to find the content type. + // If a non-default factory has been set, use it. if (factory != null) handler = factory.createContentHandler(contentType); - // Non-default factory may have returned null or a factory wasn't set. - // Use the default search algorithm to find a handler for this content type. + // Now try default factory. Using this factory to instantiate built-in + // content handlers is preferable + if (handler == null) + handler = defaultFactory.createContentHandler(contentType); + + // User-set factory has not returned a handler. Use the default search + // algorithm. if (handler == null) { // Get the list of packages to check and append our default handler @@ -995,7 +1003,7 @@ public abstract class URLConnection // ever be needed (or available). String propVal = System.getProperty("java.content.handler.pkgs"); propVal = (propVal == null) ? "" : (propVal + "|"); - propVal = propVal + "gnu.gcj.content|sun.net.www.content"; + propVal = propVal + "gnu.java.net.content|sun.net.www.content"; // Replace the '/' character in the content type with '.' and // all other non-alphabetic, non-numeric characters with '_'. |