2002-11-22 17:48:52 +01:00
|
|
|
/* URL.java -- Uniform Resource Locator Class
|
2005-02-22 22:11:29 +01:00
|
|
|
Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005
|
2004-09-23 02:34:09 +02:00
|
|
|
Free Software Foundation, Inc.
|
2002-11-22 17:48:52 +01:00
|
|
|
|
|
|
|
This file is part of GNU Classpath.
|
|
|
|
|
|
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
|
2002-11-22 17:48:52 +01:00
|
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
|
|
|
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA.
|
|
|
|
|
|
|
|
Linking this library statically or dynamically with other modules is
|
|
|
|
making a combined work based on this library. Thus, the terms and
|
|
|
|
conditions of the GNU General Public License cover the whole
|
|
|
|
combination.
|
|
|
|
|
|
|
|
As a special exception, the copyright holders of this library give you
|
|
|
|
permission to link this library with independent modules to produce an
|
|
|
|
executable, regardless of the license terms of these independent
|
|
|
|
modules, and to copy and distribute the resulting executable under
|
|
|
|
terms of your choice, provided that you also meet, for each linked
|
|
|
|
independent module, the terms and conditions of the license of that
|
|
|
|
module. An independent module is a module which is not derived from
|
|
|
|
or based on this library. If you modify this library, you may extend
|
|
|
|
this exception to your version of the library, but you are not
|
|
|
|
obligated to do so. If you do not wish to do so, delete this
|
|
|
|
exception statement from your version. */
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
package java.net;
|
|
|
|
|
2003-12-20 13:28:25 +01:00
|
|
|
import gnu.java.net.URLParseError;
|
BindException.java, [...]: Big import statement and @author tag cleanup.
2004-10-17 Michael Koch <konqueror@gmx.de>
* java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Big import statement and @author tag cleanup.
From-SVN: r89168
2004-10-17 10:29:57 +02:00
|
|
|
|
2002-11-22 17:48:52 +01:00
|
|
|
import java.io.IOException;
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
import java.io.InputStream;
|
2002-11-22 17:48:52 +01:00
|
|
|
import java.io.ObjectInputStream;
|
|
|
|
import java.io.ObjectOutputStream;
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
import java.io.Serializable;
|
BindException.java, [...]: Big import statement and @author tag cleanup.
2004-10-17 Michael Koch <konqueror@gmx.de>
* java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Big import statement and @author tag cleanup.
From-SVN: r89168
2004-10-17 10:29:57 +02:00
|
|
|
import java.security.AccessController;
|
|
|
|
import java.security.PrivilegedAction;
|
2003-10-02 14:14:44 +02:00
|
|
|
import java.util.HashMap;
|
1999-04-07 16:42:40 +02:00
|
|
|
import java.util.StringTokenizer;
|
|
|
|
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
|
2002-11-22 17:48:52 +01:00
|
|
|
/*
|
1999-04-07 16:42:40 +02:00
|
|
|
* Written using on-line Java Platform 1.2 API Specification, as well
|
|
|
|
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
|
|
|
|
* Status: Believed complete and correct.
|
|
|
|
*/
|
|
|
|
|
2002-11-22 17:48:52 +01:00
|
|
|
/**
|
|
|
|
* This final class represents an Internet Uniform Resource Locator (URL).
|
|
|
|
* For details on the syntax of URL's and what they can be used for,
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
* refer to RFC 1738, available from <a
|
2003-11-26 12:45:31 +01:00
|
|
|
* href="http://ds.internic.net/rfcs/rfc1738.txt">
|
|
|
|
* http://ds.internic.net/rfcs/rfc1738.txt</a>
|
2002-11-22 17:48:52 +01:00
|
|
|
* <p>
|
|
|
|
* There are a great many protocols supported by URL's such as "http",
|
|
|
|
* "ftp", and "file". This object can handle any arbitrary URL for which
|
|
|
|
* a URLStreamHandler object can be written. Default protocol handlers
|
|
|
|
* are provided for the "http" and "ftp" protocols. Additional protocols
|
|
|
|
* handler implementations may be provided in the future. In any case,
|
|
|
|
* an application or applet can install its own protocol handlers that
|
|
|
|
* can be "chained" with other protocol hanlders in the system to extend
|
|
|
|
* the base functionality provided with this class. (Note, however, that
|
|
|
|
* unsigned applets cannot access properties by default or install their
|
|
|
|
* own protocol handlers).
|
|
|
|
* <p>
|
|
|
|
* This chaining is done via the system property java.protocol.handler.pkgs
|
|
|
|
* If this property is set, it is assumed to be a "|" separated list of
|
|
|
|
* package names in which to attempt locating protocol handlers. The
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
* protocol handler is searched for by appending the string
|
2003-11-26 12:45:31 +01:00
|
|
|
* ".<protocol>.Handler" to each packed in the list until a hander is
|
|
|
|
* found. If a protocol handler is not found in this list of packages, or if
|
|
|
|
* the property does not exist, then the default protocol handler of
|
|
|
|
* "gnu.java.net.<protocol>.Handler" is tried. If this is
|
2002-11-22 17:48:52 +01:00
|
|
|
* unsuccessful, a MalformedURLException is thrown.
|
|
|
|
* <p>
|
|
|
|
* All of the constructor methods of URL attempt to load a protocol
|
|
|
|
* handler and so any needed protocol handlers must be installed when
|
|
|
|
* the URL is constructed.
|
|
|
|
* <p>
|
|
|
|
* Here is an example of how URL searches for protocol handlers. Assume
|
|
|
|
* the value of java.protocol.handler.pkgs is "com.foo|com.bar" and the
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
* URL is "news://comp.lang.java.programmer". URL would looking the
|
2002-11-22 17:48:52 +01:00
|
|
|
* following places for protocol handlers:
|
|
|
|
* <p><pre>
|
|
|
|
* com.foo.news.Handler
|
|
|
|
* com.bar.news.Handler
|
|
|
|
* gnu.java.net.news.Handler
|
|
|
|
* </pre><p>
|
|
|
|
* If the protocol handler is not found in any of those locations, a
|
|
|
|
* MalformedURLException would be thrown.
|
|
|
|
* <p>
|
|
|
|
* Please note that a protocol handler must be a subclass of
|
|
|
|
* URLStreamHandler.
|
2003-08-02 08:31:02 +02:00
|
|
|
* <p>
|
|
|
|
* Normally, this class caches protocol handlers. Once it finds a handler
|
|
|
|
* for a particular protocol, it never tries to look up a new handler
|
|
|
|
* again. However, if the system property
|
|
|
|
* gnu.java.net.nocache_protocol_handlers is set, then this
|
|
|
|
* caching behavior is disabled. This property is specific to this
|
|
|
|
* implementation. Sun's JDK may or may not do protocol caching, but it
|
|
|
|
* almost certainly does not examine this property.
|
2003-09-27 15:09:19 +02:00
|
|
|
* <p>
|
|
|
|
* Please also note that an application can install its own factory for
|
|
|
|
* loading protocol handlers (see setURLStreamHandlerFactory). If this is
|
|
|
|
* done, then the above information is superseded and the behavior of this
|
|
|
|
* class in loading protocol handlers is dependent on that factory.
|
2002-11-22 17:48:52 +01:00
|
|
|
*
|
BindException.java, [...]: Big import statement and @author tag cleanup.
2004-10-17 Michael Koch <konqueror@gmx.de>
* java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Big import statement and @author tag cleanup.
From-SVN: r89168
2004-10-17 10:29:57 +02:00
|
|
|
* @author Aaron M. Renn (arenn@urbanophile.com)
|
|
|
|
* @author Warren Levy (warrenl@cygnus.com)
|
2002-11-22 17:48:52 +01:00
|
|
|
*
|
|
|
|
* @see URLStreamHandler
|
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public final class URL implements Serializable
|
|
|
|
{
|
2003-10-02 14:14:44 +02:00
|
|
|
private static final String DEFAULT_SEARCH_PATH =
|
2005-04-27 22:10:07 +02:00
|
|
|
"gnu.java.net.protocol|gnu.inet";
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
|
2004-09-24 10:02:09 +02:00
|
|
|
// Cached System ClassLoader
|
|
|
|
private static ClassLoader systemClassLoader;
|
|
|
|
|
2002-11-22 17:48:52 +01:00
|
|
|
/**
|
|
|
|
* The name of the protocol for this URL.
|
|
|
|
* The protocol is always stored in lower case.
|
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
private String protocol;
|
2002-11-22 17:48:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The "authority" portion of the URL.
|
|
|
|
*/
|
2002-09-25 19:14:09 +02:00
|
|
|
private String authority;
|
2002-11-22 17:48:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The hostname or IP address of this protocol.
|
|
|
|
* This includes a possible user. For example <code>joe@some.host.net</code>.
|
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
private String host;
|
2002-11-22 17:48:52 +01:00
|
|
|
|
2004-04-23 09:21:46 +02:00
|
|
|
/**
|
|
|
|
* The user information necessary to establish the connection.
|
|
|
|
*/
|
|
|
|
private String userInfo;
|
|
|
|
|
2002-11-22 17:48:52 +01:00
|
|
|
/**
|
|
|
|
* The port number of this protocol or -1 if the port number used is
|
|
|
|
* the default for this protocol.
|
|
|
|
*/
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
private int port = -1; // Initialize for constructor using context.
|
2002-11-22 17:48:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The "file" portion of the URL. It is defined as <code>path[?query]</code>.
|
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
private String file;
|
2002-11-22 17:48:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The anchor portion of the URL.
|
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
private String ref;
|
2002-11-22 17:48:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the hashCode for this URL
|
|
|
|
*/
|
2004-04-23 09:21:46 +02:00
|
|
|
private int hashCode;
|
2002-11-22 17:48:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The protocol handler in use for this URL
|
|
|
|
*/
|
2003-06-24 22:22:48 +02:00
|
|
|
transient URLStreamHandler ph;
|
2002-11-22 17:48:52 +01:00
|
|
|
|
2003-08-02 08:31:02 +02:00
|
|
|
/**
|
|
|
|
* If an application installs its own protocol handler factory, this is
|
|
|
|
* where we keep track of it.
|
|
|
|
*/
|
|
|
|
private static URLStreamHandlerFactory factory;
|
|
|
|
private static final long serialVersionUID = -7627629688361524110L;
|
|
|
|
|
2002-11-22 17:48:52 +01:00
|
|
|
/**
|
|
|
|
* This a table where we cache protocol handlers to avoid the overhead
|
|
|
|
* of looking them up each time.
|
|
|
|
*/
|
2003-10-02 14:14:44 +02:00
|
|
|
private static HashMap ph_cache = new HashMap();
|
2002-11-22 17:48:52 +01:00
|
|
|
|
|
|
|
/**
|
2003-08-02 08:31:02 +02:00
|
|
|
* Whether or not to cache protocol handlers.
|
2002-11-22 17:48:52 +01:00
|
|
|
*/
|
2003-08-02 08:31:02 +02:00
|
|
|
private static boolean cache_handlers;
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2003-08-02 08:31:02 +02:00
|
|
|
static
|
|
|
|
{
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
String s = System.getProperty("gnu.java.net.nocache_protocol_handlers");
|
|
|
|
|
2003-08-02 08:31:02 +02:00
|
|
|
if (s == null)
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
cache_handlers = true;
|
2003-08-02 08:31:02 +02:00
|
|
|
else
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
cache_handlers = false;
|
2003-08-02 08:31:02 +02:00
|
|
|
}
|
2000-09-08 21:37:09 +02:00
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* Constructs a URL and loads a protocol handler for the values passed as
|
|
|
|
* arguments.
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-11-22 17:48:52 +01:00
|
|
|
* @param protocol The protocol for this URL ("http", "ftp", etc)
|
|
|
|
* @param host The hostname or IP address to connect to
|
|
|
|
* @param port The port number to use, or -1 to use the protocol's
|
|
|
|
* default port
|
|
|
|
* @param file The "file" portion of the URL.
|
2002-09-25 19:14:09 +02:00
|
|
|
*
|
2002-11-22 17:48:52 +01:00
|
|
|
* @exception MalformedURLException If a protocol handler cannot be loaded or
|
|
|
|
* a parse error occurs.
|
2002-09-25 19:14:09 +02:00
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public URL(String protocol, String host, int port, String file)
|
|
|
|
throws MalformedURLException
|
|
|
|
{
|
|
|
|
this(protocol, host, port, file, null);
|
|
|
|
}
|
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* Constructs a URL and loads a protocol handler for the values passed in
|
|
|
|
* as arugments. Uses the default port for the protocol.
|
2002-09-25 19:14:09 +02:00
|
|
|
*
|
2002-11-22 17:48:52 +01:00
|
|
|
* @param protocol The protocol for this URL ("http", "ftp", etc)
|
|
|
|
* @param host The hostname or IP address for this URL
|
|
|
|
* @param file The "file" portion of this URL.
|
2002-09-25 19:14:09 +02:00
|
|
|
*
|
2002-11-22 17:48:52 +01:00
|
|
|
* @exception MalformedURLException If a protocol handler cannot be loaded or
|
|
|
|
* a parse error occurs.
|
2002-09-25 19:14:09 +02:00
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public URL(String protocol, String host, String file)
|
|
|
|
throws MalformedURLException
|
|
|
|
{
|
|
|
|
this(protocol, host, -1, file, null);
|
|
|
|
}
|
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* This method initializes a new instance of <code>URL</code> with the
|
|
|
|
* specified protocol, host, port, and file. Additionally, this method
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
* allows the caller to specify a protocol handler to use instead of
|
2002-11-22 17:48:52 +01:00
|
|
|
* the default. If this handler is specified, the caller must have
|
|
|
|
* the "specifyStreamHandler" permission (see <code>NetPermission</code>)
|
|
|
|
* or a <code>SecurityException</code> will be thrown.
|
2002-09-25 19:14:09 +02:00
|
|
|
*
|
2002-11-22 17:48:52 +01:00
|
|
|
* @param protocol The protocol for this URL ("http", "ftp", etc)
|
|
|
|
* @param host The hostname or IP address to connect to
|
|
|
|
* @param port The port number to use, or -1 to use the protocol's default
|
|
|
|
* port
|
|
|
|
* @param file The "file" portion of the URL.
|
2003-07-20 09:30:59 +02:00
|
|
|
* @param ph The protocol handler to use with this URL.
|
2002-09-25 19:14:09 +02:00
|
|
|
*
|
2002-11-22 17:48:52 +01:00
|
|
|
* @exception MalformedURLException If no protocol handler can be loaded
|
|
|
|
* for the specified protocol.
|
|
|
|
* @exception SecurityException If the <code>SecurityManager</code> exists
|
|
|
|
* and does not allow the caller to specify its own protocol handler.
|
2002-09-25 19:14:09 +02:00
|
|
|
*
|
|
|
|
* @since 1.2
|
|
|
|
*/
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
public URL(String protocol, String host, int port, String file,
|
|
|
|
URLStreamHandler ph) throws MalformedURLException
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
if (protocol == null)
|
|
|
|
throw new MalformedURLException("null protocol");
|
2004-07-04 04:12:58 +02:00
|
|
|
protocol = protocol.toLowerCase();
|
|
|
|
this.protocol = protocol;
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2003-06-24 22:22:48 +02:00
|
|
|
if (ph != null)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
2002-11-22 17:48:52 +01:00
|
|
|
SecurityManager s = System.getSecurityManager();
|
2002-10-21 06:53:50 +02:00
|
|
|
if (s != null)
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
s.checkPermission(new NetPermission("specifyStreamHandler"));
|
1999-04-07 16:42:40 +02:00
|
|
|
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
this.ph = ph;
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
else
|
2003-06-24 22:22:48 +02:00
|
|
|
this.ph = getURLStreamHandler(protocol);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2003-06-24 22:22:48 +02:00
|
|
|
if (this.ph == null)
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
throw new MalformedURLException("Protocol handler not found: "
|
|
|
|
+ protocol);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
this.host = host;
|
|
|
|
this.port = port;
|
2004-04-23 09:21:46 +02:00
|
|
|
this.authority = (host != null) ? host : "";
|
2004-09-24 08:51:59 +02:00
|
|
|
if (port >= 0 && host != null)
|
2004-04-23 09:21:46 +02:00
|
|
|
this.authority += ":" + port;
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
int hashAt = file.indexOf('#');
|
|
|
|
if (hashAt < 0)
|
|
|
|
{
|
|
|
|
this.file = file;
|
|
|
|
this.ref = null;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.file = file.substring(0, hashAt);
|
|
|
|
this.ref = file.substring(hashAt + 1);
|
|
|
|
}
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
hashCode = hashCode(); // Used for serialization.
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* Initializes a URL from a complete string specification such as
|
|
|
|
* "http://www.urbanophile.com/arenn/". First the protocol name is parsed
|
|
|
|
* out of the string. Then a handler is located for that protocol and
|
|
|
|
* the parseURL() method of that protocol handler is used to parse the
|
|
|
|
* remaining fields.
|
2002-09-25 19:14:09 +02:00
|
|
|
*
|
2002-11-22 17:48:52 +01:00
|
|
|
* @param spec The complete String representation of a URL
|
|
|
|
*
|
|
|
|
* @exception MalformedURLException If a protocol handler cannot be found
|
|
|
|
* or the URL cannot be parsed
|
2002-09-25 19:14:09 +02:00
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public URL(String spec) throws MalformedURLException
|
|
|
|
{
|
2004-11-17 09:40:53 +01:00
|
|
|
this((URL) null, spec != null ? spec : "", (URLStreamHandler) null);
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2003-11-26 12:45:31 +01:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* This method parses a String representation of a URL within the
|
|
|
|
* context of an existing URL. Principally this means that any
|
|
|
|
* fields not present the URL are inheritied from the context URL.
|
|
|
|
* This allows relative URL's to be easily constructed. If the
|
|
|
|
* context argument is null, then a complete URL must be specified
|
|
|
|
* in the URL string. If the protocol parsed out of the URL is
|
|
|
|
* different from the context URL's protocol, then then URL String
|
|
|
|
* is also expected to be a complete URL.
|
|
|
|
*
|
2002-09-25 19:14:09 +02:00
|
|
|
* @param context The context on which to parse the specification
|
|
|
|
* @param spec The string to parse an URL
|
|
|
|
*
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
* @exception MalformedURLException If a protocol handler cannot be found
|
2002-11-22 17:48:52 +01:00
|
|
|
* for the URL cannot be parsed
|
2002-09-25 19:14:09 +02:00
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public URL(URL context, String spec) throws MalformedURLException
|
|
|
|
{
|
|
|
|
this(context, spec, (URLStreamHandler) null);
|
|
|
|
}
|
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
|
|
|
* Creates an URL from given arguments
|
2002-11-22 17:48:52 +01:00
|
|
|
* This method parses a String representation of a URL within the
|
|
|
|
* context of an existing URL. Principally this means that any fields
|
|
|
|
* not present the URL are inheritied from the context URL. This allows
|
|
|
|
* relative URL's to be easily constructed. If the context argument is
|
|
|
|
* null, then a complete URL must be specified in the URL string.
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
* If the protocol parsed out of the URL is different
|
2002-11-22 17:48:52 +01:00
|
|
|
* from the context URL's protocol, then then URL String is also
|
|
|
|
* expected to be a complete URL.
|
|
|
|
* <p>
|
|
|
|
* Additionally, this method allows the caller to specify a protocol handler
|
|
|
|
* to use instead of the default. If this handler is specified, the caller
|
|
|
|
* must have the "specifyStreamHandler" permission
|
|
|
|
* (see <code>NetPermission</code>) or a <code>SecurityException</code>
|
|
|
|
* will be thrown.
|
2002-09-25 19:14:09 +02:00
|
|
|
*
|
|
|
|
* @param context The context in which to parse the specification
|
|
|
|
* @param spec The string to parse as an URL
|
2003-07-20 09:30:59 +02:00
|
|
|
* @param ph The stream handler for the URL
|
2002-09-25 19:14:09 +02:00
|
|
|
*
|
2002-11-22 17:48:52 +01:00
|
|
|
* @exception MalformedURLException If a protocol handler cannot be found
|
|
|
|
* or the URL cannot be parsed
|
|
|
|
* @exception SecurityException If the <code>SecurityManager</code> exists
|
|
|
|
* and does not allow the caller to specify its own protocol handler.
|
|
|
|
*
|
2002-09-25 19:14:09 +02:00
|
|
|
* @since 1.2
|
|
|
|
*/
|
2003-06-24 22:22:48 +02:00
|
|
|
public URL(URL context, String spec, URLStreamHandler ph)
|
1999-04-07 16:42:40 +02:00
|
|
|
throws MalformedURLException
|
|
|
|
{
|
|
|
|
/* A protocol is defined by the doc as the substring before a ':'
|
|
|
|
* as long as the ':' occurs before any '/'.
|
|
|
|
*
|
|
|
|
* If context is null, then spec must be an absolute URL.
|
|
|
|
*
|
|
|
|
* The relative URL need not specify all the components of a URL.
|
|
|
|
* If the protocol, host name, or port number is missing, the value
|
|
|
|
* is inherited from the context. A bare file component is appended
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
* to the context's file. The optional anchor is not inherited.
|
1999-04-07 16:42:40 +02:00
|
|
|
*/
|
|
|
|
|
1999-06-04 00:29:12 +02:00
|
|
|
// If this is an absolute URL, then ignore context completely.
|
|
|
|
// An absolute URL must have chars prior to "://" but cannot have a colon
|
|
|
|
// right after the "://". The second colon is for an optional port value
|
|
|
|
// and implies that the host from the context is used if available.
|
1999-04-07 16:42:40 +02:00
|
|
|
int colon;
|
2005-01-11 21:40:10 +01:00
|
|
|
int slash = spec.indexOf('/');
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
if ((colon = spec.indexOf("://", 1)) > 0
|
2005-01-11 21:40:10 +01:00
|
|
|
&& ((colon < slash || slash < 0))
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
&& ! spec.regionMatches(colon, "://:", 0, 4))
|
1999-06-04 00:29:12 +02:00
|
|
|
context = null;
|
|
|
|
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
if ((colon = spec.indexOf(':')) > 0
|
2005-01-11 21:40:10 +01:00
|
|
|
&& (colon < slash || slash < 0))
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
// Protocol specified in spec string.
|
2002-11-22 17:48:52 +01:00
|
|
|
protocol = spec.substring(0, colon).toLowerCase();
|
1999-06-04 00:29:12 +02:00
|
|
|
if (context != null && context.protocol.equals(protocol))
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
// The 1.2 doc specifically says these are copied to the new URL.
|
|
|
|
host = context.host;
|
|
|
|
port = context.port;
|
|
|
|
file = context.file;
|
2004-09-23 02:34:09 +02:00
|
|
|
userInfo = context.userInfo;
|
2003-12-31 11:55:40 +01:00
|
|
|
if (file == null || file.length() == 0)
|
|
|
|
file = "/";
|
2002-09-25 19:14:09 +02:00
|
|
|
authority = context.authority;
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (context != null)
|
|
|
|
{
|
|
|
|
// Protocol NOT specified in spec string.
|
|
|
|
// Use context fields (except ref) as a foundation for relative URLs.
|
|
|
|
colon = -1;
|
|
|
|
protocol = context.protocol;
|
|
|
|
host = context.host;
|
|
|
|
port = context.port;
|
|
|
|
file = context.file;
|
2004-09-23 02:34:09 +02:00
|
|
|
userInfo = context.userInfo;
|
2003-12-31 11:55:40 +01:00
|
|
|
if (file == null || file.length() == 0)
|
|
|
|
file = "/";
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
authority = context.authority;
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
else // Protocol NOT specified in spec. and no context available.
|
2005-04-26 09:49:16 +02:00
|
|
|
throw new MalformedURLException("Absolute URL required with null"
|
|
|
|
+ " context: " + spec);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2004-09-24 08:51:59 +02:00
|
|
|
protocol = protocol.trim();
|
|
|
|
|
2003-06-24 22:22:48 +02:00
|
|
|
if (ph != null)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
SecurityManager s = System.getSecurityManager();
|
2002-10-21 06:53:50 +02:00
|
|
|
if (s != null)
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
s.checkPermission(new NetPermission("specifyStreamHandler"));
|
1999-04-07 16:42:40 +02:00
|
|
|
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
this.ph = ph;
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
else
|
2003-06-24 22:22:48 +02:00
|
|
|
this.ph = getURLStreamHandler(protocol);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2003-06-24 22:22:48 +02:00
|
|
|
if (this.ph == null)
|
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
2002-08-30 20:16:00 +02:00
|
|
|
throw new MalformedURLException("Protocol handler not found: "
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
+ protocol);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
// JDK 1.2 doc for parseURL specifically states that any '#' ref
|
|
|
|
// is to be excluded by passing the 'limit' as the indexOf the '#'
|
|
|
|
// if one exists, otherwise pass the end of the string.
|
|
|
|
int hashAt = spec.indexOf('#', colon + 1);
|
2003-12-20 13:28:25 +01:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
this.ph.parseURL(this, spec, colon + 1,
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
hashAt < 0 ? spec.length() : hashAt);
|
2003-12-20 13:28:25 +01:00
|
|
|
}
|
|
|
|
catch (URLParseError e)
|
|
|
|
{
|
|
|
|
throw new MalformedURLException(e.getMessage());
|
|
|
|
}
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
if (hashAt >= 0)
|
|
|
|
ref = spec.substring(hashAt + 1);
|
2000-09-08 21:37:09 +02:00
|
|
|
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
hashCode = hashCode(); // Used for serialization.
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* Test another URL for equality with this one. This will be true only if
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
* the argument is non-null and all of the fields in the URL's match
|
2002-11-22 17:48:52 +01:00
|
|
|
* exactly (ie, protocol, host, port, file, and ref). Overrides
|
|
|
|
* Object.equals(), implemented by calling the equals method of the handler.
|
|
|
|
*
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
* @param obj The URL to compare with
|
2002-11-22 17:48:52 +01:00
|
|
|
*
|
|
|
|
* @return true if the URL is equal, false otherwise
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
*/
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
public boolean equals(Object obj)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
2003-10-29 11:53:19 +01:00
|
|
|
if (! (obj instanceof URL))
|
1999-04-07 16:42:40 +02:00
|
|
|
return false;
|
|
|
|
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
return ph.equals(this, (URL) obj);
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* Returns the contents of this URL as an object by first opening a
|
|
|
|
* connection, then calling the getContent() method against the connection
|
2002-09-25 19:14:09 +02:00
|
|
|
*
|
2002-11-22 17:48:52 +01:00
|
|
|
* @return A content object for this URL
|
|
|
|
* @exception IOException If opening the connection or getting the
|
|
|
|
* content fails.
|
2002-10-05 09:49:08 +02:00
|
|
|
*
|
2002-09-25 19:14:09 +02:00
|
|
|
* @since 1.3
|
|
|
|
*/
|
2004-04-23 09:21:46 +02:00
|
|
|
public Object getContent() throws IOException
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
return openConnection().getContent();
|
|
|
|
}
|
|
|
|
|
2002-10-05 09:49:08 +02:00
|
|
|
/**
|
|
|
|
* Gets the contents of this URL
|
|
|
|
*
|
2003-11-26 12:45:31 +01:00
|
|
|
* @param classes The allow classes for the content object.
|
|
|
|
*
|
|
|
|
* @return a context object for this URL.
|
|
|
|
*
|
2002-10-05 09:49:08 +02:00
|
|
|
* @exception IOException If an error occurs
|
|
|
|
*/
|
2004-04-23 09:21:46 +02:00
|
|
|
public Object getContent(Class[] classes) throws IOException
|
2002-10-05 09:49:08 +02:00
|
|
|
{
|
|
|
|
// FIXME: implement this
|
|
|
|
return getContent();
|
|
|
|
}
|
|
|
|
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* Returns the file portion of the URL.
|
|
|
|
* Defined as <code>path[?query]</code>.
|
|
|
|
* Returns the empty string if there is no file portion.
|
2003-11-26 12:45:31 +01:00
|
|
|
*
|
2004-07-04 04:12:58 +02:00
|
|
|
* @return The filename specified in this URL, or an empty string if empty.
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public String getFile()
|
|
|
|
{
|
2002-11-22 17:48:52 +01:00
|
|
|
return file == null ? "" : file;
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* Returns the path of the URL. This is the part of the file before any '?'
|
|
|
|
* character.
|
2002-09-25 19:14:09 +02:00
|
|
|
*
|
2004-07-04 04:12:58 +02:00
|
|
|
* @return The path specified in this URL, or null if empty.
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-09-25 19:14:09 +02:00
|
|
|
* @since 1.3
|
|
|
|
*/
|
2002-02-23 01:15:49 +01:00
|
|
|
public String getPath()
|
|
|
|
{
|
2004-09-24 09:35:40 +02:00
|
|
|
// The spec says we need to return an empty string, but some
|
|
|
|
// applications depends on receiving null when the path is empty.
|
2004-07-04 04:12:58 +02:00
|
|
|
if (file == null)
|
|
|
|
return null;
|
|
|
|
int quest = file.indexOf('?');
|
2003-03-03 09:26:52 +01:00
|
|
|
return quest < 0 ? getFile() : file.substring(0, quest);
|
2002-02-23 01:15:49 +01:00
|
|
|
}
|
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
|
|
|
* Returns the authority of the URL
|
2003-11-26 12:45:31 +01:00
|
|
|
*
|
|
|
|
* @return The authority specified in this URL.
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-09-25 19:14:09 +02:00
|
|
|
* @since 1.3
|
|
|
|
*/
|
|
|
|
public String getAuthority()
|
|
|
|
{
|
|
|
|
return authority;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the host of the URL
|
2003-11-26 12:45:31 +01:00
|
|
|
*
|
|
|
|
* @return The host specified in this URL.
|
2002-09-25 19:14:09 +02:00
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public String getHost()
|
|
|
|
{
|
2002-11-22 17:48:52 +01:00
|
|
|
int at = (host == null) ? -1 : host.indexOf('@');
|
|
|
|
return at < 0 ? host : host.substring(at + 1, host.length());
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* Returns the port number of this URL or -1 if the default port number is
|
|
|
|
* being used.
|
|
|
|
*
|
|
|
|
* @return The port number
|
|
|
|
*
|
|
|
|
* @see #getDefaultPort()
|
2002-09-25 19:14:09 +02:00
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public int getPort()
|
|
|
|
{
|
|
|
|
return port;
|
|
|
|
}
|
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* Returns the default port of the URL. If the StreamHandler for the URL
|
|
|
|
* protocol does not define a default port it returns -1.
|
2003-11-26 12:45:31 +01:00
|
|
|
*
|
|
|
|
* @return The default port of the current protocol.
|
2002-09-25 19:14:09 +02:00
|
|
|
*/
|
|
|
|
public int getDefaultPort()
|
|
|
|
{
|
2003-06-24 22:22:48 +02:00
|
|
|
return ph.getDefaultPort();
|
2002-09-25 19:14:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the protocol of the URL
|
2003-11-26 12:45:31 +01:00
|
|
|
*
|
|
|
|
* @return The specified protocol.
|
2002-09-25 19:14:09 +02:00
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public String getProtocol()
|
|
|
|
{
|
|
|
|
return protocol;
|
|
|
|
}
|
|
|
|
|
2002-11-22 17:48:52 +01:00
|
|
|
/**
|
|
|
|
* Returns the ref (sometimes called the "# reference" or "anchor") portion
|
|
|
|
* of the URL.
|
|
|
|
*
|
|
|
|
* @return The ref
|
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public String getRef()
|
|
|
|
{
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* Returns the user information of the URL. This is the part of the host
|
|
|
|
* name before the '@'.
|
|
|
|
*
|
|
|
|
* @return the user at a particular host or null when no user defined.
|
2002-09-25 19:14:09 +02:00
|
|
|
*/
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
public String getUserInfo()
|
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
2002-08-30 20:16:00 +02:00
|
|
|
{
|
2004-09-23 02:34:09 +02:00
|
|
|
if (userInfo != null)
|
|
|
|
return userInfo;
|
2003-03-03 09:26:52 +01:00
|
|
|
int at = (host == null) ? -1 : host.indexOf('@');
|
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
2002-08-30 20:16:00 +02:00
|
|
|
return at < 0 ? null : host.substring(0, at);
|
|
|
|
}
|
|
|
|
|
2002-10-05 09:49:08 +02:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* Returns the query of the URL. This is the part of the file before the
|
|
|
|
* '?'.
|
|
|
|
*
|
2003-03-10 15:48:09 +01:00
|
|
|
* @return the query part of the file, or null when there is no query part.
|
2002-10-05 09:49:08 +02:00
|
|
|
*/
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
public String getQuery()
|
2002-10-05 09:49:08 +02:00
|
|
|
{
|
2003-03-03 09:26:52 +01:00
|
|
|
int quest = (file == null) ? -1 : file.indexOf('?');
|
2002-11-22 17:48:52 +01:00
|
|
|
return quest < 0 ? null : file.substring(quest + 1, file.length());
|
2002-10-05 09:49:08 +02:00
|
|
|
}
|
|
|
|
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
/**
|
|
|
|
* Returns a hashcode computed by the URLStreamHandler of this URL
|
2003-11-26 12:45:31 +01:00
|
|
|
*
|
|
|
|
* @return The hashcode for this URL.
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public int hashCode()
|
|
|
|
{
|
2000-09-08 21:37:09 +02:00
|
|
|
if (hashCode != 0)
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
return hashCode; // Use cached value if available.
|
2000-09-08 21:37:09 +02:00
|
|
|
else
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
return ph.hashCode(this);
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-10-05 09:49:08 +02:00
|
|
|
/**
|
|
|
|
* Returns a URLConnection object that represents a connection to the remote
|
2002-11-22 17:48:52 +01:00
|
|
|
* object referred to by the URL. The URLConnection is created by calling the
|
|
|
|
* openConnection() method of the protocol handler
|
2002-10-05 09:49:08 +02:00
|
|
|
*
|
2002-11-22 17:48:52 +01:00
|
|
|
* @return A URLConnection for this URL
|
2003-11-26 12:45:31 +01:00
|
|
|
*
|
2002-10-05 09:49:08 +02:00
|
|
|
* @exception IOException If an error occurs
|
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public URLConnection openConnection() throws IOException
|
|
|
|
{
|
2003-06-24 22:22:48 +02:00
|
|
|
return ph.openConnection(this);
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-10-05 09:49:08 +02:00
|
|
|
/**
|
|
|
|
* Opens a connection to this URL and returns an InputStream for reading
|
|
|
|
* from that connection
|
|
|
|
*
|
2003-11-26 12:45:31 +01:00
|
|
|
* @return An <code>InputStream</code> for this URL.
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-10-05 09:49:08 +02:00
|
|
|
* @exception IOException If an error occurs
|
|
|
|
*/
|
2004-04-23 09:21:46 +02:00
|
|
|
public InputStream openStream() throws IOException
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
return openConnection().getInputStream();
|
|
|
|
}
|
|
|
|
|
2002-11-22 17:48:52 +01:00
|
|
|
/**
|
|
|
|
* Tests whether or not another URL refers to the same "file" as this one.
|
|
|
|
* This will be true if and only if the passed object is not null, is a
|
|
|
|
* URL, and matches all fields but the ref (ie, protocol, host, port,
|
|
|
|
* and file);
|
|
|
|
*
|
|
|
|
* @param url The URL object to test with
|
|
|
|
*
|
|
|
|
* @return true if URL matches this URL's file, false otherwise
|
|
|
|
*/
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
public boolean sameFile(URL url)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
return ph.sameFile(this, url);
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
|
|
|
* Sets the specified fields of the URL. This is not a public method so
|
2002-11-22 17:48:52 +01:00
|
|
|
* that only URLStreamHandlers can modify URL fields. This might be called
|
|
|
|
* by the <code>parseURL()</code> method in that class. URLs are otherwise
|
2004-09-24 09:35:40 +02:00
|
|
|
* constant. If the given protocol does not exist, it will keep the previously
|
|
|
|
* set protocol.
|
2002-11-22 17:48:52 +01:00
|
|
|
*
|
|
|
|
* @param protocol The protocol name for this URL
|
|
|
|
* @param host The hostname or IP address for this URL
|
|
|
|
* @param port The port number of this URL
|
|
|
|
* @param file The "file" portion of this URL.
|
|
|
|
* @param ref The anchor portion of this URL.
|
2002-09-25 19:14:09 +02:00
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
protected void set(String protocol, String host, int port, String file,
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
String ref)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
2004-09-24 09:35:40 +02:00
|
|
|
URLStreamHandler protocolHandler = null;
|
|
|
|
protocol = protocol.toLowerCase();
|
|
|
|
if (! this.protocol.equals(protocol))
|
|
|
|
protocolHandler = getURLStreamHandler(protocol);
|
|
|
|
|
|
|
|
// It is an hidden feature of the JDK. If the protocol does not exist,
|
|
|
|
// we keep the previously initialized protocol.
|
|
|
|
if (protocolHandler != null)
|
2004-07-04 04:12:58 +02:00
|
|
|
{
|
2004-09-24 09:35:40 +02:00
|
|
|
this.ph = protocolHandler;
|
2004-07-04 04:12:58 +02:00
|
|
|
this.protocol = protocol;
|
|
|
|
}
|
2004-04-23 09:21:46 +02:00
|
|
|
this.authority = "";
|
1999-04-07 16:42:40 +02:00
|
|
|
this.port = port;
|
|
|
|
this.host = host;
|
|
|
|
this.file = file;
|
|
|
|
this.ref = ref;
|
2004-04-23 09:21:46 +02:00
|
|
|
|
|
|
|
if (host != null)
|
|
|
|
this.authority += host;
|
|
|
|
if (port >= 0)
|
|
|
|
this.authority += ":" + port;
|
|
|
|
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
hashCode = hashCode(); // Used for serialization.
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-09-25 19:14:09 +02:00
|
|
|
/**
|
|
|
|
* Sets the specified fields of the URL. This is not a public method so
|
|
|
|
* that only URLStreamHandlers can modify URL fields. URLs are otherwise
|
2004-09-24 09:35:40 +02:00
|
|
|
* constant. If the given protocol does not exist, it will keep the previously
|
|
|
|
* set protocol.
|
2002-09-25 19:14:09 +02:00
|
|
|
*
|
2003-11-26 12:45:31 +01:00
|
|
|
* @param protocol The protocol name for this URL.
|
|
|
|
* @param host The hostname or IP address for this URL.
|
|
|
|
* @param port The port number of this URL.
|
|
|
|
* @param authority The authority of this URL.
|
|
|
|
* @param userInfo The user and password (if needed) of this URL.
|
|
|
|
* @param path The "path" portion of this URL.
|
|
|
|
* @param query The query of this URL.
|
|
|
|
* @param ref The anchor portion of this URL.
|
|
|
|
*
|
2002-09-25 19:14:09 +02:00
|
|
|
* @since 1.3
|
|
|
|
*/
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
protected void set(String protocol, String host, int port, String authority,
|
|
|
|
String userInfo, String path, String query, String ref)
|
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
2002-08-30 20:16:00 +02:00
|
|
|
{
|
2004-09-24 09:35:40 +02:00
|
|
|
URLStreamHandler protocolHandler = null;
|
|
|
|
protocol = protocol.toLowerCase();
|
|
|
|
if (! this.protocol.equals(protocol))
|
|
|
|
protocolHandler = getURLStreamHandler(protocol);
|
|
|
|
|
|
|
|
// It is an hidden feature of the JDK. If the protocol does not exist,
|
|
|
|
// we keep the previously initialized protocol.
|
|
|
|
if (protocolHandler != null)
|
2004-07-04 04:12:58 +02:00
|
|
|
{
|
2004-09-24 09:35:40 +02:00
|
|
|
this.ph = protocolHandler;
|
2004-07-04 04:12:58 +02:00
|
|
|
this.protocol = protocol;
|
|
|
|
}
|
2004-04-23 09:21:46 +02:00
|
|
|
this.host = host;
|
|
|
|
this.userInfo = userInfo;
|
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
2002-08-30 20:16:00 +02:00
|
|
|
this.port = port;
|
2004-04-23 09:21:46 +02:00
|
|
|
this.authority = authority;
|
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
2002-08-30 20:16:00 +02:00
|
|
|
if (query == null)
|
2004-05-03 22:23:28 +02:00
|
|
|
this.file = path;
|
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
2002-08-30 20:16:00 +02:00
|
|
|
else
|
2004-05-03 22:23:28 +02:00
|
|
|
this.file = path + "?" + query;
|
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
2002-08-30 20:16:00 +02:00
|
|
|
this.ref = ref;
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
hashCode = hashCode(); // Used for serialization.
|
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
2002-08-30 20:16:00 +02:00
|
|
|
}
|
|
|
|
|
2002-10-05 09:49:08 +02:00
|
|
|
/**
|
2002-11-22 17:48:52 +01:00
|
|
|
* Sets the URLStreamHandlerFactory for this class. This factory is
|
|
|
|
* responsible for returning the appropriate protocol handler for
|
|
|
|
* a given URL.
|
|
|
|
*
|
|
|
|
* @param fac The URLStreamHandlerFactory class to use
|
2002-10-05 09:49:08 +02:00
|
|
|
*
|
2002-11-22 17:48:52 +01:00
|
|
|
* @exception Error If the factory is alread set.
|
2002-10-05 09:49:08 +02:00
|
|
|
* @exception SecurityException If a security manager exists and its
|
|
|
|
* checkSetFactory method doesn't allow the operation
|
|
|
|
*/
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
public static synchronized void setURLStreamHandlerFactory(URLStreamHandlerFactory fac)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
if (factory != null)
|
|
|
|
throw new Error("URLStreamHandlerFactory already set");
|
|
|
|
|
|
|
|
// Throw an exception if an extant security mgr precludes
|
|
|
|
// setting the factory.
|
|
|
|
SecurityManager s = System.getSecurityManager();
|
|
|
|
if (s != null)
|
|
|
|
s.checkSetFactory();
|
|
|
|
factory = fac;
|
|
|
|
}
|
|
|
|
|
2002-11-22 17:48:52 +01:00
|
|
|
/**
|
|
|
|
* Returns a String representing this URL. The String returned is
|
|
|
|
* created by calling the protocol handler's toExternalForm() method.
|
|
|
|
*
|
|
|
|
* @return A string for this URL
|
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public String toExternalForm()
|
|
|
|
{
|
|
|
|
// Identical to toString().
|
2003-06-24 22:22:48 +02:00
|
|
|
return ph.toExternalForm(this);
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-11-22 17:48:52 +01:00
|
|
|
/**
|
|
|
|
* Returns a String representing this URL. Identical to toExternalForm().
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
* The value returned is created by the protocol handler's
|
2002-11-22 17:48:52 +01:00
|
|
|
* toExternalForm method. Overrides Object.toString()
|
|
|
|
*
|
|
|
|
* @return A string for this URL
|
|
|
|
*/
|
1999-04-07 16:42:40 +02:00
|
|
|
public String toString()
|
|
|
|
{
|
|
|
|
// Identical to toExternalForm().
|
2003-06-24 22:22:48 +02:00
|
|
|
return ph.toExternalForm(this);
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2003-07-20 09:30:59 +02:00
|
|
|
/**
|
|
|
|
* This internal method is used in two different constructors to load
|
|
|
|
* a protocol handler for this URL.
|
|
|
|
*
|
|
|
|
* @param protocol The protocol to load a handler for
|
|
|
|
*
|
|
|
|
* @return A URLStreamHandler for this protocol, or null when not found.
|
|
|
|
*/
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
private static synchronized URLStreamHandler getURLStreamHandler(String protocol)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
2003-09-27 15:09:19 +02:00
|
|
|
URLStreamHandler ph = null;
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2003-09-27 14:38:05 +02:00
|
|
|
// First, see if a protocol handler is in our cache.
|
|
|
|
if (cache_handlers)
|
|
|
|
{
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
if ((ph = (URLStreamHandler) ph_cache.get(protocol)) != null)
|
|
|
|
return ph;
|
2003-09-27 14:38:05 +02:00
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
// If a non-default factory has been set, use it to find the protocol.
|
|
|
|
if (factory != null)
|
2003-08-02 08:31:02 +02:00
|
|
|
{
|
2004-04-23 09:21:46 +02:00
|
|
|
ph = factory.createURLStreamHandler(protocol);
|
2003-08-02 08:31:02 +02:00
|
|
|
}
|
2004-04-23 09:21:46 +02:00
|
|
|
else if (protocol.equals("core"))
|
2001-09-07 00:32:54 +02:00
|
|
|
{
|
Connection.java, [...]: Moved to gnu/java/net/protocol.
2003-10-08 Michael Koch <konqueror@gmx.de>
* gnu/gcj/protocol/core/Connection.java,
gnu/gcj/protocol/core/CoreInputStream.java,
gnu/gcj/protocol/core/Handler.java,
gnu/gcj/protocol/core/natCoreInputStream.cc,
gnu/gcj/protocol/file/Connection.java,
gnu/gcj/protocol/file/Handler.java,
gnu/gcj/protocol/gcjlib/Connection.java,
gnu/gcj/protocol/gcjlib/Handler.java,
gnu/gcj/protocol/http/Connection.java,
gnu/gcj/protocol/http/Handler.java,
gnu/gcj/protocol/jar/Connection.java,
gnu/gcj/protocol/jar/Handler.java: Moved to gnu/java/net/protocol.
* gnu/java/net/protocol/core/Connection.java,
gnu/java/net/protocol/core/CoreInputStream.java,
gnu/java/net/protocol/core/Handler.java,
gnu/java/net/protocol/core/natCoreInputStream.cc,
gnu/java/net/protocol/file/Connection.java,
gnu/java/net/protocol/file/Handler.java,
gnu/java/net/protocol/gcjlib/Connection.java,
gnu/java/net/protocol/gcjlib/Handler.java,
gnu/java/net/protocol/http/Connection.java,
gnu/java/net/protocol/http/Handler.java,
gnu/java/net/protocol/jar/Connection.java,
gnu/java/net/protocol/jar/Handler.java: Moved from gnu/gcj/protocol.
* gnu/gcj/runtime/FirstThread.java,
java/net/URL.java: Use moved protocol handlers.
* Makefile.am
(ordinary_java_source_files): Moved files.
(nat_source_files): Likewise.
* Makefile.in: Regenerated.
From-SVN: r72233
2003-10-08 18:28:30 +02:00
|
|
|
ph = new gnu.java.net.protocol.core.Handler();
|
2001-09-07 00:32:54 +02:00
|
|
|
}
|
2004-04-23 09:21:46 +02:00
|
|
|
else if (protocol.equals("file"))
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
|
|
|
// This is an interesting case. It's tempting to think that we
|
Connection.java, [...]: Moved to gnu/java/net/protocol.
2003-10-08 Michael Koch <konqueror@gmx.de>
* gnu/gcj/protocol/core/Connection.java,
gnu/gcj/protocol/core/CoreInputStream.java,
gnu/gcj/protocol/core/Handler.java,
gnu/gcj/protocol/core/natCoreInputStream.cc,
gnu/gcj/protocol/file/Connection.java,
gnu/gcj/protocol/file/Handler.java,
gnu/gcj/protocol/gcjlib/Connection.java,
gnu/gcj/protocol/gcjlib/Handler.java,
gnu/gcj/protocol/http/Connection.java,
gnu/gcj/protocol/http/Handler.java,
gnu/gcj/protocol/jar/Connection.java,
gnu/gcj/protocol/jar/Handler.java: Moved to gnu/java/net/protocol.
* gnu/java/net/protocol/core/Connection.java,
gnu/java/net/protocol/core/CoreInputStream.java,
gnu/java/net/protocol/core/Handler.java,
gnu/java/net/protocol/core/natCoreInputStream.cc,
gnu/java/net/protocol/file/Connection.java,
gnu/java/net/protocol/file/Handler.java,
gnu/java/net/protocol/gcjlib/Connection.java,
gnu/java/net/protocol/gcjlib/Handler.java,
gnu/java/net/protocol/http/Connection.java,
gnu/java/net/protocol/http/Handler.java,
gnu/java/net/protocol/jar/Connection.java,
gnu/java/net/protocol/jar/Handler.java: Moved from gnu/gcj/protocol.
* gnu/gcj/runtime/FirstThread.java,
java/net/URL.java: Use moved protocol handlers.
* Makefile.am
(ordinary_java_source_files): Moved files.
(nat_source_files): Likewise.
* Makefile.in: Regenerated.
From-SVN: r72233
2003-10-08 18:28:30 +02:00
|
|
|
// could call Class.forName ("gnu.java.net.protocol.file.Handler") to
|
2000-05-19 19:55:34 +02:00
|
|
|
// get the appropriate class. Unfortunately, if we do that the
|
2002-11-22 17:48:52 +01:00
|
|
|
// program will never terminate, because getURLStreamHandler is
|
2000-05-19 19:55:34 +02:00
|
|
|
// eventually called by Class.forName.
|
|
|
|
//
|
|
|
|
// Treating "file" as a special case is the minimum that will
|
|
|
|
// fix this problem. If other protocols are required in a
|
|
|
|
// statically linked application they will need to be handled in
|
|
|
|
// the same way as "file".
|
Connection.java, [...]: Moved to gnu/java/net/protocol.
2003-10-08 Michael Koch <konqueror@gmx.de>
* gnu/gcj/protocol/core/Connection.java,
gnu/gcj/protocol/core/CoreInputStream.java,
gnu/gcj/protocol/core/Handler.java,
gnu/gcj/protocol/core/natCoreInputStream.cc,
gnu/gcj/protocol/file/Connection.java,
gnu/gcj/protocol/file/Handler.java,
gnu/gcj/protocol/gcjlib/Connection.java,
gnu/gcj/protocol/gcjlib/Handler.java,
gnu/gcj/protocol/http/Connection.java,
gnu/gcj/protocol/http/Handler.java,
gnu/gcj/protocol/jar/Connection.java,
gnu/gcj/protocol/jar/Handler.java: Moved to gnu/java/net/protocol.
* gnu/java/net/protocol/core/Connection.java,
gnu/java/net/protocol/core/CoreInputStream.java,
gnu/java/net/protocol/core/Handler.java,
gnu/java/net/protocol/core/natCoreInputStream.cc,
gnu/java/net/protocol/file/Connection.java,
gnu/java/net/protocol/file/Handler.java,
gnu/java/net/protocol/gcjlib/Connection.java,
gnu/java/net/protocol/gcjlib/Handler.java,
gnu/java/net/protocol/http/Connection.java,
gnu/java/net/protocol/http/Handler.java,
gnu/java/net/protocol/jar/Connection.java,
gnu/java/net/protocol/jar/Handler.java: Moved from gnu/gcj/protocol.
* gnu/gcj/runtime/FirstThread.java,
java/net/URL.java: Use moved protocol handlers.
* Makefile.am
(ordinary_java_source_files): Moved files.
(nat_source_files): Likewise.
* Makefile.in: Regenerated.
From-SVN: r72233
2003-10-08 18:28:30 +02:00
|
|
|
ph = new gnu.java.net.protocol.file.Handler();
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
// Non-default factory may have returned null or a factory wasn't set.
|
|
|
|
// Use the default search algorithm to find a handler for this protocol.
|
2003-06-24 22:22:48 +02:00
|
|
|
if (ph == null)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
// Get the list of packages to check and append our default handler
|
|
|
|
// to it, along with the JDK specified default as a last resort.
|
|
|
|
// Except in very unusual environments the JDK specified one shouldn't
|
|
|
|
// ever be needed (or available).
|
2003-11-26 12:45:31 +01:00
|
|
|
String ph_search_path =
|
|
|
|
System.getProperty("java.protocol.handler.pkgs");
|
2003-10-02 14:14:44 +02:00
|
|
|
|
|
|
|
// Tack our default package on at the ends.
|
|
|
|
if (ph_search_path != null)
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
ph_search_path += "|" + DEFAULT_SEARCH_PATH;
|
2003-10-02 14:14:44 +02:00
|
|
|
else
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
ph_search_path = DEFAULT_SEARCH_PATH;
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2003-09-27 14:38:05 +02:00
|
|
|
// Finally loop through our search path looking for a match.
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
StringTokenizer pkgPrefix = new StringTokenizer(ph_search_path, "|");
|
|
|
|
|
2004-09-24 10:02:09 +02:00
|
|
|
// Cache the systemClassLoader
|
|
|
|
if (systemClassLoader == null)
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
{
|
2004-09-24 10:02:09 +02:00
|
|
|
systemClassLoader = (ClassLoader) AccessController.doPrivileged
|
|
|
|
(new PrivilegedAction() {
|
2005-04-19 12:31:51 +02:00
|
|
|
public Object run()
|
|
|
|
{
|
2004-09-24 10:02:09 +02:00
|
|
|
return ClassLoader.getSystemClassLoader();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
|
2004-09-24 10:02:09 +02:00
|
|
|
do
|
|
|
|
{
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
try
|
|
|
|
{
|
2004-09-24 10:02:09 +02:00
|
|
|
// Try to get a class from the system/application
|
|
|
|
// classloader, initialize it, make an instance
|
|
|
|
// and try to cast it to a URLStreamHandler.
|
|
|
|
String clsName =
|
|
|
|
(pkgPrefix.nextToken() + "." + protocol + ".Handler");
|
|
|
|
Class c = Class.forName(clsName, true, systemClassLoader);
|
|
|
|
ph = (URLStreamHandler) c.newInstance();
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
}
|
2005-02-22 22:11:29 +01:00
|
|
|
catch (ThreadDeath death)
|
|
|
|
{
|
|
|
|
throw death;
|
|
|
|
}
|
2005-04-19 12:31:51 +02:00
|
|
|
catch (Throwable t)
|
|
|
|
{
|
|
|
|
// Ignored.
|
|
|
|
}
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
}
|
2004-09-24 10:02:09 +02:00
|
|
|
while (ph == null && pkgPrefix.hasMoreTokens());
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Update the hashtable with the new protocol handler.
|
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
2004-04-20 15:05:10 +02:00
|
|
|
if (ph != null && cache_handlers)
|
2004-09-24 10:02:09 +02:00
|
|
|
ph_cache.put(protocol, ph);
|
|
|
|
else
|
|
|
|
ph = null;
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2003-06-24 22:22:48 +02:00
|
|
|
return ph;
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
2000-09-08 21:37:09 +02:00
|
|
|
|
|
|
|
private void readObject(ObjectInputStream ois)
|
|
|
|
throws IOException, ClassNotFoundException
|
|
|
|
{
|
|
|
|
ois.defaultReadObject();
|
2003-06-24 22:22:48 +02:00
|
|
|
this.ph = getURLStreamHandler(protocol);
|
|
|
|
if (this.ph == null)
|
2000-09-08 21:37:09 +02:00
|
|
|
throw new IOException("Handler for protocol " + protocol + " not found");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void writeObject(ObjectOutputStream oos) throws IOException
|
|
|
|
{
|
|
|
|
oos.defaultWriteObject();
|
|
|
|
}
|
2005-04-20 07:34:29 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the equivalent <code>URI</code> object for this <code>URL</code>.
|
|
|
|
* This is the same as calling <code>new URI(this.toString())</code>.
|
|
|
|
* RFC2396-compliant URLs are guaranteed a successful conversion to
|
|
|
|
* a <code>URI</code> instance. However, there are some values which
|
|
|
|
* form valid URLs, but which do not also form RFC2396-compliant URIs.
|
|
|
|
*
|
|
|
|
* @throws URISyntaxException if this URL is not RFC2396-compliant,
|
|
|
|
* and thus can not be successfully converted to a URI.
|
|
|
|
*/
|
|
|
|
public URI toURI()
|
|
|
|
throws URISyntaxException
|
|
|
|
{
|
|
|
|
return new URI(toString());
|
|
|
|
}
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|