Java Proxy¶¯Ì¬´úÀí
ÏÈ¿´¸öÀý×Ó£º
½Ó¿Ú
package example;
public interface Basic {
public void hello();
}
½Ó¿ÚµÄʵÏÖÀà
package example;
public class BasicService implements Basic {
public void hello() {
Sysytem.out.println("Hello, world");
}
}
ʵÏÖÁËInvocationHandler½Ó¿ÚµÄÀà
package example;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.logging.Level;
import java.util.logging.Logger;
public class LogHandler implements InvocationHandler {
private Logger logger = Logger.getLogger(this.getClass().getName());
private Object delegate;
public Object bind(Object delegate) {
this.delegate = delegate;
return Proxy.newProxyInstance(delegate.getClass().getClassLoader(), delegate.getClass().getInterfaces(), this);
}
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
Object result = null;
try {
log("method starts..." + method);
result = method.invoke(delegate, args);
log("method ends..." + method);
} catch (Exception e) {
log(e.toString());
}
&nb
Ïà¹ØÎĵµ£º
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔسö´¦£ºhttp://blog.csdn.net/royaki/archive/2009/05/07/4159279.aspx
1¡¢½¨Á¢Ò»¸öServlet²¢ÇÒʵÏÖFilter½Ó¿Ú
¸ÃÀàÐèҪʵÏÖFilter½Ó¿ÚÖеÄinit() doFilter() destory()·½·¨
ÆäÖÐinit()·½·¨×Ô¶¯ÔÚÏîÄ¿Æô¶¯µÄʱºò¼ÓÔØ£¬doFilter()ÔÚµ÷ÓÃxmlÅäÖõÄ·¾¶ÊǼÓÔØ£¬d ......
±í´ïʽÒâÒ壺
1.×Ö·û
x ×Ö·û x¡£ÀýÈça±íʾ×Ö·ûa
\\ ·´Ð±Ïß×Ö·û¡£ÔÚÊéдʱҪдΪ\\\\¡££¨×¢Ò⣺ÒòΪjavaÔÚµÚÒ»´Î½âÎöʱ,°Ñ\\\\½âÎö³ÉÕýÔò±í´ïʽ\\£¬ÔÚµÚ¶þ´Î½âÎöʱÔÙ½âÎöΪ\£¬ËùÒÔ·²ÊDz»ÊÇ1.1Áоٵ½µÄתÒå×Ö·û£¬°üÀ¨1.1µÄ\\,¶øÓÖ´øÓÐ\µÄ¶¼ÒªÐ´Á½´Î£©
\0n ´øÓа ......
ÔÚ·Ö²¼Ê½·þÎñ¿ò¼ÜÖУ¬Ò»¸ö×î»ù´¡µÄÎÊÌâ¾ÍÊÇÔ¶³Ì·þÎñÊÇÔõôͨѶµÄ£¬ÔÚJavaµ×²ãÁìÓòÖÐÓкܶà¿ÉʵÏÖÔ¶³ÌͨѶµÄ¼¼Êõ£¬ÀýÈ磺RMI¡¢MINA¡¢ESB¡¢Burlap¡¢SOAP¡¢EJBºÍJMS µÈ£¬ÔÚj2eeÖÐ,¶Ôjavaµ×²ãÔ¶³ÌͨѶµÄ¼¼Êõ½øÐÐÁË·â×°,ÐγÉÁË Hessian ¡¢ HttpInvoker ¡¢ XFire ¡¢ Axis µÈ¶àÖÖÐÎʽµÄÔ¶³Ìµ÷Óü¼Êõ¡£ µ«¶Ô¸ß¼¶³ÌÐòÔ±¶øÑÔÈÔÐ ......
2009-11-11 18:06:09
/**
*
* @author Ice*
*/
public class RarUtil{
public static void main(String args[]) throws Exception {
String compress = "D:\\test.rar";// rarѹËõÎļþ
String decompression = "D:\\";// ½âѹ·¾¶
unZip(compress, decompression);
}
/** ......
java exception ½â¾ö·½°¸ - ÎÒµÄÒì³£Íø|Òì³£|exception 730 - org.hibernate.LazyInitializationException:could not initialize proxy 731 - ¾¯¸æ: Error setting value 732 - override and commit 733 - Building workspace has encountered a problem. Errors during build 734 - Could not open the editor: An ......