diff options
author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-23 01:21:40 +0000 |
---|---|---|
committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-23 01:21:40 +0000 |
commit | 27813db22493a7f381f372428a86091b99cb54a8 (patch) | |
tree | d02b2df079e500b6c08b6fc1f2a09b28c804beca /libjava/java | |
parent | 266329b8efb72cad0d48a77285fb6db7560499e2 (diff) | |
download | ppe42-gcc-27813db22493a7f381f372428a86091b99cb54a8.tar.gz ppe42-gcc-27813db22493a7f381f372428a86091b99cb54a8.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85069 138bc75d-0d04-0410-961f-82ee72b054a4
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 7b5f6a5dd18..4bf52b860cd 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 '_'. |