锘??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美国产精品va在线观看,日本在线视频不卡,福利片在线看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 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 周至县| 麻江县| 蛟河市| 南安市| 孟连| 马鞍山市| 陆良县| 迁安市| 东阿县| 平南县| 砚山县| 竹北市| 玉环县| 随州市| 从江县| 元朗区| 大埔区| 凌云县| 信宜市| 屏南县| 平陆县| 略阳县| 新野县| 岳西县| 凌海市| 丹凤县| 瑞金市| 英吉沙县| 竹山县| 长阳| 梅州市| 额敏县| 南康市| 绵阳市| 晋城| 三门县| 英山县| 精河县| 太谷县| 安庆市| 庆安县|