當前位置: 首頁>>代碼示例>>Java>>正文


Java Policy.refresh方法代碼示例

本文整理匯總了Java中java.security.Policy.refresh方法的典型用法代碼示例。如果您正苦於以下問題:Java Policy.refresh方法的具體用法?Java Policy.refresh怎麽用?Java Policy.refresh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.security.Policy的用法示例。


在下文中一共展示了Policy.refresh方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPermissions

import java.security.Policy; //導入方法依賴的package包/類
/**
 * Get the Permissions for a CodeSource.  If this instance
 * of StandardClassLoader is for a web application context,
 * add read FilePermissions for the base directory (if unpacked),
 * the context URL, and jar file resources.
 *
 * @param CodeSource where the code was loaded from
 * @return PermissionCollection for CodeSource
 */
protected final PermissionCollection getPermissions(CodeSource codeSource) {
    if (!policy_refresh) {
        // Refresh the security policies
        Policy policy = Policy.getPolicy();
        policy.refresh();
        policy_refresh = true;
    }
    String codeUrl = codeSource.getLocation().toString();
    PermissionCollection pc;
    if ((pc = (PermissionCollection)loaderPC.get(codeUrl)) == null) {
        pc = super.getPermissions(codeSource);
        if (pc != null) {
            Iterator perms = permissionList.iterator();
            while (perms.hasNext()) {
                Permission p = (Permission)perms.next();
                pc.add(p);
            }
            loaderPC.put(codeUrl,pc);
        }
    }
    return (pc);

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:33,代碼來源:StandardClassLoader.java

示例2: main

import java.security.Policy; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {

        // Check policy with no java.security.policy property set
        Policy p = Policy.getPolicy();
        checkPolicy(p);

        // Check policy with java.security.policy '=' option
        System.setProperty("java.security.policy", "Extra.policy");
        p.refresh();
        checkPolicy(p);

        // Check policy with java.security.policy override '==' option
        System.setProperty("java.security.policy", "=Extra.policy");
        p.refresh();
        checkPolicy(p);

        // Check Policy.getInstance
        URI policyURI = Paths.get(System.getProperty("test.src"),
                                  "Extra.policy").toUri();
        p = Policy.getInstance("JavaPolicy", new URIParameter(policyURI));
        checkPolicy(p);
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:23,代碼來源:DefaultPolicy.java

示例3: refreshPolicy

import java.security.Policy; //導入方法依賴的package包/類
/**
 * Refresh the system policy file, to pick up eventual changes.
 */
protected void refreshPolicy() {

    try {
        // The policy file may have been modified to adjust
        // permissions, so we're reloading it when loading or
        // reloading a Context
        Policy policy = Policy.getPolicy();
        policy.refresh();
    } catch (AccessControlException e) {
        // Some policy files may restrict this, even for the core,
        // so this exception is ignored
    }

}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:18,代碼來源:WebappClassLoaderBase.java

示例4: refreshPolicy

import java.security.Policy; //導入方法依賴的package包/類
/**
 * Refresh the system policy file, to pick up eventual changes.
 */
protected void refreshPolicy() {

    try {
        // The policy file may have been modified to adjust 
        // permissions, so we're reloading it when loading or 
        // reloading a Context
        Policy policy = Policy.getPolicy();
        policy.refresh();
    } catch (AccessControlException e) {
        // Some policy files may restrict this, even for the core,
        // so this exception is ignored
    }

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:18,代碼來源:WebappClassLoader.java

示例5: refreshPolicy

import java.security.Policy; //導入方法依賴的package包/類
/**
 * Refresh the system policy file, to pick up eventual changes.
 */
protected void refreshPolicy() {

	try {
		// The policy file may have been modified to adjust
		// permissions, so we're reloading it when loading or
		// reloading a Context
		Policy policy = Policy.getPolicy();
		policy.refresh();
	} catch (AccessControlException e) {
		// Some policy files may restrict this, even for the core,
		// so this exception is ignored
	}

}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:18,代碼來源:WebappClassLoaderBase.java


注:本文中的java.security.Policy.refresh方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。