diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-21 05:34:45 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-21 05:34:45 +0000 |
commit | 660188fb80a325b5ad000cac6359d99a4d2f9dd4 (patch) | |
tree | 9950399519c9c30882e61f110996a62f1ce8421d /libjava | |
parent | 8ca9f7b5d6b6ca055bc932c093821aaabd264a80 (diff) | |
download | gcc-660188fb80a325b5ad000cac6359d99a4d2f9dd4.tar.gz |
2003-08-21 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java: updated JDK 1.4
* java/net/ContentHandler.java: updated JDK 1.4
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56481 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/java/net/Authenticator.java | 28 | ||||
-rw-r--r-- | libjava/java/net/ContentHandler.java | 32 |
3 files changed, 65 insertions, 0 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index a7ff4e8a823..3f1d5699457 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2003-08-21 Michael Koch <konqueror@gmx.de> + + * java/net/Authenticator.java: updated JDK 1.4 + * java/net/ContentHandler.java: updated JDK 1.4 + 2002-08-20 Michael Koch <konqueror@gmx.de> * java/net/URISyntaxException.java: New file. diff --git a/libjava/java/net/Authenticator.java b/libjava/java/net/Authenticator.java index 8dbf0f7c18c..f6ad9dd27b0 100644 --- a/libjava/java/net/Authenticator.java +++ b/libjava/java/net/Authenticator.java @@ -53,6 +53,7 @@ package java.net; * @since 1.2 * * @author Aaron M. Renn (arenn@urbanophile.com) + * @status Believed to be JDK 1.4 complete */ public abstract class Authenticator { @@ -75,6 +76,11 @@ private static Authenticator default_authenticator; */ /** + * The hostname of the site requesting authentication + */ +private String host; + +/** * InternetAddress of the site requesting authentication */ private InetAddress addr; @@ -156,6 +162,19 @@ setDefault(Authenticator def_auth) public static PasswordAuthentication requestPasswordAuthentication(InetAddress addr, int port, String protocol, String prompt, String scheme) + throws SecurityException +{ + return(requestPasswordAuthentication (null, addr, port, protocol, + prompt, scheme)); +} + +/** + * @since 1.4 + */ +public static PasswordAuthentication +requestPasswordAuthentication(String host, InetAddress addr, int port, + String protocol, String prompt, String scheme) + throws SecurityException { SecurityManager sm = System.getSecurityManager(); if (sm != null) @@ -164,6 +183,7 @@ requestPasswordAuthentication(InetAddress addr, int port, String protocol, if (default_authenticator == null) return(null); + default_authenticator.host = host; default_authenticator.addr = addr; default_authenticator.port = port; default_authenticator.protocol = protocol; @@ -173,6 +193,14 @@ requestPasswordAuthentication(InetAddress addr, int port, String protocol, return(default_authenticator.getPasswordAuthentication()); } +/** + * @since 1.4 + */ +protected final String getRequestingHost() +{ + return(host); +} + /*************************************************************************/ /* diff --git a/libjava/java/net/ContentHandler.java b/libjava/java/net/ContentHandler.java index 9b88d6b95fb..ce8d7ee8bdd 100644 --- a/libjava/java/net/ContentHandler.java +++ b/libjava/java/net/ContentHandler.java @@ -88,4 +88,36 @@ public ContentHandler() { } */ public abstract Object getContent(URLConnection urlc) throws IOException; +/*************************************************************************/ + +/** + * This method reads from the <code>InputStream</code> of the passed in URL + * connection and uses the data downloaded to create an <code>Object</code> + * represening the content. For example, if the URL is pointing to a GIF + * file, this method might return an <code>Image</code> object. This method + * must be implemented by subclasses. If the object doesnt match any type in + * classes it returns null. + * + * @param urlc A <code>URLConnection</code> object to read data from. + * + * @return An object representing the data read + * + * @exception IOException If an error occurs + * + * @since 1.3 + */ +public Object getContent(URLConnection urlc, Class[] classes) + throws IOException +{ + Object obj = getContent (urlc); + + for (int i = 0; i < classes.length; i++) + { + if (classes [i].isInstance (obj)) + return obj; + } + + return null; +} + } // class ContentHandler |