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
This commit is contained in:
parent
55f49e3d50
commit
4c322bff29
11 changed files with 392 additions and 15 deletions
|
@ -175,7 +175,8 @@ public final class URL implements Serializable
|
|||
this.handler = setURLStreamHandler(protocol);
|
||||
|
||||
if (this.handler == null)
|
||||
throw new MalformedURLException("Protocol handler not found: " + protocol);
|
||||
throw new MalformedURLException("Protocol handler not found: "
|
||||
+ protocol);
|
||||
|
||||
// JDK 1.2 doc for parseURL specifically states that any '#' ref
|
||||
// is to be excluded by passing the 'limit' as the indexOf the '#'
|
||||
|
@ -245,6 +246,12 @@ public final class URL implements Serializable
|
|||
return ref;
|
||||
}
|
||||
|
||||
public String getUserInfo ()
|
||||
{
|
||||
int at = host.indexOf('@');
|
||||
return at < 0 ? null : host.substring(0, at);
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
// JCL book says this is computed using (only) the hashcodes of the
|
||||
|
@ -299,6 +306,30 @@ public final class URL implements Serializable
|
|||
hashCode = hashCode(); // Used for serialization.
|
||||
}
|
||||
|
||||
/** @since 1.3 */
|
||||
protected void set(String protocol, String host, int port,
|
||||
String authority, String userInfo,
|
||||
String path, String query, String ref)
|
||||
{
|
||||
// TBD: Theoretically, a poorly written StreamHandler could pass an
|
||||
// invalid protocol. It will cause the handler to be set to null
|
||||
// thus overriding a valid handler. Callers of this method should
|
||||
// be aware of this.
|
||||
this.handler = setURLStreamHandler(protocol);
|
||||
this.protocol = protocol;
|
||||
if (userInfo == null)
|
||||
this.host = host;
|
||||
else
|
||||
this.host = userInfo + "@" + host;
|
||||
this.port = port;
|
||||
if (query == null)
|
||||
this.file = path;
|
||||
else
|
||||
this.file = path + "?" + query;
|
||||
this.ref = ref;
|
||||
hashCode = hashCode(); // Used for serialization.
|
||||
}
|
||||
|
||||
public static synchronized void
|
||||
setURLStreamHandlerFactory(URLStreamHandlerFactory fac)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue