Miscellaneous changes to java.net worth mentioning:
Noteworthy bug fixes:
- InetAddress
A bug existed in JDK1.0.2 where one could not create an InetAddress
out of a IP address String (e.g., "206.26.48.100") if a corresponding
host name (e.g., "java.sun.com") could not be found. This resulted in
an UnknownHostException. The bug is fixed in JDK1.1. Additionally,
when an InetAddress is created from an IP address, the corresponding hostname
is not looked up until specifically requested (via InetAddress.getHostName()),
as a performance enhancement.
- ServerSocket/DatagramSocket close()
A bug existed in JDK1.0.2 where the close() method of ServerSocket
and DatagramSocket were synchronized. The result was that if one thread
were blocked indefinitely in DatagramSocket.receive() or ServerSocket.accept(),
another thread couldn't break the blocking thread out by calling close(). This
is fixed in JDK1.1 by making the close() methods unsynchronized.
- URLConnection
There was a bug in JDK1.0.2 where the methods on URLConnection:
- setRequestProperty()
- getRequestProperty()
- getHeaderField()
- getHeaderFieldInt()
- getContentLength()
- getDate()
etc, did not work. These are fixed in JDK1.1.
Binding to local port/address:
- Socket, ServerSocket, DatagramSocket
These classes has overloaded constructors for binding to a specific
local address and port. This is useful and necessary for applications
like proxy servers that operate on multi-homed machines, and need
particular control over which network interfaces are used.
MulticastSocket:
- The MulticastSocket class was moved from package sun.net into the core
API of java.net.
HttpURLConnection:
- JDK1.1 introduces a new class, HttpURLConnection which extends
URLConnection, and provides additional functionality specific to
HTTP:
- Ability to use all of the request methods with HTTP/1.1, like:
- GET
- POST
- PUT
- HEAD
- TRACE
- DELETE
- OPTIONS
- Control over whether to follow HTTP redirects.
David Brown
Last modified: Thu Dec 5 15:09:54 PST