锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产999精品久久久影片官网,亚洲人精品午夜,2020欧美日韩在线视频http://www.aygfsteel.com/ziwolf/archive/2006/12/26/90089.htmlziwolfziwolfTue, 26 Dec 2006 05:35:00 GMThttp://www.aygfsteel.com/ziwolf/archive/2006/12/26/90089.htmlhttp://www.aygfsteel.com/ziwolf/comments/90089.htmlhttp://www.aygfsteel.com/ziwolf/archive/2006/12/26/90089.html#Feedback0http://www.aygfsteel.com/ziwolf/comments/commentRss/90089.htmlhttp://www.aygfsteel.com/ziwolf/services/trackbacks/90089.html濡傛灉浣犱嬌鐢ㄧ殑鏄疭ervlet2.4 鍙婁互涓婄殑web瀹瑰櫒錛岄偅涔堜粎闇瑕佸湪web.xml 涓鍔燙ontextListener鍗沖彲

<web-app>
...
<listener>
聽聽 聽<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
...
</web-app>


濡傛灉浣犱嬌鐢ㄧ殑鏄棭鏈熺増鏈瑆eb瀹瑰櫒 Servlet 2.4 浠ュ墠錛岄偅涔堥渶瑕佷嬌鐢ㄤ竴涓猨avax.servlet.Filter 鐨勫疄鐜?br />
<web-app>
..
<filter>
聽聽 聽<filter-name>requestContextFilter</filter-name>
聽聽 聽<filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
</filter>
<filter-mapping>
聽聽 聽<filter-name>requestContextFilter</filter-name>
聽聽 聽<url-pattern>/*</url-pattern>
</filter-mapping>
...
</web-app>

----------------------------------------------------------------------
RequestContextListener and RequestContextFilter 涓や釜綾誨仛鐨勯兘鏄悓鏍風殑宸ヤ綔錛涘皢HTTP request 瀵硅薄緇戝畾鍒頒負璇ヨ姹傛彁渚涙湇鍔$殑Thread銆傝繖浣垮叿鏈塺equest or session 浣滅敤鍩熺殑bean鑳藉鍦ㄥ悗闈㈢殑璋冪敤閾句腑琚闂埌銆?br />

浣滅敤鍩焍ean 涓庝緷璧?br />濡傛灉鎵撶畻灝嗕竴涓狧ttp request 鑼冨洿鐨刡ean 娉ㄥ叆鍒板埆涓涓猙ean 涓紝閭d箞闇瑕佹敞鍏ヤ竴涓狝OP浠g悊鏉ユ浛浠h娉ㄥ叆鐨勪綔鐢ㄥ煙bean錛屼篃灝辨槸璇撮渶瑕佹敞鍏ヤ竴涓唬鐞嗗璞°?br />娉ㄦ剰
<aop:scoped-proxy/>涓嶈兘鍜屼綔鐢ㄥ煙涓簊ingleton 鎴?prototype 鐨刡ean涓璧蜂嬌鐢ㄣ?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>




鍒濆鍖栧洖璋?br />
鍙互鍦˙ean 瀹氫箟涓寚瀹氫竴涓櫘閫氱殑鍒濆鍖栨柟娉曪紝鍗沖湪XML閰嶇疆鏂囦歡涓氳繃鎸囧畾init-method 灞炴ф潵瀹屾垚銆?br />
<bean id="exampleInitBean" class="examples.ExampleBean" init-method="init" />

public class ExampleBean {
聽聽 聽public void init(){
聽聽 聽聽聽 聽//do some initialization work
聽聽 聽}
}


鏋愭瀯鍥炶皟
<bean id="exampleInitBean" class="examples.ExampleBean" destory-method="cleanup"/>

public class ExampleBean {
聽聽 聽public void cleanup(){
聽聽 聽聽聽 聽//do some destruction work..
聽聽 聽}
}




ziwolf 2006-12-26 13:35 鍙戣〃璇勮
]]>
鐢熸垚MD5錛孊ASE64http://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;
聽}


ziwolf 2006-12-22 11:50 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 惠安县| 福建省| 漳州市| 陕西省| 灵川县| 河间市| 崇明县| 礼泉县| 葵青区| 东平县| 晋宁县| 青铜峡市| 特克斯县| 建昌县| 赤城县| 彰化市| 环江| 祁连县| 汨罗市| 定远县| 沽源县| 襄汾县| 北流市| 通化县| 乐业县| 杭锦后旗| 嘉义县| 博爱县| 渭源县| 龙南县| 嵩明县| 隆尧县| 南漳县| 新津县| 绥化市| 北流市| 东源县| 尼玛县| 托里县| 黄陵县| 扶风县|