|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.security12.sun.net.www.URLConnection12
The purpose of URLCOnnection12
is to bridge the gap between
JDK 1.1 java.net.URLConnection and JDK 1.2 java.net.URLConnection which
can not be part of the IBM Migration Aid product, but its
getPermission() method is vital in several locations of the JDK 1.2 code.
Java.net.URLConnection is an abstract class that all other URLConection
subclasses extend from. If a subclass does not override the getPermission()
method, the subclass will inherit the parent class method which returns a
java.security.AllPermission
permission.
The known JDK 1.2 class hierarchy ['*' = no getPermission() method]:
java.net.URLConnection (abstract parent class)
java.net.JarURLConnection* extends java.net.URLConnection
This class extends java.net.JarURLConnection:
java.net.HttpURLConnection extends java.net.URLConnection
This class extends java.net.HttpURLConnection:
sun.net.www.URLConnection* extends java.net.URLConnection
The following classes extend sun.net.www.URLConnection:
sun.net.www.protocol.systemresource.SystemResourceURLCollection extends
java.net.URLConnection
Note: this class exists in JDK 1.2 only. The JDK 1.1 class
sun.net.www.protocol.systemresource.SystemResourceCollection was renamed to
this class.
sun.net.www.protocol.verbatim.VerbatimCollection extends
java.net.URLConnection
Note: this non-public class calls a file protocol getPermission() method
and can not be a recognized URLConnection in this class.
getPermission() is final and static. It should be called via the static call URLConnection12.getPermission(URL, URLConnection).
Here is a snippet of code that shows the use of URLConnection12.getPermission():
. . . URL url = codesource.getLocation(); Permission p; try { p = URLConnection12.getPermission(url, url.openConnection()); //@@DKS } catch (java.io.IOException ioe) { p = null; } if (p instanceof FilePermission) { . . .
Method Summary | |
static Permission |
getPermission(URL url,
URLConnection urlc)
Returns a permission object representing the permission necessary to make the connection represented by this object. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public static final Permission getPermission(URL url, URLConnection urlc) throws IOException
URLConnection
representing a file:
URL would return a
java.io.FilePermission
object. By default,
this method
returns java.security.AllPermission
.
The permission returned may dependent upon the state of the connection. For example, the permission before connecting may be different from that after connecting. For example, an HTTP sever, say foo.com, may redirect the connection to a different host, say bar.com. Before connecting the permission returned by the connection will represent the permission needed to connect to foo.com, while the permission returned after connecting will be to bar.com.
Permissions are generally used for two purposes: to protect caches of objects obtained through URLConnections, and to check the right of a recipient to learn about a particular URL. In the first case, the permission should be obtained after the object has been obtained. For example, in an HTTP connection, this will represent the permission to connect to the host from which the data was ultimately fetched. In the second case, the permission should be obtained and tested before connecting.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |