JavaÖеĴúÀí¼¼Êõ
JavaÖеĴúÀí¼¼Êõ
ÒÔÇ°·¢¹ýÒ»±éblog½²µ½ÁË´úÀí¼¼Êõ£¬·¢ÏÖÀí½âÓÐЩ´íÎó£¬×î½üÓÐÓÖÁËЩеÄÀí½â£¬×ܽáÒ»ÏÂ
´úÀí¼¼Êõ¿ÉÒÔ·ÖΪstatic proxyºÍdynamic proxy£¬Á½ÖÖ´úÀí¼¼ÊõÓÃ;Ҳ²»Í¬
static proxy ÓõĽÏÉÙ£¬ÒòΪÿ´úÀíÒ»¸ö¶ÔÏ󣬶¼ÐèÒª´´½¨Ò»¸ö´úÀíÀ࣬ÏÔÈ»²»ÊÇÎÒÃÇËùÆÚÍûµÄ
dynamic proxyÔòÓõıȽϹ㷺£¬ÒòΪ²»ÐèÒªÉú³É´úÀíÀ࣬ÐèÒª´úÀíij¸ö¶ÔÏóʱ£¬Ö±½ÓÉú³É¼´¿É
ÏÂÃæÖ÷Òª½²Ò»ÏÂdynamic proxy
˵µ½´úÀí£¬ÎÒÃÇÓ¦¸ÃÖªµÀ´úÀí¶ÔÏóºÍ±»´úÀí¶ÔÏó
Ê×ÏÈдһ¸ö±»´úÀí¶ÔÏóµÄÀà,±»´úÀíµÄÀàÐèҪʵÏÖÒ»¸ö½Ó¿Ú£¬ÖÁÓÚΪʲô·ÇҪʵÏÖ½Ó¿Ú£¬ÒÔÇ°²»Ã÷°×£¬ÏÖÔÚÓÐЩÃ÷°×£¬×Ô¼º´§Ä¦µÄ
²»ÖªµÀ¶Ô²»¶Ô
ÒòΪÎÒÃÇÔÚ´î¿ò¼ÜµÄʱºò£¬ÓÐЩʱºò²¢²»ÖªµÀÔÛÃÇÒª´úÀíʲô£¬ËùÒÔʹÓÃÒ»¸ö½Ó¿Ú£¬µ±ÒÔºóÔÛÃÇÐèÒª´úÀíij¸öÀàµÄ¶ÔÏóʱ£¬Ö»ÐèÒª
ÈÃÕâ¸öÀàʵÏÖÕâ¸ö½Ó¿Ú¾ÍºÃÁË£¬ÕâÊÇÎÒµÄÀí½â
Æä´Î£¬JavaAPIÆäʵÌṩÁË´úÀíÀ࣬Æäµ×²ãʵÏֵķ½·¨Óõ½Á˽ӿڣ¬ËùÒÔÔÛÃÇ»¹ÊÇŪһ¸ö½Ó¿Ú°É...
interface Action {
void sing();
void dance();
}
public class Person {
@Override
public void sing() {
System.out.println("singing...");
}
@Override
public void dance() {
System.out.println("dancing...");
}
}
ÕâÑùÒ»¸ö¼òµ¥µÄ±»´úÀí¶ÔÏóµÄÉú³ÉÀà¾ÍдºÃÁË£¬¾¹ýÉÏÃæµÄ½éÉÜ£¬ÎÒÃÇÖªµÀ£¬¶¯Ì¬´úÀíÊDz»ÐèÒª´´½¨´úÀíÀàµÄ£¬Ö±½ÓʹÓÃJavaAPIÖÐ
ÌṩµÄProxy´úÀíÀàÀ´»ñµÃ´úÀí¶ÔÏó
public class Demo {
public static void main(String args[]) {
//¼ÈÈ»ÊÇ´úÀí£¬ÔòÏÈnew³öÔÛÃÇÐèÒª±»´úÀíµÄ¶ÔÏó
final Action person = new Person();//ÕâÀïÊÇÓÃfinalÊÇÒòΪÏÂÃæµÄÄÚ²¿ÀàÖÐÓõ½Á˴˶ÔÏó
/*²é¿´APIÖеÄProxy´úÀíÀ࣬·¢ÏÖÓиö·½·¨newPrxoyInstance¿ÉÒÔ»ñµÃ´úÀí¶ÔÏó*/
Object proxy = Proxy.newProxyInstance(args1, args2, args3);
/*´Ë·½·¨ÓÐÈý¸ö²ÎÊý£¬Ò»Ò»½éÉÜ
ÆäʵÎÒÃÇÀ©É¢Ë¼Î¬Ò»Ï£¬Óö¯Ì¬´úÀí¼¼ÊõÎÞÐè´´½¨´úÀíÀ࣬ÄÇôÔÛÃÇͨ¹ýProxy´úÀíÀàµÄ·½·¨»ñµÃµÄ´úÀí¶ÔÏó
ÈçºÎ¸ú±»´úÀíµÄ¶ÔÏó²úÉú¹ØÁªÄØ£¿ÏÔÈ»£¬¸ú·½·¨ÖеIJÎÊýÓйØϵ
args1£ºÕâ¸ö²ÎÊýÊÇÒ»¸öÀà¼ÓÔØÆ÷£¬ÄĸöÀàµÄ£¿»¹ÓÃ˵Â𣿵±È»ÊÇÔÛÃDZ»´úÀí¶ÔÏóµÄÄǸöÀàµÄ¼ÓÔØÆ÷ÁË£¬ÄѵÀÊÇ°¢Ã¨
Ïà¹ØÎĵµ£º
¡¶Java how to program¡·
¡¶Core java 2¡·
¡¶Thinking in java¡·
¡¶³ÌÐòÉè¼Æʵ¼ù¡·
¡¶´úÂë´óÈ«¡·
¡¶Éè¼Æģʽ¡·
¡¶java ÍøÂç±à³Ì¡·
serverlet jsp javabean spring habernate mysqlµÈ¡£ ......
Ó¦¸Ã¾ÍÊÇ°Ñjava ÀïÃæµÄ×é¼þ¸ãÃ÷°×
Servlet
ServletÊÇÒ»ÖÖ»ùÓÚwebµÄJava×é¼þ£¬ËüÓÉÈÝÆ÷¹ÜÀí£¬²¢¶¯Ì¬Éú³ÉÆäÄÚÈÝ
ÔòûÓÐͼÐνçÃ棬ÔËÐÐÔÚ·þÎñÆ÷¶Ë
ËüÃǶ¼ÓÐÒ»¸öÉú´æÖÜÆÚ£¬°üº¬init()ºÍdestroy()·½·¨
²»ÊǶÀÁ¢µÄÓ¦ÓóÌÐò£¬Ã»ÓÐmain()·½·¨
Ó봫ͳµÄCGIºÍÐí¶àÆäËûÀàËÆCGIµÄ¼¼ÊõÏà±È£¬Java Servlet¾ßÓиü¸ßµÄЧÂÊ£¬¸ ......
°ÑÒÔÇ°×ö¹ýµÄÏîÄ¿×ܽáһϣ¡²Î¼Ó¹¤×÷ÒÔÀ´Ò»¹²ÓÃÈýÖÖ²»Í¬ÓïÑÔʵÏÖÁË»ñµÃÎļþ¼Ð¼°Æä×ÓÎļþÐÅÏ¢¡£ÎªÁË·½±ãÒÔºóʹÓÃ×ܽáÒ»ÏÂ
airʵÏÖ£º
private function getfile(filelist:File):Array{
var list:Array = filelist.getDirectoryListing();
var count:uint=list.length;
......
½ü³õ²½½Ó´¥ÁËÏÂJava¼ÓÃܺÍÊý×ÖÇ©ÃûµÄÏà¹ØÄÚÈÝ£¬ÎÒѧϰµÄ¹ý³Ì´ó¸Å·ÖÎå²½£º
1£©ÏûÏ¢ÕªÒª
2£©Ë½Ô¿¼ÓÃÜ
3£©¹«Ô¿¼ÓÃÜ
4£©Êý×ÖÇ©Ãû
5) Êý×ÖÖ¤Êé
ÏÂÃæµÄ´úÂëÊǵڶþ²¿·Ö£ºË½Ô¿¼ÓÃÜ
Ï£ÍûÄÜΪ¸Õ¸Õ½Ó´¥Õâ¸öµÄÅóÓÑÃÇÊ¡µãÊÂ
package security;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import ......
×î½ü³õ²½½Ó´¥ÁËÏÂJava¼ÓÃܺÍÊý×ÖÇ©ÃûµÄÏà¹ØÄÚÈÝ£¬ÎÒѧϰµÄ¹ý³Ì´ó¸Å·ÖÎå²½£º
1£©ÏûÏ¢ÕªÒª
2£©Ë½Ô¿¼ÓÃÜ
3£©¹«Ô¿¼ÓÃÜ
4£©Êý×ÖÇ©Ãû
5£©Êý×ÖÖ¤Êé
ÏÂÃæµÄ´úÂëÊǵÚÈý²¿·Ö£º¹«Ô¿¼ÓÃÜ
Ï£ÍûÄÜΪ¸Õ¸Õ½Ó´¥Õâ¸öµÄÅóÓÑÃÇÊ¡µãÊÂ
package security;
import java.security.KeyPair;
import java.security.KeyPairGenerator ......