Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 377
نمايش فراداده

NetPermissionjava.net

Java 1.2serializable permission

This class is a java.security.Permission that represents various permissions required for Java's URL-based networking system. See also SocketPermission, which represents permissions to perform lower-level networking operations. A NetPermission is defined solely by its name; no actions list is required or supported. As of Java 1.2, there are three NetPermission targets defined: "setDefaultAuthenticator" is required to call Authenticator.setDefault( ); "requestPasswordAuthentication" to call Authenticator.requestPasswordAuthentication( ); and "specifyStreamHandler" to explicitly pass a URLStreamHandler object to the URL( ) constructor. The target "*" is a wildcard that represents all defined NetPermission targets.

System administrators configuring security policies must be familiar with this class and the permissions it represents. System programmers may use this class, but application programmers never need to use it explicitly.

Figure 12-13. java.net.NetPermission

public final class

NetPermission extends java.security.BasicPermission { // Public Constructors public

NetPermission (String

name ); public

NetPermission (String

name , String

actions ); }