20.17
java.lang.SecurityManager
THE PACKAGE JAVA.LANG
public void checkAccept(String host, int port)
throws SecurityException;
public void checkSetFactory()
throws SecurityException;
public boolean checkTopLevelWindow()
throws SecurityException;
public void checkPackageAccess(String packageName)
throws SecurityException;
public void checkPackageDefinition(String packageName)
throws SecurityException;
}
A running Java program may have a security manager, which is an instance of
class
SecurityManager
. The current security manager is the one returned by the
method invocation
System.getSecurityManager()
 ( 20.18.4).
The
SecurityManager
 class contains a large number of methods whose
names begin with  
check
 . They are called by various methods throughout the
Java libraries before those methods perform certain sensitive operations. The
invocation of such a check method typically looks like this:
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkXXX(arguments);
}
The security manager is thereby given an opportunity to prevent completion
of the operation by throwing an exception. The usual convention is that a security
manager checking routine simply returns if the operation is permitted, or throws a
SecurityException
 if the operation is not permitted. In one case, namely
checkTopLevelWindow
 ( 20.17.27), the checking routine must return a
boolean
value to indicate one of two levels of permission.
20.17.1
protected boolean inCheck = false;
By convention, this field should be assigned the value
true
 whenever a security
check is in progress. This matters when one of the checking routines needs to call
outside code to do its work. Outside code can then use the method
getInCheck
( 20.17.9) to test the status of this flag.
570






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved