Java°²È«¹ÜÀíÆ÷Security Manager
ÿ¸öJavaÓ¦Óö¼¿ÉÒÔÓÐ×Ô¼ºµÄ°²È«¹ÜÀíÆ÷£¬ËüÊÇ·À·¶¶ñÒâ¹¥»÷µÄÖ÷Òª°²È«ÎÀÊ¿¡£°²È«¹ÜÀíÆ÷ͨ¹ýÖ´ÐÐÔËÐн׶μì²éºÍ·ÃÎÊÊÚȨ£¬ÒÔʵʩӦÓÃËùÐèµÄ°²È«²ßÂÔ£¬´Ó¶ø±£»¤×ÊÔ´ÃâÊܶñÒâ²Ù×÷µÄ¹¥»÷¡£Êµ¼ÊÉÏ£¬°²È«¹ÜÀíÆ÷¸ù¾ÝJava°²È«²ßÂÔÎļþ¾ö¶¨½«ÄÄ×éȨÏÞÊÚÓèÀࡣȻ¶ø£¬µ±²»¿ÉÐŵÄÀàºÍµÚÈý·½Ó¦ÓÃʹÓÃJVMʱ£¬Java°²È«¹ÜÀíÆ÷½«Ê¹ÓÃÓëJVMÏà¹ØµÄ°²È«²ßÂÔÀ´Ê¶±ð¶ñÒâ²Ù×÷¡£ÔںܶàÇé¿öÏ£¬ÍþвģÐͲ»°üº¬ÔËÐÐÓÚJVMÖеĶñÒâ´úÂ룬´ËʱJava°²È«¹ÜÀíÆ÷±ã²»ÊDZØÐèµÄ¡£µ±°²È«¹ÜÀíÆ÷¼ì²âµ½Î¥·´°²È«²ßÂԵIJÙ×÷ʱ£¬JVM½«Òý·¢AccessControlException»òSecurityException¡£
ÔÚJavaÓ¦ÓÃÖУ¬°²È«¹ÜÀíÆ÷ÊÇÓÉSystemÀàÖеķ½·¨setSecurityManagerÉèÖõġ£Òª»ñµÃµ±Ç°µÄ°²È«¹ÜÀíÆ÷£¬¿ÉÒÔʹÓ÷½·¨getSecurityManager¡£
java.lang.SecurityManagerÀà°üº¬Á˺ܶàcheckXXXX·½·¨£¬ÈçÓÃÓÚÅж϶ÔÎļþ·ÃÎÊȨÏÞµÄcheckRead(String file)·½·¨¡£ÕâЩ¼ì²é·½·¨µ÷ÓÃSecurityManager.checkPermission·½·¨£¬ºóÕ߸ù¾Ý°²È«²ßÂÔÎļþÅжϵ÷ÓÃÓ¦ÓÃÊÇ·ñÓÐÖ´ÐÐËùÇëÇóµÄ²Ù×÷ȨÏÞ¡£Èç¹ûûÓУ¬½«Òý·¢SecurityException¡£
Èç¹ûÏëÈÃÓ¦ÓÃʹÓð²È«¹ÜÀíÆ÷ºÍ°²È«²ßÂÔ£¬¿ÉÔÚÆô¶¯JVMʱÉ趨-Djava.security.managerÑ¡Ï»¹¿ÉÒÔͬʱָ¶¨°²È«²ßÂÔÎļþ¡£Èç¹ûÔÚÓ¦ÓÃÖÐÆôÓÃÁËJava°²È«¹ÜÀíÆ÷£¬È´Ã»ÓÐÖ¸¶¨°²È«²ßÂÔÎļþ£¬ÄÇôJava°²È«¹ÜÀíÆ÷½«Ê¹ÓÃĬÈϵݲȫ²ßÂÔ£¬ËüÃÇÊÇÓÉλÓÚĿ¼$JAVA_HOME/jre/lib/securityÖеÄjava.policy¶¨ÒåµÄ¡£
¸ÅÄî
²ßÂÔ(Policy)
Àà×°ÔØÆ÷ÓÃPolicy¶ÔÏó°ïÖúËüÃǾö¶¨£¬°ÑÒ»¶Î´úÂëµ¼ÈëÐéÄâ»úʱӦ¸Ã¸øËüÃÇʲôÑùµÄȨÏÞ. ÈκÎʱºò£¬Ã¿Ò»¸öÓ¦ÓóÌÐò¶¼Ö»ÓÐÒ»¸öPolicy¶ÔÏó.
²ßÂÔÎļþ
SunµÄjava1.2ƽ̨¾ßÌåµÄPolicy×ÓÀà²ÉÓÃÔÚÒ»ASCII²ßÂÔÎļþÖÐÓÃÉÏÏÂÎÄÎÞ¹ØÎÄ·¨ÃèÊö°²È«²ßÂÔ.
Ò»¸ö²ßÂÔÎļþ°üÀ¨ÁËһϵÁÐgrant×Ӿ䣬ÿһ¸ögrant×Ӿ佫һЩȨÏÞÊÚ¸øÒ»¸ö´úÂëÀ´Ô´¡£
±£»¤Óò(ProtectionDomain)
µ±Àà×°ÔØÆ÷½«ÀàÐÍ×°ÈëjavaÐéÄâ»úʱ£¬ËüÃǽ«ÎªÃ¿Ò»¸öÀàÐÍÖ¸ÅÉÒ»¸ö±£»¤Óò£¬±£»¤Óò¶¨ÒåÁËÊÚÓèÒ»¶ÎÌض¨µÄ´úÂëµÄËùÓÐȨÏÞ.×°ÔØÈëjavaÐéÄâ»úµÄÿһ¸öÀàÐͶ¼ÊôÓÚÒ»¸öÇÒ½öÊôÓÚÒ»¸ö±£»¤Óò.
·ÃÎÊ¿ØÖÆÆ÷(AccessController)
implies()
ÅжÏÒ»¸öPermissioin¶ÔÏóµÄȨÏÞ£¬ÊÇ·ñÒþº¬(imply)ÔÚÁíÒ»¸öPermissio
Ïà¹ØÎĵµ£º
-
JavaÊÇÓÉSun Microsystems¹«Ë¾ÓÚ1995Äê5ÔÂÍƳöµÄJava³ÌÐòÉè¼ÆÓïÑÔ£¨ÒÔϼò³ÆJavaÓïÑÔ£©ºÍJavaƽ̨µÄ×ܳơ£ÓÃJavaʵÏÖµÄHotJavaä¯ÀÀÆ÷£¨Ö§³ÖJava applet£©ÏÔʾÁËJavaµÄ÷ÈÁ¦£º¿çƽ̨¡¢¶¯Ì¬µÄWeb¡¢Internet¼ÆËã¡£´Ó´Ë£¬Java±»¹ã·º½ÓÊܲ¢Íƶ¯ÁËWebµÄѸËÙ·¢Õ¹£¬³£ÓõÄä¯ÀÀÆ÷ÏÖÔÚ¾ùÖ§³ÖJava applet¡£ÁíÒ»·½Ã棬Java¼¼ÊõÒ ......
¡¡1¡¢»ù±¾¸ÅÄî¼°ÔÀí
¡¡¡¡ÎÒÃÇÖªµÀ£¬¶ÔÓÚ¹²Ïí×ÊÔ´£¬ÓÐÒ»¸öºÜÖøÃûµÄÉè¼Æģʽ£º×ÊÔ´³Ø(Resource Pool)¡£¸ÃģʽÕýÊÇΪÁ˽â¾ö×ÊÔ´µÄƵ·±·ÖÅä?ÊÍ·ÅËùÔì³ÉµÄÎÊÌ⡣Ϊ½â¾öÉÏÊöÎÊÌ⣬¿ÉÒÔ²ÉÓÃÊý¾Ý¿âÁ¬½Ó³Ø¼¼Êõ¡£Êý¾Ý¿âÁ¬½Ó³ØµÄ»ù±¾Ë¼Ïë¾ÍÊÇΪÊý¾Ý¿âÁ¬½Ó½¨Á¢Ò»¸ö“»º³å³Ø”¡£Ô¤ÏÈÔÚ»º³å³ØÖзÅÈëÒ»¶¨ÊýÁ¿µÄÁ¬½Ó£¬µ±Ð ......
·ºÐÍÉùÃ÷¾ÍÊÇ·º·ºµÄÉùÃ÷ÀàÐÍ¡£ÎÒÃÇÓÃÆäËüµÄÓïÑÔ×öÒ»¸ö±È½Ï£º
JavascriptÉùÃ÷±äÁ¿£º var i= 1;var c = ‘char ’
VB ÉùÃ÷±äÁ¿£º dim i=1;dim c=’char’
Perl ÉùÃ÷±äÁ¿£º $i = 1; $c = ‘char’
ÕâЩ½Å±¾ÓïÑÔ£¬ÔÚÉùÃ÷±äÁ¿µÄʱºò£¬¸ù±¾¾Í²»ÏëjavaÄÇÑù»¹µÃÉùÃ÷ÀàÐÍ¡£ËûÃǵÄÀàÐÍÒÑ¾× ......
ÎÒÃÇÀ´½éÉÜһϠ£½£½ºÍequals()µÄÇø±ð£¬£½£½ÊÇÏàµÈ£¬equals()Ò²ÊÇÏàµÈ¡£ÕâÁ½¸ö´ÊµÄÇø±ðÊÇʲôÄØ£¿ÕâÊÇÕÒ¹¤×÷ʱºÜ¶àÃæÊÔ¹ÙµÄÎÊÌâ¡£ÎÒÃÇÀ´½â´ðһϡ£Ê×ÏÈÎÒÃÇ¿´Õâô¸öÀý×Ó¡£Êµ¼ù£º
public class TestEquals {
public static void main(String[] args) {
MyDate date1 = new MyDate(14, 3, 1976);
MyDate date2 = ne ......
function createTreeMenu(){//´´½¨Ò»¸öÊ÷µÄÃæ°å
var treeMenu = new Ext.tree.TreePanel({
lines : true,
minSize : 150,
border : false,
root : new Ext.tree.AsyncTreeNode({text : 'root'}),
loader : new Ext.tree.TreeLoader({dataUr ......