<web-app> ... <listener> Â Â Â <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener> ... </web-app>
---------------------------------------------------------------------- RequestContextListener and RequestContextFilter 两个¾cÕdšçš„éƒ½æ˜¯åŒæ ïLš„工作åQ›å°†HTTP request 对象¾l‘定åˆîCؓ该请求æä¾›æœåŠ¡çš„Thread。这使具有request or session 作用域的bean能够在åŽé¢çš„调用链ä¸è¢«è®¿é—®åˆ°ã€?br />
作用域bean 与ä¾èµ?br />如果打算ž®†ä¸€ä¸ªHttp request 范围的bean 注入到别一个bean ä¸ï¼Œé‚£ä¹ˆéœ€è¦æ³¨å…¥ä¸€ä¸ªAOPä»£ç†æ¥æ›¿ä»£è¢«æ³¨å…¥çš„作用域beanåQŒä¹Ÿž®±æ˜¯è¯´éœ€è¦æ³¨å…¥ä¸€ä¸ªä»£ç†å¯¹è±¡ã€?br />æ³¨æ„ <aop:scoped-proxy/>ä¸èƒ½å’Œä½œç”¨åŸŸä¸ºsingleton æˆ?prototype çš„bean一起ä‹É用ã€?br /> <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> <!-- a HTTP Session-scoped bean exposed as a proxy --> <bean id="userPreferences" class="com.foo.UserPreferences" scope="session"> <!-- this next element effects the proxying of the surrounding bean --> <aop:scoped-proxy/> </bean> <!-- a singleton-scoped bean injected with a proxy to the above bean --> <bean id="userService" class="com.foo.SimpleUserService"> <!-- a reference to the proxied 'userPreferences' bean --> <property name="userPreferences" ref="userPreferences"/> </bean>
]]>生æˆMD5åQŒBASE64http://www.aygfsteel.com/ziwolf/archive/2006/12/22/89483.htmlziwolfziwolfFri, 22 Dec 2006 03:50:00 GMThttp://www.aygfsteel.com/ziwolf/archive/2006/12/22/89483.html  byte[] returnByte = null;   try{       MessageDigest md5 = MessageDigest.getInstance("MD5");       returnByte = md5.digest(strSrc.getBytes("UTF8"));    }catch(Exception e){       e.printStackTrace();   }   return returnByte;  }   public String getBase64Encode(byte[] src){     String requestValue="";     try{    BASE64Encoder base64en = new BASE64Encoder();    requestValue = base64en.encode(src);   }catch(Exception e){    e.printStackTrace();   }     return requestValue;  }