锘??xml version="1.0" encoding="utf-8" standalone="yes"?>大胆亚洲人体视频,亚洲国产另类久久久精品,久久精品国产亚洲AV无码偷窥 http://www.tkk7.com/zhhp1314520/category/16149.htmlzh-cnFri, 02 Mar 2007 07:43:27 GMTFri, 02 Mar 2007 07:43:27 GMT60浜嬪姟闅旂EJB鐨勪嬌鐢?/title><link>http://www.tkk7.com/zhhp1314520/articles/transaction_iso.html</link><dc:creator>鎹曢</dc:creator><author>鎹曢</author><pubDate>Mon, 15 Jan 2007 08:01:00 GMT</pubDate><guid>http://www.tkk7.com/zhhp1314520/articles/transaction_iso.html</guid><wfw:comment>http://www.tkk7.com/zhhp1314520/comments/93972.html</wfw:comment><comments>http://www.tkk7.com/zhhp1314520/articles/transaction_iso.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/zhhp1314520/comments/commentRss/93972.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/zhhp1314520/services/trackbacks/93972.html</trackback:ping><description><![CDATA[ <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span style="FONT-FAMILY: 瀹嬩綋; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">涓氬姟鎿嶄綔鐨勪簨鍔℃у拰浜嬪姟闅旂鎬э紝鏄?/span> <span lang="EN-US">J2EE</span> <span style="FONT-FAMILY: 瀹嬩綋; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">寮鍙戜腑涓涓潪甯擱噸瑕佺殑鍔熻兘銆?/span> <span lang="EN-US"> <br /> </span> <span style="FONT-FAMILY: 瀹嬩綋; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">姣斿錛屽湪涓氬姟鎿嶄綔涓殑緋葷粺鏃ュ織鍜屾潈闄愭棩蹇楋紝灝卞緢濂界殑浣撶幇浜嗕簨鍔″師瀛愭у拰浜嬪姟闅旂鐨勫簲鐢ㄣ?/span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> <span style="FONT-FAMILY: 瀹嬩綋; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">榪欓噷錛屼富瑕佽涓涓嬩簨鍔¢殧紱?/span> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">EJB</span> <span style="FONT-FAMILY: 瀹嬩綋; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">鐨勪嬌鐢ㄣ?/span> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold"> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?> <o:p> </o:p> </span> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt -9pt"> <span style="FONT-FAMILY: 瀹嬩綋; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">聽涓轟簡鑳藉湪鍏鋒湁浜嬪姟鐨?/span> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">action</span> <span style="FONT-FAMILY: 瀹嬩綋; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">涓皟鐢ㄤ笉鍏佽浜嬪姟鏀寔鐨勫閮ㄧ郴緇?/span> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">EJB</span> <span style="FONT-FAMILY: 瀹嬩綋; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">錛屽</span> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">UMSAO</span> <span style="FONT-FAMILY: 瀹嬩綋; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">錛屽鍔犱簡浜嬪姟闅旂</span> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">EJB</span> <span style="FONT-FAMILY: 瀹嬩綋; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">銆?br /></span> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold"> <o:p> </o:p> </span> </p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #000000">Facade4IsolateService.java<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />Facade4IsolateServiceEJB.java<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />Facade4IsolateServiceHome.java<br /><img id="Codehighlighter1_150_222_Open_Image" onclick="this.style.display='none'; Codehighlighter1_150_222_Open_Text.style.display='none'; Codehighlighter1_150_222_Closed_Image.style.display='inline'; Codehighlighter1_150_222_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_150_222_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_150_222_Closed_Text.style.display='none'; Codehighlighter1_150_222_Open_Image.style.display='inline'; Codehighlighter1_150_222_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">interface</span> <span style="COLOR: #000000">聽Facade4IsolateService聽</span> <span style="COLOR: #0000ff">extends</span> <span style="COLOR: #000000">聽EJBLocalObject鈥?/span> <span id="Codehighlighter1_150_222_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.tkk7.com/images/dot.gif" /> </span> <span id="Codehighlighter1_150_222_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">void</span> <span style="COLOR: #000000">聽getReadPrivList(List聽permissionList,聽List聽userTypeList);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span> </span> <span style="COLOR: #000000"> <br /> <img id="Codehighlighter1_289_370_Open_Image" onclick="this.style.display='none'; Codehighlighter1_289_370_Open_Text.style.display='none'; Codehighlighter1_289_370_Closed_Image.style.display='inline'; Codehighlighter1_289_370_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /> <img id="Codehighlighter1_289_370_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_289_370_Closed_Text.style.display='none'; Codehighlighter1_289_370_Open_Image.style.display='inline'; Codehighlighter1_289_370_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /> </span> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">class</span> <span style="COLOR: #000000">聽Facade4IsolateServiceEJB聽</span> <span style="COLOR: #0000ff">extends</span> <span style="COLOR: #000000">聽PafaSlsSessionBean聽</span> <span id="Codehighlighter1_289_370_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.tkk7.com/images/dot.gif" /> </span> <span id="Codehighlighter1_289_370_Open_Text"> <span style="COLOR: #000000">{<br /><img id="Codehighlighter1_359_368_Open_Image" onclick="this.style.display='none'; Codehighlighter1_359_368_Open_Text.style.display='none'; Codehighlighter1_359_368_Closed_Image.style.display='inline'; Codehighlighter1_359_368_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_359_368_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_359_368_Closed_Text.style.display='none'; Codehighlighter1_359_368_Open_Image.style.display='inline'; Codehighlighter1_359_368_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽聽聽</span> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">void</span> <span style="COLOR: #000000">聽getReadPrivList(List聽permissionList,聽List聽userTypeList)</span> <span id="Codehighlighter1_359_368_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.tkk7.com/images/dot.gif" /> </span> <span id="Codehighlighter1_359_368_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽鈥β犫?br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽}</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">interface</span> <span style="COLOR: #000000">聽Facade4IsolateServiceHome聽</span> <span style="COLOR: #0000ff">extends</span> <span style="COLOR: #000000">聽EJBLocalHome<br /><img id="Codehighlighter1_436_501_Open_Image" onclick="this.style.display='none'; Codehighlighter1_436_501_Open_Text.style.display='none'; Codehighlighter1_436_501_Closed_Image.style.display='inline'; Codehighlighter1_436_501_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_436_501_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_436_501_Closed_Text.style.display='none'; Codehighlighter1_436_501_Open_Image.style.display='inline'; Codehighlighter1_436_501_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span> <span id="Codehighlighter1_436_501_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.tkk7.com/images/dot.gif" /> </span> <span id="Codehighlighter1_436_501_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000">聽Facade4IsolateService聽create()聽</span> <span style="COLOR: #0000ff">throws</span> <span style="COLOR: #000000">聽CreateException;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <br /> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt"> <i style="mso-bidi-font-style: normal"> <span style="FONT-FAMILY: 瀹嬩綋; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">闇瑕佸湪鐩稿叧鏂囦歡涓厤緗細(xì)</span> </i> <i style="mso-bidi-font-style: normal"> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold"> <o:p> </o:p> </span> </i> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt"> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">biz-context.xml<br />"ejb/test/Facade4IsolateService"鍦╳eblogic-ejb-jar.xml涓厤緗紝蹇呴』鍚屽悕銆?br /></span> </p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">bean聽</span> <span style="COLOR: #ff0000">id</span> <span style="COLOR: #0000ff">="isolateEJB"</span> <span style="COLOR: #ff0000">聽聽聽聽聽聽聽聽class</span> <span style="COLOR: #0000ff">="com.test.app.lwc.service.remoting.access.ejb.LocalStatelessSessionProxyFactoryBean"</span> <span style="COLOR: #ff0000">聽聽聽聽聽lazy-init</span> <span style="COLOR: #0000ff">="true"</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">property聽</span> <span style="COLOR: #ff0000">name</span> <span style="COLOR: #0000ff">="jndiName"</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">ejb/test/Facade4IsolateService</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">property</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">property聽</span> <span style="COLOR: #ff0000">name</span> <span style="COLOR: #0000ff">="businessInterface"</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽com.test.biz.service.ejb.Facade4IsolateService<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">property</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">property聽</span> <span style="COLOR: #ff0000">name</span> <span style="COLOR: #0000ff">="jndiTemplate"</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">ref聽</span> <span style="COLOR: #ff0000">local</span> <span style="COLOR: #0000ff">="jndiTemplate"</span> <span style="COLOR: #ff0000">聽</span> <span style="COLOR: #0000ff">/></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">property</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">bean</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt"> <br /> </p> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt"> <i style="mso-bidi-font-style: normal"> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">weblogic-ejb-jar.xml<o:p></o:p></span> <br />Facade4IsolateServiceEJB鍦╡jb-jar.xml鏂囦歡涓緗?br /></i> </p> <o:p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">weblogic-enterprise-bean</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">ejb-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">Facade4IsolateServiceEJB</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">ejb-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">stateless-session-descriptor</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">pool</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">max-beans-in-free-pool</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">500</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">max-beans-in-free-pool</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">initial-beans-in-free-pool</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">1</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">initial-beans-in-free-pool</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">pool</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">stateless-session-descriptor</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">enable-call-by-reference</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">True</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">enable-call-by-reference</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">local-jndi-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">ejb/test/Facade4IsolateService</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">local-jndi-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">weblogic-enterprise-bean</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <br /> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt"> <i style="mso-bidi-font-style: normal"> <span lang="EN-US" style="mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">ejb-jar.xml<br /></span> </i> </p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">session聽</span> <span style="COLOR: #ff0000">id</span> <span style="COLOR: #0000ff">="Facade4IsolateServiceEJB"</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">ejb-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">Facade4IsolateServiceEJB</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">ejb-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">local-home</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">com.test.biz.service.ejb.Facade4IsolateServiceHome</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">local-home</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">local</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">com.test.biz.service.ejb.Facade4IsolateService</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">local</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">ejb-class</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">com.test.biz.service.ejb.Facade4IsolateServiceEJB</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">ejb-class</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">session-type</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">Stateless</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">session-type</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">transaction-type</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">Container</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">transaction-type</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">env-entry</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">env-entry-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">ejb/BeanFactoryPath</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">env-entry-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">env-entry-type</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">java.lang.String</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">env-entry-type</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">env-entry-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">biz-context.xml</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">env-entry-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">env-entry</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">session</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt"> <o:p>聽</o:p> 璁劇疆浜嬪姟鐨勯殧紱誨睘鎬?/p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">container-transaction</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">method</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">ejb-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">Facade4IsolateServiceEJB</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">ejb-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">method-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">*</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">method-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">method</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">trans-attribute</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">NotSupported</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">trans-attribute</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">container-transaction</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> </o:p> <img src ="http://www.tkk7.com/zhhp1314520/aggbug/93972.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/zhhp1314520/" target="_blank">鎹曢</a> 2007-01-15 16:01 <a href="http://www.tkk7.com/zhhp1314520/articles/transaction_iso.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>ant緇撳悎junit榪涜杞歡鑷姩嫻嬭瘯http://www.tkk7.com/zhhp1314520/articles/ant_junit.html鎹曢鎹曢Tue, 28 Nov 2006 09:11:00 GMThttp://www.tkk7.com/zhhp1314520/articles/ant_junit.htmlhttp://www.tkk7.com/zhhp1314520/comments/84098.htmlhttp://www.tkk7.com/zhhp1314520/articles/ant_junit.html#Feedback0http://www.tkk7.com/zhhp1314520/comments/commentRss/84098.htmlhttp://www.tkk7.com/zhhp1314520/services/trackbacks/84098.html鏈枃鍋囪璇昏呭叿澶囧涓嬬煡璇嗭細(xì)

1銆佺啛緇僡nt榪涜java宸ョ▼緙栬瘧錛堝弬鑰冩湰浜衡渁nt緙栬瘧java宸ョ▼鈥濅竴鏂囷級

2銆乯unit鐭ヨ瘑錛岀湅鐪媤ww.junit.org

鍑嗗錛?/p>

1銆亀ww.junit.org涓嬭澆junit.jar

2銆亁ml.apache.org涓嬭澆xalan.jar錛坅nt 鐨?juntreport闇瑕佺敤鍒幫紝xalan鏈濂界増鏈ぇ浜?.0錛屼笉鐒朵綘榪樿涓嬭澆鍏朵粬鐨刯ava搴擄級

鎶妀unit.jar銆亁alan.jar鎷瘋礉鍒?ANT_HOME/lib/涓嬮潰錛屽茍涓旀渶濂藉姞鍒扮郴緇烠LASSPATH錛坖unit.jar鏄偗瀹氳鐨勶紝xalan.jar灝變笉娓呮浜嗭級銆?br />

瀵硅嚜宸辯殑紼嬪簭娣誨姞junit嫻嬭瘯紼嬪簭錛屾澶勮鍙傝僿ww.junit.org鐨勬枃妗o紝寰堢畝鍗曠殑銆?br />

鐒跺悗鍦╞uild.xml涓坊鍔犲涓嬫寚浠?寰堝涓滆タ鐣ヨ繃錛屾墍浠ュ己鐑堣姹傝鑰呭厛瀹屾垚鏈漢鈥渁nt緙栬瘧java宸ョ▼鈥濅竴鏂囷級

<!-- 鍗曞厓嫻嬭瘯錛岄渶瑕佸畬鎴恈ompile浠誨姟 -->

<target name="test" depends="compile">

<junit printsummary="yes">

<!-- 闇瑕佺殑classpath -->

<classpath refid="classpath"/>

<batchtest>

<!-- 鍗曞厓嫻嬭瘯鏂囦歡涓烘墍鏈塻rc鐩綍涓嬬殑*Test.java鏂囦歡 -->

<fileset dir="${srcDir}"><include name="**/*Test.java"/></fileset>

<!-- 鐢熸垚鏍煎紡涓簒ml錛屼篃鍙互鐢╬lain鎴栬卋rief -->

<!-- 涓轟粈涔堢敓鎴恱ml錛屾槸涓轟簡涓嬩竴姝ュ仛report鐢?-->

<formatter type="xml"/>

</batchtest>

</junit>

<!-- 瀵箈ml鏂囦歡鐢熸垚鐩稿簲鐨刪tml鏂囦歡鍦╮eports鐩綍涓?-->

<!-- 濡傛灉鎸囧畾浜巜eb鍙闂殑鐩綍錛屽氨鍙互浣挎暣涓」鐩粍鐪嬪埌鍗曞厓嫻嬭瘯鎯呭喌 -->

<junitreport todir="reports">

<fileset dir=".">

<include name="TEST-*.xml"/>

</fileset>

<!-- 甯︽湁妗嗘灦錛屽彲浠ョ敤noframes閫変笉甯︽鏋?-->

<report format="frames" todir="reports/html"/>

</junitreport>

</target>

鐜板湪榪愯ant test錛岀湅鐪媟eports/涓嬮潰鏄笉鏄湁浜嗙敓鎴愮殑鍗曞厓嫻嬭瘯緇撴灉鐨勬枃浠朵簡錛?/p>

濡傛灉鏈夐棶棰樺彲浠ョ敤ant -debug test鐪嬬湅闂鍑哄湪鍝噷錛?/p>

鍙﹀鏇存敼婧愮▼搴忥紝璁╃▼搴忛氳繃嫻嬭瘯鍜岄氫笉榪囨祴璇曠湅鐪嬬敓鎴愮殑緇撴灉濡備綍錛?/p>

鎹曢 2006-11-28 17:11 鍙戣〃璇勮
]]>
浣跨敤Ant榪愯鏈湴紼嬪簭(杞? http://www.tkk7.com/zhhp1314520/articles/ant123.html鎹曢鎹曢Tue, 28 Nov 2006 09:09:00 GMThttp://www.tkk7.com/zhhp1314520/articles/ant123.htmlhttp://www.tkk7.com/zhhp1314520/comments/84097.htmlhttp://www.tkk7.com/zhhp1314520/articles/ant123.html#Feedback0http://www.tkk7.com/zhhp1314520/comments/commentRss/84097.htmlhttp://www.tkk7.com/zhhp1314520/services/trackbacks/84097.html闃呰鍏ㄦ枃

鎹曢 2006-11-28 17:09 鍙戣〃璇勮
]]>
Ant+Tomcat鑷姩閮ㄧ講http://www.tkk7.com/zhhp1314520/articles/ant_tomcat.html鎹曢鎹曢Thu, 23 Nov 2006 00:59:00 GMThttp://www.tkk7.com/zhhp1314520/articles/ant_tomcat.htmlhttp://www.tkk7.com/zhhp1314520/comments/82934.htmlhttp://www.tkk7.com/zhhp1314520/articles/ant_tomcat.html#Feedback0http://www.tkk7.com/zhhp1314520/comments/commentRss/82934.htmlhttp://www.tkk7.com/zhhp1314520/services/trackbacks/82934.html
閬囧埌涓涓棶棰橈紝鐧炬濅笉寰楀叾瑙o細(xì)
閫氳繃ant depoly鍙互鎶妋sms.war閮ㄧ講鍒皌omcat涓娿傚綋鐒訛紝瑕佹眰榪欐椂鍊檞ebapps涓嬮潰娌℃湁msms鐩綍銆?br />鐪媡omcat鐨勭邯褰曪紝鍔犺澆msms.war姝e父錛岀綉欏典篃鍙互鎵撳紑銆?br />
閫氳繃ant undeploy錛屽彲浠ユ妸msms鍗歌澆銆俆omcat鏄劇ず錛?br />Undeploying context [/msms]
姝e父鍗歌澆浜嗐傞棶棰樻槸錛屽幓鐪媤ebapps鐩綍涓嬮潰錛屽眳鐒舵湁涓涓猰sms鐩綍鐨勬畫楠革紝閲岄潰淇濈暀鐨勭洰褰曟槸
WEB-INF\lib
鏈変互涓嬪嚑涓枃浠舵畫鐣欑潃錛?br />commons-digester.jar
commons-validator.jar
struts.jar

榪欐椂鍊檓sms鐩綍涔熸棤娉曟墜宸ュ垹闄わ紝蹇呴』鍋滄帀tomcat鍚庢墠鑳藉垹闄ゃ?br />
鎴戣鐨則omcat鏄?.5銆備笉鐭ラ亾鏄惁榪樻湁浜洪亣鍒拌繃榪欑鎯呭喌錛屾垜鍙嶆鏄檿浜嗐?br />
build.properties鏂囦歡濡備笅錛?br />tomcat.dir=C:/ApacheGroup/Tomcat5.5
tomcat.webapps=C:/ApacheGroup/Tomcat5.5/webapps
tomcat.manager.url=http://localhost:8080/manager
tomcat.manager.username=admin
tomcat.manager.password=xxxxxxxx

build.xml鏂囦歡濡備笅錛?br /><?xml version="1.0"?>
<project name="msms" default="compile" basedir=".">
聽聽聽 <!-- Ant Tomcat Task Definition -->
聽聽聽 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask">
聽聽聽 聽聽聽 <classpath>
聽聽聽 聽聽聽 聽聽聽 <path location="${tomcat.dir}/server/lib/catalina-ant.jar" />
聽聽聽 聽聽聽 </classpath>
聽聽聽 </taskdef>

聽聽聽 <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
聽聽聽 聽聽聽 <classpath>
聽聽聽 聽聽聽 聽聽聽 <path location="${tomcat.dir}/server/lib/catalina-ant.jar" />
聽聽聽 聽聽聽 </classpath>
聽聽聽 </taskdef>

聽聽聽 <taskdef name="install" classname="org.apache.catalina.ant.InstallTask">
聽聽聽 聽聽聽 <classpath>
聽聽聽 聽聽聽 聽聽聽 <path location="${tomcat.dir}/server/lib/catalina-ant.jar" />
聽聽聽 聽聽聽 </classpath>
聽聽聽 </taskdef>

聽聽聽 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
聽聽聽 聽聽聽 <classpath>
聽聽聽 聽聽聽 聽聽聽 <path location="${tomcat.dir}/server/lib/catalina-ant.jar" />
聽聽聽 聽聽聽 </classpath>
聽聽聽 </taskdef>

聽聽聽 <taskdef name="list" classname="org.apache.catalina.ant.ListTask">
聽聽聽 聽聽聽 <classpath>
聽聽聽 聽聽聽 聽聽聽 <path location="${tomcat.dir}/server/lib/catalina-ant.jar" />
聽聽聽 聽聽聽 </classpath>
聽聽聽 </taskdef>

聽聽聽 <taskdef name="start" classname="org.apache.catalina.ant.StartTask">
聽聽聽 聽聽聽 <classpath>
聽聽聽 聽聽聽 聽聽聽 <path location="${tomcat.dir}/server/lib/catalina-ant.jar" />
聽聽聽 聽聽聽 </classpath>
聽聽聽 </taskdef>

聽聽聽 <taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
聽聽聽 聽聽聽 <classpath>
聽聽聽 聽聽聽 聽聽聽 <path location="${tomcat.dir}/server/lib/catalina-ant.jar" />
聽聽聽 聽聽聽 </classpath>
聽聽聽 </taskdef>

聽聽聽 <property name="build" value="build" />
聽聽聽 <property name="dist" value="dist" />
聽聽聽 <property name="src" value="src/java" />
聽聽聽 <property name="test" value="src/test" />
聽聽聽 <property name="war-config" value="src/config" />
聽聽聽 <property name="report" value="report" />
聽聽聽 <property name="lib" value="lib" />
聽聽聽 <property name="web" value="web" />
聽聽聽 <property name="meta" value="meta" />
聽聽聽 <property name="context-path" value="${ant.project.name}" />
聽聽聽 <property file="build.properties" />

聽聽聽 <path id="build.classpath">
聽聽聽 聽聽聽 <fileset file="${lib}/*.jar" />
聽聽聽 聽聽聽 <fileset dir="${tomcat.dir}/common/lib">
聽聽聽 聽聽聽 聽聽聽 <include name="*.jar" />
聽聽聽 聽聽聽 </fileset>
聽聽聽 聽聽聽 <fileset dir="${tomcat.dir}/common/endorsed">
聽聽聽 聽聽聽 聽聽聽 <include name="*.jar" />
聽聽聽 聽聽聽 </fileset>
聽聽聽 聽聽聽 <pathelement path="${build}" />
聽聽聽 </path>

聽聽聽 <!-- Hibernate Tool Task Definition -->
聽聽聽 <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="build.classpath" />
聽聽聽
聽聽聽 <target name="clean">
聽聽聽 聽聽聽 <echo message="Cleaning up the build and dist directories" />
聽聽聽 聽聽聽 <delete dir="${build}" />
聽聽聽 聽聽聽 <mkdir dir="${build}" />
聽聽聽 聽聽聽 <delete dir="${dist}" />
聽聽聽 聽聽聽 <mkdir dir="${dist}" />
聽聽聽 </target>

聽聽聽 <target name="copy-resources">
聽聽聽 聽聽聽 <copy todir="${build}">
聽聽聽 聽聽聽 聽聽聽 <fileset dir="${src}">
聽聽聽 聽聽聽 聽聽聽 聽聽聽 <exclude name="**/*.java" />
聽聽聽 聽聽聽 聽聽聽 聽聽聽 <exclude name="**/*.hbm.xml" />
聽聽聽 聽聽聽 聽聽聽 </fileset>
聽聽聽 聽聽聽 </copy>
聽聽聽 </target>

聽聽聽 <target name="compile" depends="copy-resources">
聽聽聽 聽聽聽 <javac destdir="${build}" srcdir="${src}:${test}">
聽聽聽 聽聽聽 聽聽聽 <classpath refid="build.classpath" />
聽聽聽 聽聽聽 </javac>
聽聽聽 </target>

聽聽聽 <target name="initdb" depends="compile">
聽聽聽 聽聽聽 <hibernatetool destdir="${build}">
聽聽聽 聽聽聽 聽聽聽 <classpath>
聽聽聽 聽聽聽 聽聽聽 聽聽聽 <path location="${build}" />
聽聽聽 聽聽聽 聽聽聽 </classpath>
聽聽聽 聽聽聽 聽聽聽 <annotationconfiguration configurationfile="src/java/hibernate.cfg.xml" />

聽聽聽 聽聽聽 聽聽聽 <hbm2ddl create="true" />
聽聽聽 聽聽聽 </hibernatetool>
聽聽聽 </target>

聽聽聽 <target name="run" depends="compile">
聽聽聽 聽聽聽 <java fork="true" classname="cn.ac.rcpa.msms.tools.ProjectManager" classpathref="build.classpath">
聽聽聽 聽聽聽 聽聽聽 <classpath path="${build}" />
聽聽聽 聽聽聽 聽聽聽 <arg value="${action}" />
聽聽聽 聽聽聽 聽聽聽 <arg value="${project}" />
聽聽聽 聽聽聽 聽聽聽 <arg value="${description}" />
聽聽聽 聽聽聽 </java>
聽聽聽 </target>

聽聽聽 <target name="test" depends="compile" description="run junit test">
聽聽聽 聽聽聽 <delete dir="${report}" />
聽聽聽 聽聽聽 <mkdir dir="${report}" />
聽聽聽 聽聽聽 <junit dir="." fork="true" printsummary="on" haltonfailure="false" failureproperty="tests.failed" showoutput="true">
聽聽聽 聽聽聽 聽聽聽 <classpath refid="build.classpath" />
聽聽聽 聽聽聽 聽聽聽 <formatter type="brief" />
聽聽聽 聽聽聽 聽聽聽 <batchtest todir="${report}">
聽聽聽 聽聽聽 聽聽聽 聽聽聽 <fileset dir="${build}">
聽聽聽 聽聽聽 聽聽聽 聽聽聽 聽聽聽 <include name="**/*Test.*" />
聽聽聽 聽聽聽 聽聽聽 聽聽聽 聽聽聽 <include name="**/Test*.*" />
聽聽聽 聽聽聽 聽聽聽 聽聽聽 </fileset>
聽聽聽 聽聽聽 聽聽聽 </batchtest>
聽聽聽 聽聽聽 </junit>
聽聽聽 聽聽聽 <fail if="tests.failed">
聽聽聽聽聽 ***********************************************************
聽聽聽聽聽 **** One or more tests failed! Check the output ... ****
聽聽聽聽聽 ***********************************************************
聽聽聽 </fail>
聽聽聽 </target>

聽聽聽 <target name="create-war" depends="clean, compile" description="build release war">
聽聽聽 聽聽聽 <echo message="creation the WAR file...${context-path}.war" />
聽聽聽 聽聽聽 <war destfile="${dist}/${context-path}.war" webxml="${meta}/web.xml">
聽聽聽 聽聽聽 聽聽聽 <classes dir="${build}">
聽聽聽 聽聽聽 聽聽聽 聽聽聽 <exclude name="**/*Test.*" />
聽聽聽 聽聽聽 聽聽聽 聽聽聽 <exclude name="**/Test*.*" />
聽聽聽 聽聽聽 聽聽聽 聽聽聽 <exclude name="hibernate.cfg.xml" />
聽聽聽 聽聽聽 聽聽聽 </classes>
聽聽聽 聽聽聽 聽聽聽 <lib dir="${lib}" />
聽聽聽 聽聽聽 聽聽聽 <fileset dir="${web}" />
聽聽聽 聽聽聽 聽聽聽 <zipfileset dir="${war-config}" prefix="WEB-INF/classes" />
聽聽聽 聽聽聽 </war>
聽聽聽 聽聽聽 <!--聽聽聽 聽聽聽 <scp file="${dist}/${context-path}.war" todir="root:${password}@172.16.1.20:/usr/local/tomcat/webapps" trust="true" /> -->
聽聽聽 </target>

聽聽聽 <target name="deploy" description="Install application in Tomcat">
聽聽聽 聽聽聽 <deploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context-path}" localWar="file:${dist}/${context-path}.war" />
聽聽聽 </target>

聽聽聽 <target name="undeploy" description="Remove application in Tomcat" if="already.deployed">
聽聽聽 聽聽聽 <undeploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context-path}" />
聽聽聽 </target>

聽聽聽 <target name="reload" description="Reload application in Tomcat">
聽聽聽 聽聽聽 <reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context-path}" />
聽聽聽 </target>

聽聽聽 <target name="start" description="Start Tomcat application">
聽聽聽 聽聽聽 <start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context-path}" />
聽聽聽 </target>

聽聽聽 <target name="stop" description="Stop Tomcat application">
聽聽聽 聽聽聽 <stop url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context-path}" />
聽聽聽 </target>

聽聽聽 <target name="list" description="List Tomcat applications">
聽聽聽 聽聽聽 <list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" />
聽聽聽 </target>

聽聽聽 <target name="deploy-application" description="Compile the web application...">
聽聽聽 聽聽聽 <echo message="Undeploying the application only if it's deployed..." />
聽聽聽 聽聽聽 <available file="${tomcat.webapps}/${context-path}.war" property="already.deployed" />
聽聽聽 聽聽聽 <antcall target="undeploy" />
聽聽聽 聽聽聽 <antcall target="create-war" />
聽聽聽 聽聽聽 <antcall target="deploy" />
聽聽聽 </target>
</project>


鍙湁Windows涓婃墠浼?xì)鏈夌殑闂锛?
鍒涘緩META-INF鐩綍錛?鍦ㄧ洰褰曢噷鏂板緩context.xml錛屽姞鍏ュ涓嬪唴瀹?

<?xml version="1.0" encoding="UTF-8"?>
<Context reloadable="true" antiResourceLocking="true">
</Context>

鏄ㄥぉ鐨勯敊璇嚦浠婃棤娉曚慨姝o紝鍗充嬌閲嶈浜員omcat涔熶笉琛屻?br />
涓嶈繃錛宒eploy鍒頒袱鍙發(fā)inux鏈嶅姟鍣ㄤ笂鍊掗兘鎴愬姛浜嗐?br />聽聽聽 <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask">
聽聽聽 聽聽聽 <classpath>
聽聽聽 聽聽聽 聽聽聽 <path location="${tomcat.dir}/server/lib/catalina-ant.jar" />
聽聽聽 聽聽聽 </classpath>
聽聽聽 </taskdef>

聽聽聽 <taskdef name="list" classname="org.apache.catalina.ant.ListTask">
聽聽聽 聽聽聽 <classpath>
聽聽聽 聽聽聽 聽聽聽 <path location="${tomcat.dir}/server/lib/catalina-ant.jar" />
聽聽聽 聽聽聽 </classpath>
聽聽聽 </taskdef>

聽聽聽 <target name="deploy-web" description="Install application in Local Tomcat">
聽聽聽 聽聽聽 <echo message="deploying to web ..." />
聽聽聽 聽聽聽 <deploy url="http://172.16.1.20:8080/manager" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context-path}" war="file:${dist}/${context-path}.war" update="true" />
聽聽聽 </target>

聽聽聽 <target name="list-web">
聽聽聽 聽聽聽 <echo message="list web tomcat ..." />
聽聽聽 聽聽聽 <list url="http://172.16.1.20:8080/manager" username="${tomcat.manager.username}" password="${tomcat.manager.password}" />
聽聽聽 </target>


榪欓噷璺熸槰澶╃殑浠g爜鏈変竴鐐逛笉涓鏍鳳細(xì)
1銆乴ocalWar鏀規(guī)垚浜唚ar銆?br />鍘熸潵鏇存柊榪滅▼鏈嶅姟鍣ㄧ殑鏃跺欙紝鎬繪槸鏄劇ず鏇存柊鎴愬姛錛屼絾鏄埌webapps鐩綍涓嬫繪槸娌℃湁鐩稿簲鐨剋ar鏂囦歡錛岄氳繃璋冪敤
ant list-web
鍙戠幇錛屾湁涓涓猚ontext-path鏄痙ist/msms錛岃屼笖鏄痵top鐘舵併傚摝錛屽師鏉ocalWar鐨勬剰鎬濅笉鏄寚寮鍙戠殑鏈哄櫒鐨刲ocal path錛岃屾槸鎸囨妸榪欎釜war琚啓鍒版湇鍔″櫒鐨勪粈涔堝湴鏂廣傛敼鎴恮ar灝辨甯鎬簡銆?br />
2銆佷笉闇瑕佸垽鏂槸鍚﹀凡緇廳eploy榪涜岃皟鐢╱ndeploy浜嗭紝鐩存帴閫氳繃update="true"鏇存柊灝卞彲浠ヤ簡銆?br />


鎹曢 2006-11-23 08:59 鍙戣〃璇勮
]]>
Ant鍩烘湰浣跨敤鎸囧崡http://www.tkk7.com/zhhp1314520/articles/ant_all.html鎹曢鎹曢Thu, 23 Nov 2006 00:56:00 GMThttp://www.tkk7.com/zhhp1314520/articles/ant_all.htmlhttp://www.tkk7.com/zhhp1314520/comments/82933.htmlhttp://www.tkk7.com/zhhp1314520/articles/ant_all.html#Feedback0http://www.tkk7.com/zhhp1314520/comments/commentRss/82933.htmlhttp://www.tkk7.com/zhhp1314520/services/trackbacks/82933.html闃呰鍏ㄦ枃

鎹曢 2006-11-23 08:56 鍙戣〃璇勮
]]>
浜嗚ВAOP(涓)http://www.tkk7.com/zhhp1314520/articles/aop1.html鎹曢鎹曢Wed, 25 Oct 2006 02:06:00 GMThttp://www.tkk7.com/zhhp1314520/articles/aop1.htmlhttp://www.tkk7.com/zhhp1314520/comments/77133.htmlhttp://www.tkk7.com/zhhp1314520/articles/aop1.html#Feedback0http://www.tkk7.com/zhhp1314520/comments/commentRss/77133.htmlhttp://www.tkk7.com/zhhp1314520/services/trackbacks/77133.html鍘熸枃:http://www.javaworld.com/javaworld/jw-01-2002/jw-0118-aspect.html

浜嗚ВAOP錛堢涓閮ㄥ垎錛?-鐢ㄩ潰鍚戞柟闈㈢殑緙栫▼鏂瑰紡鍒嗙杞歡鍏蟲敞鐐?/span>

鎽樿

澶氭暟杞歡緋葷粺閮藉寘鍚嚑涓法瓚婂涓ā鍧楃殑鍏蟲敞鐐廣傜敤闈㈠悜瀵硅薄鎶鏈疄鐜拌繖浜涘叧娉ㄧ偣浼?xì)鋴删p葷粺闅句互瀹炵幇錛岄毦浠ョ悊瑙o紝騫朵笖涓嶅埄浜庤蔣浠剁殑婕旇繘銆傛柊鐨凙OP錛堥潰鍚戣搴︾殑緙栫▼鏂規(guī)硶錛夊埄鐢ㄦā鍧楀寲鏉ュ垎紱昏蔣浠朵腑妯垏澶氭ā鍧楃殑鍏蟲敞鐐廣備嬌鐢ˋOP錛屼綘鍙互寤虹珛瀹規(guī)槗璁捐錛屾槗浜庣悊瑙e拰緇存姢鐨勭郴緇熴傛澶栵紝AOP鍙互甯︽潵鏇撮珮鐨勪駭鍑猴紝鏇村ソ鐨勮川閲忥紝鏇村ソ鐨勬墿灞曟э紝榪欑瘒鏂囩珷鏄繖涓郴鍒楅噷涓夌瘒鏂囩珷涓殑絎竴绔狅紝浠嬬粛AOP鐨勬蹇靛拰瀹冩墍瑙e喅鐨勯棶棰樸?

浣滆咃細(xì)Ramnivas Laddad

涓涓叧娉ㄧ偣灝辨槸涓涓壒瀹氱殑鐩殑銆佷竴鍧楁垜浠劅鍏磋叮鐨勭殑鍖哄煙銆備粠鎶鏈殑瑙掑害鏉ヨ錛屼竴涓吀鍨嬬殑杞歡緋葷粺鍖呭惈涓浜涙牳蹇冪殑鍏蟲敞鐐瑰拰緋葷粺綰х殑鍏蟲敞鐐廣備婦涓緥瀛愭潵璇達(dá)紝涓涓俊鐢ㄥ崱澶勭悊緋葷粺鐨勬牳蹇冨叧娉ㄧ偣鏄熻捶/瀛樺叆澶勭悊錛岃岀郴緇熺駭鐨勫叧娉ㄧ偣鍒欐槸鏃ュ織錛屼簨鍔″畬鏁存э紝鎺堟潈錛屽畨鍏ㄦу強(qiáng)鎬ц兘闂絳夛紝璁稿鍏蟲敞鐐光斺旀垜浠彨瀹冩í鍒囧叧娉ㄧ偣鈥斺斾細(xì)鍦ㄥ涓ā鍧椾腑鍑虹幇錛屼嬌鐢ㄧ幇鏈夌殑緙栫▼鏂規(guī)硶錛屾í鍒囧叧娉ㄧ偣浼?xì)妯憡澶氫釜妯″潡锛尵l撴灉鏄嬌緋葷粺闅句互璁捐銆佺悊瑙c佸疄鐜板拰婕旇繘銆?

AOP錛堥潰鍚戣搴︾殑緙栫▼鏂瑰紡錛夎兘澶熸瘮涓婅堪鏂規(guī)硶鏇村ソ鐨勫垎紱葷郴緇熷叧娉ㄧ偣錛屼粠鑰屾彁渚涙ā鍧楀寲鐨勬í鍒囧叧娉ㄧ偣銆?

鍦ㄨ繖綃囨枃绔犻噷鈥斺斿叧浜嶢OP鐨勪笁綃囨枃绔犵殑絎竴绔狅紝鎴戦鍏堜細(xì) 瑙i噴妯垏鍏蟲敞鐐瑰湪涓浜涘嵆浣挎槸涓瓑澶嶆潅搴︾殑杞歡緋葷粺涓篃浼?xì)寮曡碉L(fēng)殑闂錛屾帴鐫鎴戜細(xì)浠嬬粛AOP鐨勬牳蹇冩蹇靛茍婕旂ずAOP鏄庢牱瑙e喅妯垏鍏蟲敞鐐歸棶棰樼殑銆?

杞歡緙栫▼鏂規(guī)硶鐨勬紨榪?/span>

鍦ㄨ綆楁満縐戝鐨勬棭鏈熼樁孌碉紝寮鍙戜漢鍛樹嬌鐢ㄧ洿鎺ョ殑鏈哄櫒綰т唬鐮佹潵緙栫▼錛屼笉騫哥殑鏄紝紼嬪簭鍛樺緱鑺辮垂鏇村鏃墮棿鏉ヨ冭檻涓縐嶇壒瀹氭満鍣ㄧ殑鎸囦護(hù)闆嗚屼笉鏄墜涓渶瑕佽В鍐崇殑闂鏈韓銆傛參鎱㈢殑鎴戜滑杞屼嬌鐢ㄥ厑璁稿搴曞眰鏈哄櫒鍋氭煇縐嶆娊璞$殑楂樼駭璇█銆傜劧鍚庢槸緇撴瀯鍖栬璦錛屾垜浠彲浠ユ妸闂鍒嗚В鎴愪竴浜涘繀瑕佺殑榪囩▼鏉ュ畬鎴愪換鍔°備絾鏄紝闅忕潃澶嶆潅紼嬪害鐨勫鍔狅紝鎴戜滑鍙堥渶瑕佹洿閫傚悎鐨勬妧鏈傞潰鍚戝璞$殑緙栫▼鏂瑰紡錛圤OP錛変嬌鎴戜滑鍙互鎶婄郴緇熺湅浣滄槸涓鎵圭浉浜掑悎浣滅殑瀵硅薄銆傜被鍏佽鎴戜滑鎶婂疄鐜扮粏鑺傞殣钘忓湪鎺ュ彛涓嬨傚鎬佹т負(fù)鐩稿叧姒傚康鎻愪緵鍏叡鐨勮涓哄拰鎺ュ彛錛屽茍鍏佽鐗瑰畾鐨勭粍浠跺湪鏃犻渶璁塊棶鍩虹瀹炵幇鐨勫墠鎻愪笅鏀瑰彉鐗瑰畾琛屼負(fù)銆?

緙栫▼鏂規(guī)硶鍜岃璦鍐沖畾浜嗘垜浠拰璁$畻鏈轟氦嫻佺殑鏂瑰紡銆傛瘡涓縐嶆柊鐨勬柟娉曞閮芥彁鍑轟竴縐嶆柊鐨勫垎瑙i棶棰樼殑鏂規(guī)硶錛氭満鍣ㄧ爜銆佷吉浠g爜銆佽繃紼嬪拰綾葷瓑銆傛瘡縐嶆柊鐨勬柟娉曞閮戒嬌寰椾粠緋葷粺闇姹傚埌緙栫▼姒傚康鐨勬槧灝勬洿鍔犺嚜鐒躲傜紪紼嬫柟娉曞鐨勫彂灞曡鎴戜滑鍙互寤虹珛鏇村姞澶嶆潅鐨勭郴緇燂紝榪欏彞璇濆弽榪囨潵璇翠篃瀵癸紝鎴戜滑鑳藉寤虹珛鏇村姞澶嶆潅鐨勭郴緇熸槸鍥犱負(fù)榪欎簺鎶鏈厑璁告垜浠鐞嗚繖縐嶅鏉傚害銆?

鐜板湪錛屽ぇ澶氭暟杞歡欏圭洰閮介夋嫨OOP鐨勭紪紼嬫柟寮忋傜‘瀹烇紝OOP宸茬粡琛ㄦ槑浜嗗畠澶勭悊涓鑸涓虹殑鑳藉姏錛屼絾鏄紝鎴戜滑涓浼?xì)鍎夸細(xì)鐪嬪垘图堟垨璁镐綘宸簿l忔劅瑙夊埌浜嗭級錛?OOP涓嶈兘寰堝ソ鐨勫鐞嗘í瓚婂涓斺旂粡甯告槸涓嶇浉鍏崇殑鈥斺旀ā鍧楃殑琛屼負(fù)錛岀浉姣斾箣涓嬶紝AOP濉ˉ浜嗚繖涓┖鐧斤紝瀹冨緢鍙兘浼?xì)鏄~栫▼鏂規(guī)硶瀛﹀彂灞曠殑涓嬩竴涓噷紼嬬銆?

鎶婄郴緇熺湅浣滀竴鎵瑰叧娉ㄧ偣

鎴戜滑鍙互鎶婁竴涓鏉傜殑緋葷粺鐪嬩綔鏄敱澶氫釜鍏蟲敞鐐規(guī)潵緇勫悎瀹炵幇鐨勶紝涓涓吀鍨嬬殑緋葷粺鍙兘浼?xì)鍖呮嫭鍑犱釜鏂归潰鐨勫呄x敞鐐癸紝濡備笟鍔¢昏緫錛屾ц兘錛屾暟鎹瓨鍌紝鏃ュ織鍜岃皟璇曚俊鎭紝鎺堟潈錛屽畨鍏紝綰跨▼錛岄敊璇鏌ョ瓑錛岃繕鏈夊紑鍙戣繃紼嬩腑鐨勫叧娉ㄧ偣錛屽鏄撴噦錛屾槗緇存姢錛屾槗榪芥煡錛屾槗鎵╁睍絳夛紝鍥句竴婕旂ず浜嗙敱涓嶅悓妯″潡瀹炵幇鐨勪竴鎵瑰叧娉ㄧ偣緇勬垚浜嗕竴涓郴緇熴?



鍥?1. 鎶婃ā鍧椾綔涓轟竴鎵瑰叧娉ㄧ偣鏉ュ疄鐜?


鍥句簩鎶婇渶姹傛瘮浣滀竴鏉熺┛榪囦笁媯遍暅鐨勫厜錛屾垜浠闇姹備箣鍏夐氳繃鍏蟲敞鐐歸壌鍒笁媯遍暅錛屽氨浼?xì)鍖哄埆鍑烘瘡涓呄x敞鐐癸紝鍚屾牱鐨勬柟娉曚篃閫傜敤浜庡紑鍙戦樁孌電殑鍏蟲敞鐐廣?


鍥?2. 鍏蟲敞鐐瑰垎瑙? 涓夋1闀滄硶鍒?

寮鍙戜漢鍛樺緩绔嬩竴涓郴緇熶互婊¤凍澶氫釜闇姹傦紝鎴戜滑鍙互澶ц嚧鐨勬妸榪欎簺闇姹傚垎綾諱負(fù)鏍稿績妯″潡綰ч渶姹傚拰緋葷粺綰ч渶姹傘傚緢澶氱郴緇熺駭闇姹備竴鑸潵璇存槸鐩鎬簰鐙珛鐨勶紝浣嗗畠浠竴鑸兘浼?xì)妯垏璁稿鏍稿績妯″潡銆備婦涓緥瀛愭潵璇達(dá)紝涓涓吀鍨嬬殑浼佷笟搴旂敤鍖呭惈璁稿妯垏鍏蟲敞鐐癸紝濡傞獙璇侊紝鏃ュ織錛岃祫婧愭睜錛岀郴緇熺鐞嗭紝鎬ц兘鍙?qiáng)瀛樺偍绠$悊绛夊Q屾瘡涓涓叧娉ㄧ偣閮界壍娑夊埌鍑犱釜瀛愮郴緇燂紝濡傚瓨鍌ㄧ鐞嗗叧娉ㄧ偣浼?xì)濯勫搷鍒版墍鏈夌殑鏈夌姸鎬佷笟鍔″璞°?

璁╂垜浠潵鐪嬩竴涓畝鍗曪紝浣嗘槸鍏蜂綋鐨勪緥瀛愶紝鑰冭檻涓涓皝瑁呬簡涓氬姟閫昏緫鐨勭被鐨勫疄鐜版鏋訛細(xì)

浠g爜:
public class SomeBusinessClass extends OtherBusinessClass {
聽 聽 // 鏍稿績鏁版嵁鎴愬憳

聽 聽 // 鍏跺畠鏁版嵁鎴愬憳錛氭棩蹇楁祦錛屼繚璇佹暟鎹畬鏁存х殑鏍囧織浣嶇瓑

聽 聽 // 閲嶈澆鍩虹被鐨勬柟娉?

聽 聽 public void performSomeOperation(OperationInformation info) {
聽 聽 聽 聽 // 瀹夊叏鎬ч獙璇?

聽 聽 聽 聽 // 媯鏌ヤ紶鍏ユ暟鎹槸鍚︽弧瓚沖崗璁?

聽 聽 聽 聽 // 閿佸畾瀵硅薄浠ヤ繚璇佸綋鍏朵粬綰跨▼璁塊棶鏃剁殑鏁版嵁瀹屾暣鎬?

聽 聽 聽 聽 // 媯鏌ョ紦瀛樹腑鏄惁涓烘渶鏂頒俊鎭?

聽 聽 聽 聽 // 綰綍鎿嶄綔寮濮嬫墽琛屾椂闂?

聽 聽 聽 聽 // 鎵ц鏍稿績鎿嶄綔

聽 聽 聽 聽 // 綰綍鎿嶄綔瀹屾垚鏃墮棿

聽 聽 聽 聽 // 緇欏璞¤В閿?
聽 聽 }

聽 聽 // 涓浜涚被浼兼搷浣?

聽 聽 public void save(PersitanceStorage ps) {
聽 聽 }

聽 聽 public void load(PersitanceStorage ps) {
聽 聽 }
}


鍦ㄤ笂闈㈢殑浠g爜涓紝鎴戜滑娉ㄦ剰鍒頒笁涓棶棰橈紝棣栧厛錛屽叾瀹冩暟鎹垚鍛樹笉鏄繖涓被鐨勬牳蹇冨叧娉ㄧ偣錛岀浜岋紝performSomeOperation()鐨勫疄鐜板仛浜嗚澶氭牳蹇冩搷浣滀箣澶栫殑浜嬶紝瀹冭澶勭悊鏃ュ織錛岄獙璇侊紝綰跨▼瀹夊叏錛屽崗璁獙璇佸拰緙撳瓨綆$悊絳変竴浜涘鍥存搷浣滐紝鑰屼笖榪欎簺澶栧洿鎿嶄綔鍚屾牱涔熶細(xì)搴旂敤浜庡叾浠栫被錛岀涓夛紝save() 鍜宭oad()鎵ц鐨勬寔涔呭寲鎿嶄綔鏄惁鏋勬垚榪欎釜綾葷殑鏍稿績娓呮鐨勩?

妯垏鍏蟲敞鐐圭殑闂

铏界劧妯垏鍏蟲敞鐐逛細(xì)璺ㄨ秺澶氫釜妯″潡錛屼絾褰撳墠鐨勬妧鏈懼悜浜庝嬌鐢ㄤ竴緇寸殑鏂規(guī)硶瀛︽潵澶勭悊榪欑闇姹傦紝鎶婂搴旈渶姹傜殑瀹炵幇寮鴻闄愬埗鍦ㄤ竴緇寸殑絀洪棿閲屻傝繖涓竴緇寸┖闂村氨鏄牳蹇冩ā鍧楃駭瀹炵幇錛屽叾浠栭渶姹傜殑瀹炵幇琚祵鍏ュ湪榪欎釜鍗犵粺娌誨湴浣嶇殑絀洪棿錛屾崲鍙ヨ瘽璇達(dá)紝闇姹傜┖闂存槸涓涓猲緇寸┖闂達(dá)紝鑰屽疄鐜扮┖闂存槸涓緇寸┖闂達(dá)紝榪欑涓嶅尮閰嶅鑷翠簡緋熺硶鐨勯渶姹傚埌瀹炵幇鐨勬槧灝?

琛ㄧ幇
鐢ㄥ綋鍓嶆柟娉曞瀹炵幇妯垏鍏蟲敞鐐規(guī)槸涓嶅ソ鐨勶紝瀹冧細(xì)甯︽潵涓浜涢棶棰橈紝鎴戜滑鍙互澶ц嚧鎶婅繖浜涢棶棰樺垎涓轟袱綾?

  • 浠g爜娣蜂貢錛氳蔣浠剁郴緇熶腑鐨勬ā鍧楀彲鑳借鍚屾椂鍏奸【鍑犱釜鏂歸潰鐨勯渶瑕併備婦渚嬫潵璇達(dá)紝寮鍙戣呯粡甯歌鍚屾椂鑰冭檻涓氬姟閫昏緫錛屾ц兘錛屽悓姝ワ紝鏃ュ織鍜屽畨鍏ㄧ瓑闂錛屽吋欏懼悇鏂歸潰鐨勯渶瑕佸鑷寸浉搴斿叧娉ㄧ偣鐨勫疄鐜板厓绱犲悓鏃跺嚭鐜幫紝寮曡搗浠g爜娣蜂貢銆?
  • 浠g爜鍒嗘暎錛氱敱浜庢í鍒囧叧娉ㄧ偣錛屾湰鏉ュ氨娑夊強(qiáng)鍒板涓ā鍧楋紝鐩稿叧瀹炵幇涔熷氨寰楅亶甯冨湪榪欎簺妯″潡閲岋紝濡傚湪涓涓嬌鐢ㄤ簡鏁版嵁搴撶殑緋葷粺閲岋紝鎬ц兘闂灝變細(xì)褰卞搷鎵鏈夎闂暟鎹簱鐨勬ā鍧椼傝繖瀵艱嚧浠g爜鍒嗘暎鍦ㄥ悇澶?

緇撴灉

娣蜂貢鍜屽垎鏁g殑浠g爜浼?xì)鍦ㄥ涓枤w潰褰卞搷緋葷粺鐨勮璁″拰寮鍙戯細(xì)

  • 鍙鎬у樊錛氬悓鏃跺疄鐜板嚑涓叧娉ㄧ偣妯$硦浜嗕笉鍚屽叧娉ㄧ偣鐨勫疄鐜幫紝浣垮緱鍏蟲敞鐐逛笌鍏跺疄鐜頒箣闂寸殑瀵瑰簲鍏崇郴涓嶆槑鏄俱?
  • 浣庝駭鍑猴細(xì)鍚屾椂瀹炵幇鍑犱釜鍏蟲敞鐐規(guī)妸寮鍙戜漢鍛樼殑娉ㄦ剰鍔涗粠涓昏鐨勮漿縐誨埌澶栧洿鍏蟲敞鐐癸紝瀵艱嚧浜ц兘闄嶄綆銆?
  • 浣庝唬鐮侀噸鐢ㄧ巼錛氱敱浜庤繖縐嶆儏鍐典笅錛屼竴涓ā鍧楀疄鐜板涓叧娉ㄧ偣錛屽叾浠栭渶瑕佺被浼煎姛鑳界殑緋葷粺涓嶈兘椹笂浣跨敤璇ユā鍧楋紝榪涗竴姝ラ檷浣庝簡浜ц兘銆?
  • 浠g爜璐ㄩ噺宸細(xì)娣蜂貢鐨勪唬鐮佹帺鐩栦簡浠g爜涓殣钘忕殑闂銆傝屼笖錛岀敱浜庡悓鏃惰澶勭悊澶氫釜鍏蟲敞鐐癸紝搴旇鐗瑰埆娉ㄦ剰鐨勫叧娉ㄧ偣寰椾笉鍒板簲鏈夌殑鍏蟲敞
  • 闅句互鎵╁睍錛氱嫮紿勭殑瑙嗚鍜屾湁闄愮殑璧勬簮鎬繪槸浜х敓浠呮敞鎰忓綋鍓嶅叧娉ㄧ偣鐨勮璁°傛柊鐨勯渶姹傚鑷翠粠鏂板疄鐜般傜敱浜庡疄鐜頒笉鏄ā鍧楀寲鐨勶紝灝辨槸璇村疄鐜扮壍娑夊埌澶氫釜妯″潡錛屼負(fù)浜嗘柊闇姹備慨鏀瑰瓙緋葷粺鍙兘浼?xì)甯︽潵鏁版嵁鐨勪笉涓鑷達(dá)紝鑰屼笖榪橀渶鐩稿綋瑙勬ā嫻嬭瘯鏉ヤ繚璇佽繖浜涗慨鏀逛笉浼?xì)甯︽潵bug銆?

    褰撳墠瑙e喅鏂規(guī)硶

    鐢變簬澶氭暟緋葷粺涓兘鍖呭惈妯垏鍏蟲敞鐐癸紝鑷劧鐨勫凡緇忓艦鎴愪簡涓浜涙妧鏈潵妯″潡鍖栨í鍒囧叧娉ㄧ偣鐨勫疄鐜幫紝榪欎簺鎶鏈寘鎷細(xì)娣峰叆綾伙紝璁捐妯″紡鍜岄潰鍚戠壒瀹氶棶棰樺煙鐨勮В鍐蟲柟寮?

    浣跨敤娣峰叆綾伙紝浣犲彲浠ユ帹榪熷叧娉ㄧ偣鐨勬渶緇堝疄鐜般傚熀鏈被鍖呭惈涓涓販鍏ョ被鐨勫疄渚嬶紝鍏佽緋葷粺鐨勫叾浠栭儴鍒嗚緗繖涓疄渚嬶紝涓句釜渚嬪瓙鏉ヨ錛屽疄鐜頒笟鍔¢昏緫鐨勭被鍖呭惈涓涓販鍏ョ殑logger錛岀郴緇熺殑鍏朵粬閮ㄥ垎鍙互璁劇疆榪欎釜logger宸插緱鍒板悎閫傜殑鏃ュ織綾誨瀷錛屾瘮濡俵ogger鍙兘琚緗負(fù)浣跨敤鏂囦歡緋葷粺鎴栨槸娑堟伅涓棿浠?鍦ㄨ繖縐嶆柟寮忎笅錛岃櫧鐒舵棩蹇楃殑鍏蜂綋瀹炵幇琚帹榪熷暒錛屽熀鏈被榪樻槸寰楀寘鍚湪鎵鏈夌殑鍐欐棩蹇楃殑鐐硅皟鐢ㄦ棩蹇楁搷浣滃拰鎺у埗鏃ュ織淇℃伅鐨勪唬鐮併?

    琛屼負(fù)鍨嬭璁℃ā寮忥紝濡俈isitor鍜孴emplate妯″紡錛屼篃鍏佽浣犳帹榪熷叿浣撳疄鐜般備絾鏄篃灝卞儚娣峰叆綾諱竴鏍鳳紝鎿嶄綔鐨勬帶鍒垛斺旇皟鐢╲isitor鎴杢emplate鐨勯昏緫鈥斺斾粛鐒剁暀緇欎簡鍩烘湰綾?

    闈㈠悜鐗瑰畾闂鍩熺殑瑙e喅鏂瑰紡錛屽妗嗘灦鍜屽簲鐢ㄦ湇鍔″櫒錛屽厑璁稿紑鍙戣呯敤鏇存ā鍧楀寲鐨勬柟寮忓鐞嗘煇浜涙í鍒囧叧娉ㄧ偣銆傛瘮濡侲JB(Enterprise JavaBean錛屼紒涓氱駭javabean)鏋舵瀯,鍙互澶勭悊瀹夊叏錛岀郴緇熺鐞嗭紝鎬ц兘鍜屽鍣ㄧ鐞嗙殑鎸佷箙鍖栵紙container-managed persistence錛夌瓑妯垏鍏蟲敞鐐廣侭ean鐨勫紑鍙戣呬粎闇鍏沖績涓氬姟閫昏緫錛岃岄儴緗茶呬粎闇鍏沖績閮ㄧ講闂錛屽bean涓庢暟鎹簱鐨勬槧灝勩備絾鏄ぇ澶氭暟鎯呭喌涓嬶紝寮鍙戣呰繕鏄浜嗚В瀛樺偍緇撴瀯銆傝繖縐嶆柟寮忎笅錛屼綘鐢ㄥ熀浜嶺ML鐨勬槧灝勫叧緋繪弿榪板櫒鏉ュ疄鐜頒簬鏁版嵁鎸佷箙鍖栫浉鍏崇殑妯垏鍏蟲敞鐐廣?

    闈㈠悜鐗瑰畾闂鍩熺殑瑙e喅鏂瑰紡鎻愪緵浜嗚В鍐崇壒瀹氶棶棰樼殑涓撻棬鏈哄埗錛屽畠鐨勭己鐐規(guī)槸瀵逛簬姣忎竴縐嶈繖鏍風(fēng)殑瑙e喅鏂瑰紡寮鍙戜漢鍛橀兘蹇呴』閲嶆柊瀛︿範(fàn)錛屽彟澶栵紝鐢變簬榪欑鏂瑰紡鏄壒瀹氶棶棰樺煙鐩稿叧鐨勶紝灞炰簬鐗瑰畾闂鍩熶箣澶栫殑妯垏鍏蟲敞鐐歸渶瑕佺壒孌婄殑瀵瑰緟

    璁捐甯堢殑涓ら毦灞闈?/span>

    濂界殑緋葷粺璁捐甯堜笉浠呬細(xì)鑰冭檻褰撳墠闇姹傦紝榪樹細(xì)鑰冭檻鍒板彲鑳戒細(xì)鏈夌殑闇姹備互閬垮厤鍒板鎵撹ˉ涓併傝繖鏍峰氨瀛樺湪涓涓棶棰橈紝棰勭煡灝嗘潵鏄緢鍥伴毦鐨勶紝濡傛灉浣犳紡榪囦簡灝嗘潵鍙兘浼?xì)鏈夌殑妯垏鍏虫敞鐐圭殑闇姹傦紝浣犲皢浼?xì)闇瑕佷慨鏀規(guī)垨鐢氳嚦鏄噸鏂板疄鐜扮郴緇熺殑璁稿閮ㄥ垎錛涗粠鍙︿竴涓搴︽潵璇達(dá)紝澶繃浜庡叧娉ㄤ笉涓瀹氶渶瑕佺殑闇姹備細(xì)瀵艱嚧榪囧垎璁捐錛坥verdesigned錛夌殑錛岄毦浠ョ悊瑙g殑錛岃噧鑲跨殑緋葷粺銆傛墍浠ョ郴緇熻璁″笀澶勫湪榪欎箞涓涓袱闅懼眬闈腑錛氭庝箞璁捐綆楁槸榪囧垎璁捐錛熷簲璇ュ畞鍙璁′笉瓚寵繕鏄畞鍙繃鍒嗚璁★紵

    涓句釜渚嬪瓙鏉ヨ錛岃璁″笀鏄惁搴旇鍦ㄧ郴緇熶腑鍖呭惈鐜板湪騫朵笉闇瑕佺殑鏃ュ織鏈哄埗錛熷鏋滄槸鐨勮瘽錛屽摢閲屾槸搴旇鍐欐棩蹇楃殑鐐癸紵鏃ュ織搴旇璁板綍閭d簺淇℃伅錛熺浉浼肩殑渚嬪瓙榪樻湁鍏充簬鎬ц兘鐨勪紭鍖栭棶棰橈紝鎴戜滑寰堝皯鑳介鍏堢煡閬撶摱棰堢殑鎵鍦ㄣ傚父鐢ㄧ殑鏂規(guī)硶鏄緩绔嬬郴緇燂紝profile瀹冿紝鐒跺悗緲繪柊緋葷粺浠ユ彁楂樻ц兘錛岃繖縐嶆柟寮忓彲鑳戒細(xì)渚濈収 profiling淇敼緋葷粺鐨勫緢澶氶儴鍒嗭紝姝ゅ錛岄殢鐫鏃墮棿鐨勬祦閫濓紝鐢變簬浣跨敤鏂瑰紡鐨勫彉鍖栵紝鍙兘榪樹細(xì)浜х敓鏂扮殑鐡墮錛岀被搴撹璁″笀鐨勪換鍔℃洿鍥伴毦錛屽洜涓轟粬寰堥毦璁炬兂鍑烘墍鏈夊綾誨簱鐨勪嬌鐢ㄦ柟寮忋?

    鎬昏岃█涔嬶紝璁捐甯堝緢闅鵑【鍙?qiáng)鍒熬p葷粺鍙兘闇瑕佸鐞嗙殑鎵鏈夊叧娉ㄧ偣銆傚嵆浣挎槸鍦ㄥ凡緇忕煡閬撲簡闇姹傜殑鍓嶆彁涓嬶紝鏌愪簺寤虹珛緋葷粺鏃墮渶瑕佺殑緇嗚妭涔熷彲鑳戒笉鑳藉叏閮ㄥ緱鍒般傛暣浣撹璁″氨闈復(fù)鐫璁捐涓嶈凍/榪囧垎璁捐鐨勪袱闅懼眬闈€?

    AOP鍩虹

    鍒扮洰鍓嶄負(fù)姝㈢殑璁ㄨ璇存槑妯″潡鍖栨í鍒囧叧娉ㄧ偣鏄湁濂藉鐨勩傜爺絀朵漢鍛樺凡緇忓皾璇曚簡澶氱鏂規(guī)硶鏉ュ疄鐜拌繖涓換鍔★紝榪欎簺鏂規(guī)硶鏈変竴涓叡鍚岀殑涓婚錛氬垎紱誨叧娉ㄧ偣銆侫OP鏄繖浜涙柟娉曚腑鐨勪竴縐嶏紝瀹冪殑鐩殑鏄竻鏅扮殑鍒嗙鍏蟲敞鐐規(guī)潵瑙e喅浠ヤ笂鎻愬埌鐨勯棶棰樸?

    AOP錛屼粠鍏舵湰璐ㄤ笂璁詫紝浣夸綘鍙互鐢ㄤ竴縐嶆澗鏁h﹀悎鐨勬柟寮忔潵瀹炵幇鐙珛鐨勫叧娉ㄧ偣錛岀劧鍚庯紝緇勫悎榪欎簺瀹炵幇鏉ュ緩绔嬫渶緇堢郴緇熴傜敤瀹冩墍寤虹珛鐨勭郴緇熸槸浣跨敤鏉炬暎鑰﹀悎鐨勶紝妯″潡鍖栧疄鐜扮殑妯垏鍏蟲敞鐐規(guī)潵鎼緩鐨勩備笌涔嬪鐓э紝鐢∣OP寤虹珛鐨勭郴緇熷垯鏄敤鏉炬暎鑰﹀悎鐨勬ā鍧楀寲瀹炵幇鐨勪竴鑸叧娉ㄧ偣鏉ュ疄鐜扮殑銆傚湪AOP緇堬紝榪欎簺妯″潡鍖栧崟鍏冨彨鏂歸潰錛坅spect錛夛紝鑰屽湪OOP涓紝榪欎簺涓鑸叧娉ㄧ偣鐨勫疄鐜板崟鍏冨彨鍋氱被銆?

    AOP鍖呮嫭涓変釜娓呮櫚鐨勫紑鍙戞楠わ細(xì)

    • 鏂歸潰鍒嗚В錛氬垎瑙i渶姹傛彁鍙栧嚭妯垏鍏蟲敞鐐瑰拰涓鑸叧娉ㄧ偣銆傚湪榪欎竴姝ラ噷錛屼綘鎶婃牳蹇冩ā鍧楃駭鍏蟲敞鐐瑰拰緋葷粺綰х殑妯垏鍏蟲敞鐐瑰垎紱誨紑鏉ャ傚氨鍓嶉潰鎵鎻愬埌鐨勪俊鐢ㄥ崱渚嬪瓙鏉ヨ錛屼綘鍙互鍒嗚В鍑轟笁涓叧娉ㄧ偣錛氭牳蹇冪殑淇$敤鍗″鐞嗭紝鏃ュ織鍜岄獙璇併?
    • 鍏蟲敞鐐瑰疄鐜幫細(xì)鍚勮嚜鐙珛鐨勫疄鐜拌繖浜涘叧娉ㄧ偣錛岃繕鐢ㄤ笂闈俊鐢ㄥ崱鐨勪緥瀛愶紝浣犺瀹炵幇淇$敤鍗″鐞嗗崟鍏冿紝鏃ュ織鍗曞厓鍜岄獙璇佸崟鍏冦?
    • 鏂歸潰鐨勯噸鏂扮粍鍚堬細(xì)鍦ㄨ繖涓姝ラ噷錛屾柟闈㈤泦鎴愬櫒閫氳繃鍒涘緩涓涓ā鍧楀崟鍏冣斺旀柟闈㈡潵鎸囧畾閲嶇粍鐨勮鍒欍傞噸緇勮繃紼嬧斺斾篃鍙粐鍏ユ垨緇撳悎鈥斺斿垯浣跨敤榪欎簺淇℃伅鏉ユ瀯寤烘渶緇堢郴緇燂紝榪樻嬁淇$敤鍗$殑閭d釜渚嬪瓙錛屼綘鍙互鎸囧畾錛堢敤鏌愮AOP鐨勫疄鐜版墍鎻愪緵鐨勮璦錛夋瘡涓搷浣滅殑寮濮嬪拰緇撴潫闇瑕佺邯褰曪紝騫朵笖姣忎釜鎿嶄綔鍦ㄦ秹鍙?qiáng)鍒颁笟鍔¢昏緫涔嬪墠蹇呴』閫氳繃楠岃瘉銆?




    鍥?3. AOP 寮鍙戠殑姝ラ

    AOP涓嶰OP鐨勪笉鍚屽叧閿湪浜庡畠澶勭悊妯垏鍏蟲敞鐐圭殑鏂瑰紡錛屽湪AOP涓紝姣忎釜鍏蟲敞鐐圭殑瀹炵幇閮戒笉鐭ラ亾鍏跺畠鍏蟲敞鐐規(guī)槸鍚︿細(xì)鈥樺叧娉ㄢ欏畠錛屽淇$敤鍗″鐞嗘ā鍧楀茍涓嶇煡閬撳叾瀹冪殑鍏蟲敞鐐瑰疄鐜版鍦ㄤ負(fù)瀹冨仛鏃ュ織鍜岄獙璇佹搷浣溿傚畠灞曠ず浜嗕竴涓粠OOP杞寲鏉ョ殑寮哄ぇ鐨勫紑鍙戣寖鍨嬨?

    娉ㄦ剰錛氫竴涓狝OP瀹炵幇鍙互鍊熷姪鍏跺畠緙栫▼鑼冨瀷浣滀負(fù)瀹冪殑鍩虹錛屼粠鑰屽師灝佷笉鍔ㄧ殑淇濈暀鍏跺熀紜鑼冨瀷鐨勪紭鐐廣備緥濡傦紝AOP鍙互閫夋嫨OOP浣滀負(fù)瀹冪殑鍩虹鑼冨瀷錛屼粠鑰屾妸OOP鍠勪簬澶勭悊涓鑸叧娉ㄧ偣鐨勫ソ澶勭洿鎺ュ甫榪囨潵銆傜敤榪欐牱涓縐嶅疄鐜幫紝鐙珛鐨勪竴鑸叧娉ㄧ偣鍙互浣跨敤OOP鎶鏈傝繖灝卞儚榪囩▼鍨嬭璦鏄澶歄OP璇█鐨勫熀紜涓鏍楓?

    緇囧叆涓句緥
    緇囧叆鍣ㄢ斺斾竴涓鐞嗗櫒鈥斺旂粍瑁呬竴涓釜鍏蟲敞鐐癸紙榪欎釜榪囩▼鍙仛緇囧叆錛夈傚氨鏄錛屽畠渚濈収鎻愪緵緇欏畠鐨勮鍒欐妸涓嶅悓鐨勬墽琛岄昏緫孌墊販緙栬搗鏉ャ?

    涓轟簡璇存槑浠g爜緇囧叆錛岃鎴戜滑鍥炲埌淇$敤鍗″鐞嗙殑渚嬪瓙錛屼負(fù)浜嗙畝鍗曡搗瑙侊紝鎴戜滑鍙冭檻涓や釜鎿嶄綔錛氬瓨鍏ュ拰鍙栧嚭錛屽茍涓旀垜浠亣璁懼凡緇忔湁浜嗕竴涓悎閫傜殑logger.

    鏉ョ湅涓涓嬩笅闈㈢殑淇$敤鍗℃ā鍧楋細(xì)
    浠g爜:

    public class CreditCardProcessor {
    聽 聽 public void debit(CreditCard card, Currency amount)
    聽 聽 聽 聽throws InvalidCardException, NotEnoughAmountException,
    聽 聽 聽 聽 聽 聽 聽 CardExpiredException {
    聽 聽 聽 聽 // 鍙栧嚭閫昏緫
    聽 聽 }
    聽 聽
    聽 聽 public void credit(CreditCard card, Currency amount)
    聽 聽 聽 聽 throws InvalidCardException {
    聽 聽 聽 聽 // 瀛樺叆閫昏緫

    聽 聽 }
    }


    涓嬮潰鏄棩蹇楁帴鍙?
    浠g爜:

    public interface Logger {
    聽 聽 public void log(String message);
    }


    鎵闇緇勫悎闇瑕佸涓嬬粐鍏ヨ鍒欙紝榪欓噷鐢ㄨ嚜鐒惰璦鏉ヨ〃杈撅紙鏈枃鐨勫悗闈細(xì)鎻愪緵榪欎簺緇囧叆瑙勫垯鐨勭▼搴忕増鏈級錛?
    [list=a]
  • 綰綍姣忎釜鍏叡鎿嶄綔鐨勫紑濮?
  • 綰綍姣忎釜鍏叡鎿嶄綔鐨勭粨鏉?
  • 綰綍鎵鏈夊叕鍏辨柟娉曟姏鍑虹殑寮傚父


緇囧叆鍣ㄥ氨浼?xì)鋴社敤杩欎簺缁囧叆瑙勫垯鍜屽呄x敞鐐瑰疄鐜版潵浜х敓涓庡涓嬩唬鐮佹湁鐩稿悓鏁堟灉鐨勪唬鐮侊細(xì)

浠g爜:
public class CreditCardProcessorWithLogging {
聽 聽 Logger _logger;

聽 聽 public void debit(CreditCard card, Money amount)
聽 聽 聽 聽 throws InvalidCardException, NotEnoughAmountException,
聽 聽 聽 聽 聽 聽 聽 聽CardExpiredException {
聽 聽 聽 聽 _logger.log("Starting CreditCardProcessor.credit(CreditCard,
Money) "
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 + "Card: " + card + " Amount: " + amount);
聽 聽 聽 聽 // 鍙栧嚭閫昏緫
聽 聽 聽 聽 _logger.log("Completing CreditCardProcessor.credit(CreditCard,
Money) "
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 + "Card: " + card + " Amount: " + amount);
聽 聽 }
聽 聽
聽 聽 public void credit(CreditCard card, Money amount)
聽 聽 聽 聽 throws InvalidCardException {
聽 聽 聽 聽 System.out.println("Debiting");
聽 聽 聽 聽 _logger.log("Starting CreditCardProcessor.debit(CreditCard,
Money) "
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 + "Card: " + card + " Amount: " + amount);
聽 聽 聽 聽 // 瀛樺叆閫昏緫
聽 聽 聽 聽 _logger.log("Completing CreditCardProcessor.credit(CreditCard,
Money) "
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 + "Card: " + card + " Amount: " + amount);

聽 聽 }
}


AOP璇█鍓栨瀽

灝卞儚鍏朵粬緙栫▼鑼冨瀷鐨勫疄鐜頒竴鏍鳳紝AOP鐨勫疄鐜版湁涓ら儴鍒嗙粍鎴愶細(xì)璇█瑙勮寖鍜屽疄鐜般傝璦瑙勮寖鎻忚堪浜嗚璦鐨勫熀紜鍗曞厓鍜岃娉曘傝璦瀹炵幇鍒欐寜鐓ц璦瑙勮寖鏉ラ獙璇佷唬鐮佺殑姝g‘鎬у茍鎶婁唬鐮佽漿鎴愮洰鏍囨満鍣ㄧ殑鍙墽琛屽艦寮忋傝繖涓鑺傦紝鎴戞潵瑙i噴涓涓婣OP緇勬垚閮ㄥ垎銆?

AOP璇█瑙勮寖
浠庢娊璞$殑瑙掑害鐪嬫潵錛屼竴縐岮OP璇█瑕佽鏄庝笅闈袱涓柟闈細(xì)

  • 鍏蟲敞鐐圭殑瀹炵幇錛氭妸姣忎釜闇姹傛槧灝勪負(fù)浠g爜錛岀劧鍚庯紝緙栬瘧鍣ㄦ妸瀹冪炕璇戞垚鍙墽琛屼唬鐮侊紝鐢變簬鍏蟲敞鐐圭殑瀹炵幇浠ユ寚瀹氳繃紼嬬殑褰㈠紡鍑虹幇錛屼綘鍙互浣跨敤浼犵粺璇█濡侰錛孋++錛孞ava絳夈?
  • 緇囧叆瑙勫垯瑙勮寖錛氭庢牱鎶婄嫭绔嬪疄鐜扮殑鍏蟲敞鐐圭粍鍚堣搗鏉ュ艦鎴愭渶緇堢郴緇熷憿錛熶負(fù)浜嗚繖涓洰鐨勶紝闇瑕佸緩绔嬩竴縐嶈璦鏉ユ寚瀹氱粍鍚堜笉鍚岀殑瀹炵幇鍗曞厓浠ュ艦鎴愭渶緇堢郴緇熺殑瑙勫垯錛岃繖縐嶆寚瀹氱粐鍏ヨ鍒欑殑璇█鍙互鏄疄鐜拌璦鐨勬墿灞曪紝涔熷彲浠ユ槸涓縐嶅畬鍏ㄤ笉鍚岀殑璇█銆?


AOP璇█鐨勫疄鐜?/span>

AOP鐨勭紪璇戝櫒鎵ц涓ゆ鎿嶄綔錛?

  1. 緇勮鍏蟲敞鐐廣?
  2. 鎶婄粍瑁呯粨鏋滆漿鎴愬彲鎵ц浠g爜

AOP瀹炵幇鍙互鐢ㄥ縐嶆柟寮忓疄鐜扮粐鍏ワ紝鍖呮嫭婧愮爜鍒版簮鐮佺殑杞崲銆傚畠棰勫鐞嗘瘡涓柟闈㈢殑婧愮爜浜х敓緇囧叆榪囩殑婧愮爜錛岀劧鍚庢妸緇囧叆榪囩殑婧愮爜浜ょ粰鍩虹璇█鐨勭紪璇戝櫒浜х敓鏈緇堝彲鎵ц浠g爜銆傛瘮濡傦紝浣跨敤榪欑鏂瑰紡錛屼竴涓熀浜嶫ava鐨凙OP瀹炵幇鍙互鍏堟妸涓嶅悓鐨勬柟闈㈣漿鍖栨垚Java婧愪唬鐮侊紝鐒跺悗璁㎎ava緙栬瘧鍣ㄦ妸瀹冭漿鍖栨垚瀛楄妭鐮併備篃鍙互鐩存帴鍦ㄥ瓧鑺傜爜綰у埆鎵ц緇囧叆錛涙瘯绔燂紝瀛楄妭鐮佹湰韜篃鏄竴縐嶆簮鐮併傛澶栵紝涓嬮潰鐨勬墽琛岀郴緇熲斺擩ava铏氭嫙鏈衡斺斾篃鍙互鏄柟闈㈣鐭ョ殑錛屽熀浜嶫ava鐨凙OP 瀹炵幇濡傛灉浣跨敤榪欑鏂瑰紡鐨勮瘽錛岃櫄鎷熸満鍙互鍏堣鍏ョ粐鍏ヨ鍒欙紝鐒跺悗瀵瑰悗鏉ヨ鍏ョ殑綾婚兘搴旂敤榪欑瑙勫垯錛屼篃灝辨槸璇達(dá)紝瀹冨彲浠ユ墽琛宩ust-in-time鐨勬柟闈㈢粐鍏ャ?

AOP鐨勫ソ澶?/span>

AOP鍙府鍔╂垜浠В鍐充笂闈㈡彁鍒扮殑浠g爜娣蜂貢鍜屼唬鐮佸垎鏁f墍甯︽潵鐨勯棶棰橈紝瀹冭繕鏈変竴浜涘埆鐨勫ソ澶勶細(xì)

  • 鍧楀寲妯垏鍏蟲敞鐐癸細(xì)AOP鐢ㄦ渶灝忕殑鑰﹀悎澶勭悊姣忎釜鍏蟲敞鐐癸紝浣垮緱鍗充嬌鏄í鍒囧叧娉ㄧ偣涔熸槸妯″潡鍖栫殑銆傝繖鏍風(fēng)殑瀹炵幇浜х敓鐨勭郴緇燂紝鍏朵唬鐮佺殑鍐椾綑灝忋傛ā鍧楀寲鐨勫疄鐜拌繕浣垮緱緋葷粺瀹規(guī)槗鐞嗚В鍜岀淮鎶?
  • 緋葷粺瀹規(guī)槗鎵╁睍錛氱敱浜庢柟闈㈡ā鍧楁牴鏈笉鐭ラ亾妯垏鍏蟲敞鐐癸紝鎵浠ュ緢瀹規(guī)槗閫氳繃寤虹珛鏂扮殑鏂歸潰鍔犲叆鏂扮殑鍔熻兘錛屽彟澶栵紝褰撲綘寰緋葷粺涓姞鍏ユ柊鐨勬ā鍧楁椂錛屽凡鏈夌殑鏂歸潰鑷姩鐨勬í鍒囪繘鏉ワ紝浣跨郴緇熺殑鏄撲簬鎵╁睍
  • 璁捐鍐沖畾鐨勮繜緇戝畾錛氳繕璁板緱璁捐甯堢殑涓ら毦灞闈㈠悧錛熶嬌鐢ˋOP,璁捐甯堝彲浠ユ帹榪熶負(fù)灝嗘潵鐨勯渶姹備綔鍐沖畾錛屽洜涓哄畠鍙互鎶婅繖縐嶉渶姹備綔涓虹嫭绔嬬殑鏂歸潰寰堝鏄撶殑瀹炵幇銆?
  • 鏇村ソ鐨勪唬鐮侀噸鐢ㄦэ細(xì)鐢變簬AOP鎶婃瘡涓柟闈㈠疄鐜頒負(fù)鐙珛鐨勬ā鍧楋紝妯″潡涔嬮棿鏄澗鏁h﹀悎鐨勶紝涓句緥鏉ヨ錛屼綘鍙互鐢ㄥ彟澶栦竴涓嫭绔嬬殑鏃ュ織鍐欏叆鍣ㄦ柟闈紙鏇挎崲褰撳墠鐨勶級鎶婃棩蹇楀啓鍏ユ暟鎹簱錛屼互婊¤凍涓嶅悓鐨勬棩蹇楀啓鍏ヨ姹傘?
    鎬葷殑鏉ヨ錛屾澗鏁h﹀悎鐨勫疄鐜版剰鍛崇潃鏇村ソ鐨勪唬鐮侀噸鐢ㄦэ紝 AOP鍦ㄤ嬌緋葷粺瀹炵幇鏉炬暎鑰﹀悎榪欎竴鐐逛笂姣擮OP鍋氬緱鏇村ソ銆?


AspectJ:涓涓狫ava鐨凙OP瀹炵幇

AspectJ鏄竴涓彲鍏嶈垂鑾峰緱鐨勭敱鏂戒箰鍏徃甯曟礇闃垮皵鎵樼爺絀朵腑蹇冿紙Xerox PARC錛夊紑鍙慗ava鐨凙OP瀹炵幇錛屽畠鏄竴涓鍔熻兘鐨勯潰鍚戞柟闈㈢殑Java鎵╁睍銆傚畠浣跨敤Java浣滀負(fù)鍗曚釜鍏蟲敞鐐圭殑瀹炵幇璇█錛屽茍鎵╁睍Java浠ユ寚瀹氱粐鍏ヨ鍒欍傝繖浜涜鍒欐槸鐢ㄥ垏鍏ョ偣錛坧ointcuts錛夈佽仈緇撶偣錛坖oin points錛夛紝閫氱煡錛坅dvice錛夊拰鏂歸潰錛坅spect錛夋潵璇存槑鐨勩傝仈緇撶偣鏄畾涔夊湪紼嬪簭鎵ц榪囩▼涔嬮棿鐨勭偣錛屽垏鍏ョ偣鐢辯敤鏉ユ寚瀹氳仈緇撶偣鐨勮璦鏋勯狅紝閫氱煡瀹氫箟浜嗚鍦ㄥ垏鍏ョ偣涓婃墽琛岀殑浠g爜鐗囷紝鑰屾柟闈㈠垯鏄繖浜涘熀紜鍏冪礌鐨勭粍鍚堛?

鍙﹀錛孉spectJ鍏佽浠ュ縐嶆柟寮忕敤鏂歸潰鍜岀被寤虹珛鏂扮殑鏂歸潰錛屼綘鍙互寮曞叆鏂扮殑鏁版嵁鎴愬憳鍜屾柟娉曪紝鎴栨槸澹版槑涓涓柊鐨勭被鏉ョ戶鎵垮拰瀹炵幇鍙﹀鐨勭被鎴栨帴鍙c?

AspectJ鐨勭粐鍏ュ櫒鈥斺擜spectJ鐨勭紪璇戝櫒鈥斺旇礋璐f妸涓嶅悓鐨勬柟闈㈢粍鍚堝湪涓璧鳳紝鐢變簬鐢盇spectJ緙栬瘧鍣ㄥ緩绔嬬殑鏈緇堢郴緇熸槸綰疛ava瀛楄妭鐮侊紝瀹冨彲浠ヨ繍琛屽湪浠諱綍絎﹀悎Java鏍囧噯鐨勮櫄鎷熸満涓娿傝屼笖錛孉spectJ榪樻彁渚涗簡涓浜涘伐鍏峰璋冭瘯鍣ㄥ拰Java IDE闆嗘垚絳夛紝鎴戝皢浼?xì)鍦ㄦ湰绯诲垪鐨劷W簩銆佷笁閮ㄥ垎璇︾粏璁茶В榪欎簺銆?

涓嬮潰鏄垜鍦ㄤ笂闈㈢敤鑷劧璇█鎻忚堪鐨勬棩蹇楁柟闈㈢殑緇囧叆瑙勫垯鐨凙spectJ瀹炵幇錛岀敱浜庢垜灝嗕細(xì)鍦ㄧ浜岄儴鍒嗚緇嗕粙緇岮spectJ錛屾墍浠ュ鏋滀綘涓嶈兘閫忓交鐨勭湅鎳傚畠鐨勮瘽涔熶笉蹇呮媴蹇冦傚叧閿槸浣犲簲璇ユ敞鎰忓埌淇$敤鍗″鐞嗚繃紼嬫湰韜竴鐐歸兘涓嶇煡閬撴棩蹇楃殑浜嬨?

浠g爜:

public aspect LogCreditCardProcessorOperations {
聽 聽 Logger logger = new StdoutLogger();

聽 聽 pointcut publicOperation():
聽 聽 聽 聽 execution(public * CreditCardProcessor.*(..));

聽 聽 pointcut publicOperationCardAmountArgs(CreditCard card,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽Money amount):
聽 聽 聽 聽 publicOperation() && args(card, amount);

聽 聽 before(CreditCard card, Money amount):
聽 聽 聽 聽 publicOperationCardAmountArgs(card, amount) {
聽 聽 聽 聽 logOperation("Starting",
聽 聽 聽 聽 聽 聽 聽thisjoin point.getSignature().toString(), card, amount);
聽 聽 }

聽 聽 after(CreditCard card, Money amount) returning:
聽 聽 聽 聽 publicOperationCardAmountArgs(card, amount) {
聽 聽 聽 聽 logOperation("Completing",
聽 聽 聽 聽 聽 聽 thisjoin point.getSignature().toString(), card, amount);
聽 聽 }

聽 聽 after (CreditCard card, Money amount) throwing (Exception e):
聽 聽 聽 聽 publicOperationCardAmountArgs(card, amount) {
聽 聽 聽 聽 logOperation("Exception " + e,
聽 聽 聽 聽 聽 聽 thisjoin point.getSignature().toString(), card, amount);
聽 聽 }

聽 聽 private void logOperation(String status, String operation,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 CreditCard card, Money amount) {
聽 聽 聽 聽 logger.log(status + " " + operation +
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽" Card: " + card + " Amount: " + amount);
聽 聽 }
}




鎴戦渶瑕丄OP鍚楋紵

AOP浠呬粎鏄В鍐寵璁′笂鐨勭己鐐瑰悧錛熷湪AOP閲岋紝姣忎釜鍏蟲敞鐐圭殑瀹炵幇鐨勫茍涓嶇煡閬撴槸鍚︽湁鍏跺畠鍏蟲敞鐐瑰叧娉ㄥ畠錛岃繖鏄疉OP鍜孫OP鐨勪富瑕佸尯鍒紝鍦ˋOP閲岋紝緇勫悎鐨勬祦鍚戞槸浠庢í鍒囧叧娉ㄧ偣鍒頒富鍏蟲敞鐐癸紝鑰孫OP鍒欑浉鍙嶏紝浣嗘槸錛孫OP鍙互鍜孉OP寰堝ソ鐨勫叡瀛樸傛瘮濡傦紝浣犲彲浠ヤ嬌鐢ㄤ竴涓販鍏ョ被鏉ュ仛緇勫悎錛屾棦鍙互鐢ˋOP瀹炵幇錛屼篃鍙互鐢∣OP瀹炵幇錛岃繖鍙栧喅浣犲AOP鐨勬帴鍙楃▼搴︺傚湪榪欎袱縐嶆儏鍐典笅錛屽疄鐜版í鍒囧叧娉ㄧ偣鐨勬販鍏ョ被瀹炵幇閮芥棤闇鐭ラ亾瀹冭嚜宸辨槸琚敤鍦ㄧ被涓繕鏄鐢ㄥ湪鏂歸潰涓備婦涓緥瀛愭潵璇達(dá)紝浣犲彲浠ユ妸涓涓棩蹇楀啓鍏ュ櫒鎺ュ彛鐢ㄤ綔鏌愪簺綾葷殑娣峰叆綾繪垨鏄敤浣滀竴涓棩蹇楁柟闈€傚洜鑰岋紝浠嶰OP鍒癆OP鏄笎榪涚殑銆?

浜嗚ВAOP

鍦ㄨ繖綃囨枃绔犻噷錛屼綘鐪嬪埌浜嗘í鍒囧叧緋誨甫鏉ョ殑闂錛岃繖浜涢棶棰樼殑褰撳墠瑙e喅鏂規(guī)硶錛屼互鍙?qiáng)杩欎簺鏂规硶鐨劸~虹偣銆備綘涔熺湅鍒頒簡AOP鏄庢牱鍏嬫湇榪欎簺緙虹偣鐨勩侫OP鐨勭紪紼嬫柟寮忚瘯鍥炬ā鍧楀寲妯垏鍏蟲敞鐐圭殑瀹炵幇錛屾彁渚涗簡涓涓洿濂芥洿蹇殑杞歡寮鍙戞柟寮忋?

濡傛灉浣犵殑緋葷粺涓秹鍙?qiáng)鍒板涓í鍒囧呄x敞鐐癸紝浣犲彲浠ヨ冭檻榪涗竴姝ヤ簡瑙OP,瀹冪殑瀹炵幇錛屽畠鐨勫ソ澶勩侫OP寰堝彲鑳戒細(xì)鏄紪紼嬫柟寮忕殑涓嬩竴涓噷紼嬬銆傝緇х畫鍏蟲敞鏈郴鍒楃殑絎簩銆佺涓夐儴鍒嗐?


鎹曢 2006-10-25 10:06 鍙戣〃璇勮
]]>
Spring AOP涓枃鏁欑▼http://www.tkk7.com/zhhp1314520/articles/Spring_AOP.html鎹曢鎹曢Wed, 25 Oct 2006 02:04:00 GMThttp://www.tkk7.com/zhhp1314520/articles/Spring_AOP.htmlhttp://www.tkk7.com/zhhp1314520/comments/77131.htmlhttp://www.tkk7.com/zhhp1314520/articles/Spring_AOP.html#Feedback0http://www.tkk7.com/zhhp1314520/comments/commentRss/77131.htmlhttp://www.tkk7.com/zhhp1314520/services/trackbacks/77131.html榪欐槸鍦ㄧ綉涓婂彂鐜扮殑涓綃囧叧浜嶴pring AOP緙栫▼鐨勬暀紼嬶紝璇誨畬榪欑瘒鏂囩珷鍚庯紝Spring AOP涓嶅啀闅句互鐞嗚В錛屽洜姝ゆ垜鎶婂畠璇戞垚涓枃錛屾帹鑽愮粰Spring AOP鐨勫垵瀛﹁呫傝繖鏄瘧鏂囩殑閾炬帴銆?

AOP姝e湪鎴愪負(fù)杞歡寮鍙戠殑涓嬩竴涓湥鏉備嬌鐢ˋOP錛屼綘鍙互灝嗗鐞哸spect鐨勪唬鐮佹敞鍏ヤ富紼嬪簭錛岄氬父涓葷▼搴忕殑涓昏鐩殑騫朵笉鍦ㄤ簬澶勭悊榪欎簺aspect銆侫OP鍙互闃叉浠g爜娣蜂貢銆?
涓轟簡鐞嗚ВAOP濡備綍鍋氬埌榪欑偣錛岃冭檻涓涓嬭鏃ュ織鐨勫伐浣溿傛棩蹇楁湰韜笉澶彲鑳芥槸浣犲紑鍙戠殑涓葷▼搴忕殑涓昏浠誨姟銆傚鏋滆兘灝嗏滀笉鍙鐨勨濄侀氱敤鐨勬棩蹇椾唬鐮佹敞鍏ヤ富紼嬪簭涓紝閭h澶氬ソ鍟娿侫OP鍙互甯姪浣犲仛鍒般?
Spring framework鏄緢鏈夊墠閫旂殑AOP鎶鏈備綔涓轟竴縐嶉潪渚電暐鎬х殑錛岃交鍨嬬殑AOP framework錛屼綘鏃犻渶浣跨敤棰勭紪璇戝櫒鎴栧叾浠栫殑鍏冩爣絳撅紝渚垮彲浠ュ湪Java紼嬪簭涓嬌鐢ㄥ畠銆傝繖鎰忓懗鐫寮鍙戝洟闃熼噷鍙渶涓浜鴻瀵逛粯AOP framework錛屽叾浠栦漢榪樻槸璞″線甯鎬竴鏍風(fēng)紪紼嬨?
AOP鏄緢澶氱洿瑙夐毦浠ョ悊瑙g殑鏈鐨勬牴婧愩傚垢榪愮殑鏄紝浣犲彧瑕佺悊瑙d笁涓蹇碉紝灝卞彲浠ョ紪鍐橝OP妯″潡銆傝繖涓変釜姒傚康鏄細(xì)advice錛宲ointcut鍜?advisor銆俛dvice鏄綘鎯沖悜鍒殑紼嬪簭鍐呴儴涓嶅悓鐨勫湴鏂規(guī)敞鍏ョ殑浠g爜銆俻ointcut瀹氫箟浜嗛渶瑕佹敞鍏dvice鐨勪綅緗紝閫氬父鏄煇涓壒瀹氱殑綾葷殑涓涓?public鏂規(guī)硶銆俛dvisor鏄痯ointcut鍜宎dvice鐨勮閰嶅櫒錛屾槸灝哸dvice娉ㄥ叆涓葷▼搴忎腑棰勫畾涔変綅緗殑浠g爜銆?

鏃㈢劧鎴戜滑鐭ラ亾浜嗛渶瑕佷嬌鐢╝dvisor鍚戜富瑕佷唬鐮佷腑娉ㄥ叆鈥滀笉鍙鐨勨漚dvice錛岃鎴戜滑瀹炵幇涓涓猄pring AOP鐨勪緥瀛愩傚湪榪欎釜渚嬪瓙涓紝鎴戜滑灝嗗疄鐜頒竴涓猙efore advice錛岃繖鎰忓懗鐫advice鐨勪唬鐮佸湪琚皟鐢ㄧ殑public鏂規(guī)硶寮濮嬪墠琚墽琛屻備互涓嬫槸榪欎釜before advice鐨勫疄鐜頒唬鐮侊細(xì)

浠g爜:
package com.company.springaop.test;

import java.lang.reflect.Method;
import org.springframework.aop.MethodBeforeAdvice;

public class TestBeforeAdvice implements MethodBeforeAdvice {

聽 public void before(Method m, Object[] args, Object target)
聽 throws Throwable {
聽 聽 System.out.println("Hello world! (by "
聽 聽 聽 聽 + this.getClass().getName()
聽 聽 聽 聽 + ")");
聽 }
}


鎺ュ彛MethodBeforeAdvice鍙湁涓涓柟娉昩efore闇瑕佸疄鐜幫紝瀹冨畾涔変簡advice鐨勫疄鐜般俠efore鏂規(guī)硶鍏辯敤涓変釜鍙傛暟錛屽畠浠彁渚涗簡鐩稿綋涓板瘜鐨勪俊鎭傚弬鏁癕ethod m鏄痑dvice寮濮嬪悗鎵ц鐨勬柟娉曘傛柟娉曞悕縐板彲浠ョ敤浣滃垽鏂槸鍚︽墽琛屼唬鐮佺殑鏉′歡銆侽bject[] args鏄紶緇欒璋冪敤鐨刾ublic鏂規(guī)硶鐨勫弬鏁版暟緇勩傚綋闇瑕佽鏃ュ織鏃訛紝鍙傛暟args鍜岃鎵ц鏂規(guī)硶鐨勫悕縐幫紝閮芥槸闈炲父鏈夌敤鐨勪俊鎭備綘涔熷彲浠ユ敼鍙樹紶緇檓鐨勫弬鏁幫紝浣嗚灝忓績浣跨敤榪欎釜鍔熻兘錛涚紪鍐欐渶鍒濅富紼嬪簭鐨勭▼搴忓憳騫朵笉鐭ラ亾涓葷▼搴忓彲鑳戒細(xì)鍜屼紶鍏ュ弬鏁扮殑鍙戠敓鍐茬獊銆侽bject target鏄墽琛屾柟娉昺瀵硅薄鐨勫紩鐢ㄣ?

鍦ㄤ笅闈㈢殑BeanImpl綾諱腑錛屾瘡涓猵ublic鏂規(guī)硶璋冪敤鍓嶏紝閮戒細(xì)鎵цadvice錛?

浠g爜:
package com.company.springaop.test;

public class BeanImpl implements Bean {

聽 public void theMethod() {
聽 聽 System.out.println(this.getClass().getName()
聽 聽 聽 聽 + "." + new Exception().getStackTrace()[0].getMethodName()
聽 聽 聽 聽 + "()"
聽 聽 聽 聽 + " says HELLO!");
聽 }
}


綾籅eanImpl瀹炵幇浜嗕笅闈㈢殑鎺ュ彛Bean錛?

浠g爜:
package com.company.springaop.test;

public interface Bean {
聽 public void theMethod();
}



铏界劧涓嶆槸蹇呴』浣跨敤鎺ュ彛錛屼絾闈㈠悜鎺ュ彛鑰屼笉鏄潰鍚戝疄鐜扮紪紼嬫槸鑹ソ鐨勭紪紼嬪疄璺碉紝Spring涔熼紦鍔辮繖鏍峰仛銆?

pointcut鍜宎dvice閫氳繃閰嶇疆鏂囦歡鏉ュ疄鐜幫紝鍥犳錛屾帴涓嬫潵浣犲彧闇緙栧啓涓繪柟娉曠殑Java浠g爜錛?
浠g爜:


package com.company.springaop.test;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class Main {

聽 public static void main(String[] args) {
聽 聽 //Read the configuration file
聽 聽 ApplicationContext ctx
聽 聽 聽 聽 = new FileSystemXmlApplicationContext("springconfig.xml");

聽 聽 //Instantiate an object
聽 聽 Bean x = (Bean) ctx.getBean("bean");

聽 聽 //Execute the public method of the bean (the test)
聽 聽 x.theMethod();
聽 }
}



鎴戜滑浠庤鍏ュ拰澶勭悊閰嶇疆鏂囦歡寮濮嬶紝鎺ヤ笅鏉ラ┈涓婅鍒涘緩瀹冦傝繖涓厤緗枃浠跺皢浣滀負(fù)綺樺悎紼嬪簭涓嶅悓閮ㄥ垎鐨勨滆兌姘粹濄傝鍏ュ拰澶勭悊閰嶇疆鏂囦歡鍚庯紝鎴戜滑浼?xì)寰楀堫C竴涓垱寤哄伐鍘俢tx銆備換浣曚竴涓猄pring綆$悊鐨勫璞¢兘蹇呴』閫氳繃榪欎釜宸ュ巶鏉ュ垱寤恒傚璞¢氳繃宸ュ巶鍒涘緩鍚庝究鍙甯鎬嬌鐢ㄣ?

浠呬粎鐢ㄩ厤緗枃浠朵究鍙妸紼嬪簭鐨勬瘡涓閮ㄥ垎緇勮璧鋒潵銆?
浠g爜:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC聽 "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
聽 <!--CONFIG-->
聽 <bean id="bean" class="org.springframework.aop.framework.ProxyFactoryBean">
聽 聽 <property name="proxyInterfaces">
聽 聽 聽 <value>com.company.springaop.test.Bean</value>
聽 聽 </property>
聽 聽 <property name="target">
聽 聽 聽 <ref local="beanTarget"/>
聽 聽 </property>
聽 聽 <property name="interceptorNames">
聽 聽 聽 <list>
聽 聽 聽 聽 <value>theAdvisor</value>
聽 聽 聽 </list>
聽 聽 </property>
聽 </bean>

聽 <!--CLASS-->
聽 <bean id="beanTarget" class="com.company.springaop.test.BeanImpl"/>

聽 <!--ADVISOR-->
聽 <!--Note: An advisor assembles pointcut and advice-->
聽 <bean id="theAdvisor" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
聽 聽 <property name="advice">
聽 聽 聽 <ref local="theBeforeAdvice"/>
聽 聽 </property>
聽 聽 <property name="pattern">
聽 聽 聽 <value>com\.company\.springaop\.test\.Bean\.theMethod</value>
聽 聽 </property>
聽 </bean>

聽 <!--ADVICE-->
聽 <bean id="theBeforeAdvice" class="com.company.springaop.test.TestBeforeAdvice"/>
</beans>


鍥涗釜bean瀹氫箟鐨勬搴忓茍涓嶉噸瑕併傛垜浠幇鍦ㄦ湁浜嗕竴涓猘dvice錛屼竴涓寘鍚簡姝e垯琛ㄨ揪寮弍ointcut鐨刟dvisor錛屼竴涓富紼嬪簭綾誨拰涓涓厤緗ソ鐨勬帴鍙o紝閫氳繃宸ュ巶ctx錛岃繖涓帴鍙h繑鍥炶嚜宸辨湰韜疄鐜扮殑涓涓紩鐢ㄣ?

BeanImpl鍜孴estBeforeAdvice閮芥槸鐩存帴閰嶇疆銆傛垜浠敤涓涓敮涓鐨処D鍒涘緩涓涓猙ean鍏冪礌錛屽茍鎸囧畾浜嗕竴涓疄鐜扮被銆傝繖灝辨槸鍏ㄩ儴鐨勫伐浣溿?

advisor閫氳繃Spring framework鎻愪緵鐨勪竴涓猂egexMethodPointcutAdvisor綾繪潵瀹炵幇銆傛垜浠敤advisor鐨勪竴涓睘鎬ф潵鎸囧畾瀹冩墍闇鐨?advice-bean銆傜浜屼釜灞炴у垯鐢ㄦ鍒欒〃杈懼紡瀹氫箟浜唒ointcut錛岀‘淇濊壇濂界殑鎬ц兘鍜屾槗璇繪с?

鏈鍚庨厤緗殑鏄痓ean錛屽畠鍙互閫氳繃涓涓伐鍘傛潵鍒涘緩銆俠ean鐨勫畾涔夌湅璧鋒潵姣斿疄闄呬笂瑕佸鏉傘俠ean鏄疨roxyFactoryBean鐨勪竴涓疄鐜幫紝瀹冩槸Spring framework鐨勪竴閮ㄥ垎銆傝繖涓猙ean鐨勮涓洪氳繃涓涓嬬殑涓変釜灞炴ф潵瀹氫箟錛?


  • 灞炴roxyInterface瀹氫箟浜嗘帴鍙g被銆?
  • 灞炴arget鎸囧悜鏈湴閰嶇疆鐨勪竴涓猙ean錛岃繖涓猙ean榪斿洖涓涓帴鍙g殑瀹炵幇銆?
  • 灞炴nterceptorNames鏄敮涓鍏佽瀹氫箟涓涓煎垪琛ㄧ殑灞炴с傝繖涓垪琛ㄥ寘鍚墍鏈夐渶瑕佸湪beanTarget涓婃墽琛岀殑advisor銆傛敞鎰忥紝advisor鍒楄〃鐨勬搴忔槸闈炲父閲嶈鐨勩?


Spring宸ュ叿

铏界劧浣犲彲浠ユ墜宸ヤ慨鏀笰nt鏋勫緩鑴氭湰錛屼絾浣跨敤SpringUI錛堣瘧娉細(xì)SpringUI鐜板湪鏄疭pring framework鐨勪竴閮ㄥ垎錛屽茍鏀瑰悕涓簊pring-ide錛夛紝浣跨敤Spring AOP鍙樺緱寰堢畝鍗曪紝鍙鐐圭偣榧犳爣鍗沖彲銆備綘鍙互鎶奡pringUI瀹夎鎴怑clipse鐨勪竴涓猵lug-in銆傜劧鍚庯紝浣犲彧闇鍦ㄤ綘鐨刾roject涓婂彸鍑婚紶鏍囷紝騫墮夋嫨鈥渁dd Spring Project Nature鈥濄傚湪project灞炴т腑錛屼綘鍙互鍦ㄢ淪pring Project鈥濅笅娣誨姞Spring閰嶇疆鏂囦歡銆傚湪緙栬瘧鍓嶆妸涓嬮潰鐨勭被搴撳姞鍏roject錛歛opalliance.jar錛宑ommons- logging.jar錛宩akarta-oro-2.0.7.jar鍜宻pring.jar銆傝繍琛岀▼搴忔椂浣犱細(xì)鐪嬪埌涓嬮潰鐨勪俊鎭細(xì)

... (logging information)
Hello world! (by com.company.springaop.test.TestBeforeAdvice)
com.company.springaop.test.BeanImpl.theMethod() says HELLO!


浼樼偣鍜岀己鐐?/span>

Spring姣旇搗鍏朵粬鐨刦ramework鏇存湁浼樺娍錛屽洜涓洪櫎浜咥OP浠ュ錛屽畠鎻愪緵浜嗘洿澶氬埆鐨勫姛鑳姐備綔涓轟竴涓交鍨媐ramework錛屽畠鍦↗2EE 涓嶅悓鐨勯儴鍒嗛兘鍙互鍙戞尌浣滅敤銆傚洜姝わ紝鍗充嬌涓嶆兂浣跨敤Spring AOP錛屼綘鍙兘榪樻槸鎯充嬌鐢⊿pring銆傚彟涓涓紭鐐規(guī)槸錛孲pring騫朵笉瑕佹眰寮鍙戝洟闃熸墍鏈夌殑浜哄憳閮戒細(xì)鐢ㄥ畠銆傚涔?fàn)Spring搴旇浠嶴pring reference鐨勭涓欏靛紑濮嬨傝浜嗘湰鏂囧悗錛屼綘搴旇鍙互鏇村ソ鍦扮悊瑙pring reference浜嗐係pring鍞竴鐨勭己鐐規(guī)槸緙轟箯鏇村鐨勬枃妗o紝浣嗗畠鐨刴ailing list鏄釜寰堝ソ鐨勮ˉ鍏咃紝鑰屼笖浼?xì)涓嶆柇鍦板嚭鐜版洿澶氱殑鏂囨。銆?/span>

鎹曢 2006-10-25 10:04 鍙戣〃璇勮
]]>
鍏充簬AspectJ 涓殑pointcut 璇硶http://www.tkk7.com/zhhp1314520/articles/AspectJ_pointcut.html鎹曢鎹曢Thu, 19 Oct 2006 09:28:00 GMThttp://www.tkk7.com/zhhp1314520/articles/AspectJ_pointcut.htmlhttp://www.tkk7.com/zhhp1314520/comments/76225.htmlhttp://www.tkk7.com/zhhp1314520/articles/AspectJ_pointcut.html#Feedback0http://www.tkk7.com/zhhp1314520/comments/commentRss/76225.htmlhttp://www.tkk7.com/zhhp1314520/services/trackbacks/76225.html 鍏充簬AspectJ 涓殑pointcut 璇硶 聽聽聽 榪欎袱澶╁繖鐫鐪婣spectJ in Action 涓轟簡琛ヤ竴涓婣OP鐭ヨ瘑銆傜湅浜哠pring 2.0鐨勮鑼冿紝鍏朵腑AOP閮ㄥ垎宸茬粡鍩烘湰铻嶅悎浜咥spectJ錛岀湅鏉ユ湁蹇呰鐪嬩竴鐪婣spectJ浜嗐?br />聽聽 鐪嬩簡寰堝AOP鐨勬枃绔犱簡錛孉OP榪欎袱騫村彂灞曠殑寰堟參錛屾病鏈変粈涔堟柊鎰忥紝鐜板湪鍒板閮芥槸SOA錛孲CA浜嗭紝涓嶈繃鐮旂┒浜嗕竴涓嬶紝瑙夊緱榪樻槸寰堟湁甯姪鐨勩傚挨鍏舵槸澧炲姞緋葷粺鐨勫綰︽у拰妯″潡鐨勭嫭绔嬫ф潵璇達(dá)紝寰堟湁甯姪銆?br />聽聽 褰撶劧錛屽涓滆タ錛屽熀紜寰堥噸瑕併備笅闈㈠氨璇磋AspectJ涓殑鍩烘湰璇硶錛屾湁鍏磋叮鐨勫彲浠ョ湅鐪婣spectJ in Action銆?br />聽聽 鍏堟潵璇磋pointcut錛屼粠瀛楅潰鐨勬剰鎬濊鐨勬槸鍒囬潰鐨勬剰鎬濄備篃灝辨槸妯垏鐨勬椂鍊欙紝浼?xì)鏈夊摢浜涙墽琛岀偣浼?xì)琚瘑鍒傚彧鏈夊厛璇嗗埆浜嗭紝鎵嶈兘鎵ц鐩稿簲鐨凙dvice銆?br />聽聽 鍩烘湰鐨勫畾涔夊涓嬶細(xì)
聽聽
聽聽 public pointcut accountOperations:call(* Account.*(..))
聽聽
聽聽 1.閫氶厤絎﹀拰pointcut 鎿嶄綔絎?br />
  • 聽聽 *聽 琛ㄧず浠諱綍鏁伴噺鐨勫瓧絎︼紝闄や簡(.)
  • 聽聽聽 .. 琛ㄧず浠諱綍鏁伴噺鐨勫瓧絎﹀寘鎷換浣曟暟閲忕殑(.)
  • 聽聽聽聽聽聽 + 鎻忚堪鎸囧畾綾誨瀷鐨勪換浣曞瓙綾繪垨鑰呭瓙鎺ュ彛
聽聽聽 鍚?/span>java涓鏍鳳紝鎻愪緵浜嗕竴鍏冨拰浜屽厓鐨勬潯浠惰〃杈炬搷浣滅銆?br />聽聽聽 涓鍏冩搷浣滅錛?/span>!
聽聽聽聽聽
浜屽厓鎿嶄綔絎︼細(xì)||鍜?/span>&&
聽聽聽聽聽
浼樺厛鏉冨悓java

聽聽聽聽聽 2.
絳懼悕璇硶

綾誨瀷絳懼悕鏍峰紡

涓昏鐨勪緥瀛?
Account聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 綾誨瀷Account
聽聽聽
*Account聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽 聽聽聽聽 浣跨敤Account鍚嶇О緇撴潫鐨勭被鍨嬶紝濡?/span>SavingsAccount鍜?/span>CheckingAccount
聽聽聽
java.*.Date聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 綾誨瀷Date鍦ㄤ換浣曠洿鎺ョ殑java瀛愬寘涓紝濡?/span>java.util.Date鍜?/span>java.sql.Date
聽 聽
java..*聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 浠諱綍鍦?/span>java鍖呮垨鑰呮墍鏈夊瓙鍖呬腑鐨勭被鍨嬶紝濡?/span>java.awt鍜?/span>java.util鎴栬?/span>java.awt.event 鍜?/span>java.util.logging
聽聽聽
javax..*Model+聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 鎵鏈?/span>javax鍖呮垨鑰呭瓙鍖呬腑浠?/span>Model緇撳熬鐨勭被鍨嬪拰鍏舵墍鏈夊瓙綾伙紝濡?/span>TableModel,TreeModel銆?br />聽 錛?/span>vector 聽聽聽聽聽 聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 鎵鏈夐櫎浜?/span>Vector鐨勭被鍨?br />聽 Vector|| Hashtable聽聽聽聽聽聽聽聽聽聽聽聽聽 Vector鎴栬?/span>Hashtable綾誨瀷
java.util.RandomAccess+聽聽聽 瀹炵幇RandomAccess鍜?/span>List鐨勬墍鏈夊瓙綾?/span>
聽聽 && java.util.List+
聽聽
聽聽
鏂規(guī)硶鍜屾瀯閫犲櫒絳懼悕妯″紡

聽 public void Collection.clear()錛?br />聽
鍦–ollection涓悓鏍風(fēng)鍚嶇殑clear鏂規(guī)硶

聽 public void Account.debit(float) throws InsufficientBalanceException錛?br />聽 Account涓悓鏍風(fēng)鍚嶇殑debit鏂規(guī)硶

聽 public void Account.set*(*)
Account涓互set寮澶達(dá)紝騫朵笖鍙湁涓涓弬鏁扮被鍨嬬殑鏂規(guī)硶

聽 public void Account.*()
Account涓墍鏈夌殑娌℃湁鍙傛暟鐨刾ublic void 鏂規(guī)硶

聽 public * Account.*()
聽 Account涓墍鏈夋病鏈夊弬鏁扮殑public 鏂規(guī)硶

聽 public * Account.*(..)
Account涓墍鏈夌殑public 鏂規(guī)硶

聽 * Account.*(..)
Account涓殑鎵鏈夋柟娉曪紝鍖呮嫭private鏂規(guī)硶

聽 !public * Account.*(..)
鎵鏈夌殑闈瀙ublic 鏂規(guī)硶

聽聽 * Account+.*(..)
聽聽
鎵鏈夌殑鏂規(guī)硶錛屽寘鎷瓙綾葷殑鏂規(guī)硶

聽聽 * java.io.Reader.read(..)
聽聽
鎵鏈夌殑read鏂規(guī)硶

聽聽 * java.io.Reader.read(char[],..)
聽聽
鎵鏈変互read(char[])寮濮嬬殑鏂規(guī)硶錛屽寘鎷瑀ead(char[])鍜宺ead(char[],int,int)

聽聽 * javax..*.add*Listener(EventListener+)
聽聽
鍛藉悕浠dd寮濮嬶紝浠istener緇撳熬鐨勬柟娉曪紝鍙傛暟涓負(fù)EventListener鎴栧瓙綾?br />
聽聽 * *.*(..) throws RemoteException
聽聽
鎶涘嚭RemoteException鐨勬墍鏈夋柟娉?/span>

聽聽 鏋勯犲櫒錛屽悓涓婇潰
聽聽 public Account.new()
聽聽
娌℃湁鍙傛暟鐨勬瀯閫犲櫒鏂規(guī)硶

聽聽聽 灞炴х鍚嶆ā寮?/b>
聽聽聽 鍚屾柟娉曚竴鏍鳳紝灞炴т篃鏌ヤ笉澶?br />聽聽聽 * Account.*聽聽
聽聽聽 鎵鏈夌殑Account灞炴?br />
聽聽聽 !public static * banking..*.*
聽聽聽 鎵鏈夌殑闈瀙ublic static 灞炴э紝鍦╞anking鐨勫寘鎴栬呭瓙鍖呬腑
聽聽聽
聽聽聽 3.涓昏鐨刾ointcuts綾誨瀷
聽聽
聽聽聽 鍒嗙被pointcuts
聽聽聽 閬靛驚鐗瑰畾鐨勮娉曠敤浜庢崟鑾鋒瘡涓涓綾葷殑鍙嬌鐢ㄨ繛鎺ョ偣銆?br />聽聽聽 涓昏鐨勭綾伙細(xì)
  • 鏂規(guī)硶鎵ц錛歟xecution(MethodSignature)
  • 鏂規(guī)硶璋冪敤錛歝all(MethodSignature)
  • 鏋勯犲櫒鎵ц錛歟xecution(ConstructorSignature)
  • 鏋勯犲櫒璋冪敤錛歝all(ConstructorSignature)
  • 綾誨垵濮嬪寲錛歴taticinitialization(TypeSignature)
  • 灞炴ц鎿嶄綔錛歡et(FieldSignature)
  • 灞炴у啓鎿嶄綔錛歴et(FieldSignature)
  • 渚嬪澶勭悊鎵ц錛歨andler(TypeSignature)
  • 瀵硅薄鍒濆鍖栵細(xì)initialization(ConstructorSignature)
  • 瀵硅薄棰勫厛鍒濆鍖栵細(xì)preinitialization(ConstructorSignature)
  • Advice鎵ц錛歛dviceexecution()
聽聽 鍩轟簬鎺у埗嫻佺殑pointcuts
聽聽 涓昏鍖呮嫭涓ょ綾誨瀷鐨勬帶鍒舵祦錛?br />聽聽 cflow(Pointcut)錛屾崟鑾鋒墍鏈夌殑榪炴帴鐐瑰湪鎸囧畾鐨勬柟娉曟墽琛屼腑錛屽寘鎷墽琛屾柟娉曟湰韜?br />聽聽 cflowbelow(Pointcut)錛屾崟鑾鋒墍鏈夌殑榪炴帴鐐瑰湪鎸囧畾鐨勬柟娉曟墽琛屼腑錛岄櫎浜嗘墽琛屾柟娉曟湰韜?br />
聽聽 濡備互涓嬬殑渚嬪瓙錛?br />聽聽 cflow(call(* Account.debit(..))
聽聽 鎵鏈夌殑debit鏂規(guī)硶涓殑榪炴帴鐐癸紝鍖呮嫭debit鏂規(guī)硶鏈韓
聽聽 cflowbelow(call(* Account.debit(..))
聽聽 鎵鏈塪ebit鏂規(guī)硶涓殑榪炴帴鐐癸紝闄や簡debit鏂規(guī)硶鏈韓
聽聽 cflow(transactedOperations())
聽聽 鎵鏈夌敱transactedOperations鎹曡幏鐨勮繛鎺ョ偣
聽聽 cflowbelow(execution(Account.new(..))
聽聽 鎵鏈夊湪Account 鏋勯犲櫒涓墽琛岀殑榪炴帴鐐?br />
聽聽 鍩轟簬璇嶆眹緇撴瀯鐨勮繛鎺ョ偣
聽聽 婧愪唬鐮佺墖鏂傦紝濡倃ithin()鍜寃ithincode()
聽聽 within 錛氭崟鑾峰湪鎸囧畾綾繪垨鑰呮柟闈腑鐨勭▼搴忎綋涓殑鎵鏈夎繛鎺ョ偣錛屽寘鎷唴閮ㄧ被銆?br />聽聽 Withincode錛氱敤浜庢崟鑾峰湪鏋勯犲櫒鎴栬呮柟娉曚腑鐨勬墍鏈夎繛鎺ョ偣錛屽寘鎷湪鍏朵腑鐨勬湰鍦扮被

聽聽 鎵ц瀵硅薄榪炴帴鐐?/b>
聽聽 鍖歸厤this,鍜宼arget瀵硅薄錛屼綔涓烘柟娉曡璋冪敤鐨勫璞°?br />聽聽 this(Account)錛屾墍鏈堿ccount鐨勫疄渚嬬殑鎵ц鐐癸紝鍖歸厤鎵鏈夌殑榪炴帴鐐癸紝濡傛柟娉曡皟鐢紝灞炴ц緗紝褰撳墠鐨勬墽琛屽璞′負(fù)Account錛屾垨鑰呭叾瀛愮被銆?br />聽聽 target(Account)錛氬尮閰嶆墍鏈夌殑榪炴帴鐐癸紝鐩爣瀵硅薄涓篈ccount鎴栧叾瀛愮被銆?br />
聽聽 蹇呴』鎵ц鐩稿簲鐨勭被鍨嬶紝涓嶈兘浣跨敤*,鎴栬?.閫氶厤絎︺傚綋鍓嶉潤鎬佹柟娉曪紝涓嶈兘琚尮閰嶃?br />
聽聽 鍦╳ithin()鍜宼his()涓殑鍖哄埆錛?br />聽聽 涓涓槸紼嬪簭浣擄紝鑰屽彟涓涓負(fù)瀵硅薄鎵ц銆?br />
聽聽 鍙傛暟pointcuts
聽聽 鐢ㄤ簬鎹曡幏鍙傛暟綾誨瀷鐨勮繛鎺ョ偣銆?br />聽聽 args(String,..,int)
聽聽 args(RemoteException)

聽聽 鏉′歡媯嫻媝ointcuts
聽聽 if(System.currentTimeMillis()>triggerTime)


聽聽 鍩烘湰鐨勮娉曞氨榪欎簺錛屼笉榪嘇spectJ5 宸茬粡澧炲姞浜嗕笉灝戣娉曪紝涓昏鍏充簬Annotation 鐨勶紝涓嶈繃榪欓儴鍒嗚繕娌℃湁浠旂粏鐮旂┒錛屼互鍚庡啀璁茶В鍚с傚笇鏈涜兘鏈夋墍甯姪


鎹曢 2006-10-19 17:28 鍙戣〃璇勮
]]>
j2ee灝忓簲鐢?/title><link>http://www.tkk7.com/zhhp1314520/articles/j2ee_file_rss_search.html</link><dc:creator>鎹曢</dc:creator><author>鎹曢</author><pubDate>Fri, 13 Oct 2006 02:08:00 GMT</pubDate><guid>http://www.tkk7.com/zhhp1314520/articles/j2ee_file_rss_search.html</guid><wfw:comment>http://www.tkk7.com/zhhp1314520/comments/74927.html</wfw:comment><comments>http://www.tkk7.com/zhhp1314520/articles/j2ee_file_rss_search.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/zhhp1314520/comments/commentRss/74927.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/zhhp1314520/services/trackbacks/74927.html</trackback:ping><description><![CDATA[ <span style="FONT-SIZE: 13px">闄勫姞鍔熻兘 (鐩綍)<br />瀹炵幇鍥劇墖涓婁紶 (鐩綍)<br />銆銆鐢ㄦ埛蹇呴』鑳藉涓婁紶鍥劇墖錛屽洜姝ら渶瑕佹枃浠朵笂浼犵殑鍔熻兘銆傛瘮杈冨父瑙佺殑鏂囦歡涓婁紶緇勪歡鏈塁ommons FileUpload錛?a target="_blank">http://jakarta.apache.org/commons/fileupload/a</a>>錛夊拰COS FileUpload錛?a target="_blank">http://www.servlets.com/cos</a>錛夛紝Spring宸茬粡瀹屽叏闆嗘垚浜嗚繖涓ょ緇勪歡錛岃繖閲屾垜浠夋嫨Commons FileUpload銆?br />銆銆鐢變簬Post涓涓寘鍚枃浠朵笂浼犵殑Form浼?xì)浠ultipart/form-data璇鋒眰鍙戦佺粰鏈嶅姟鍣紝蹇呴』鏄庣‘鍛婅瘔 DispatcherServlet濡備綍澶勭悊MultipartRequest銆傞鍏堝湪dispatcher-servlet.xml涓0鏄庝竴涓?MultipartResolver錛?br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">bean聽</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="multipartResolver"</span><span style="COLOR: #ff0000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽class</span><span style="COLOR: #0000ff">="org.springframework.web.multipart.commons.CommonsMultipartResolver"</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000"><!--</span><span style="COLOR: #008000">聽璁劇疆涓婁紶鏂囦歡鐨勬渶澶у昂瀵鎬負(fù)1MB聽</span><span style="COLOR: #008000">--></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">property聽</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="maxUploadSize"</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">value</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000">1048576</span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">value</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">property</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">bean</span><span style="COLOR: #0000ff">></span></div><br /><br />銆銆榪欐牱涓鏃︽煇涓猂equest鏄竴涓狹ultipartRequest錛屽畠?yōu)兗?xì)棣栧厛琚玀ultipartResolver澶勭悊錛岀劧鍚庡啀杞彂鐩稿簲鐨凜ontroller銆?br />銆銆鍦║ploadImageController涓紝灝咹ttpServletRequest杞瀷涓篗ultipartHttpServletRequest錛屽氨鑳介潪甯告柟渚垮湴寰楀埌鏂囦歡鍚嶅拰鏂囦歡鍐呭錛?br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img id="Codehighlighter1_109_445_Open_Image" onclick="this.style.display='none'; Codehighlighter1_109_445_Open_Text.style.display='none'; Codehighlighter1_109_445_Closed_Image.style.display='inline'; Codehighlighter1_109_445_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_109_445_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_109_445_Closed_Text.style.display='none'; Codehighlighter1_109_445_Open_Image.style.display='inline'; Codehighlighter1_109_445_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">聽ModelAndView聽handleRequest(HttpServletRequest聽request,聽HttpServletResponse聽response)聽</span><span style="COLOR: #0000ff">throws</span><span style="COLOR: #000000">聽Exception聽</span><span id="Codehighlighter1_109_445_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" /></span><span id="Codehighlighter1_109_445_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽杞瀷涓篗ultipartHttpRequest錛?/span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">聽聽聽聽MultipartHttpServletRequest聽multipartRequest聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽(MultipartHttpServletRequest)聽request;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽鑾峰緱鏂囦歡錛?/span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">聽聽聽聽MultipartFile聽file聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽multipartRequest.getFile(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">file</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽鑾峰緱鏂囦歡鍚嶏細(xì)</span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">聽聽聽聽String聽filename聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽file.getOriginalFilename();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽鑾峰緱杈撳叆嫻侊細(xì)</span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">聽聽聽聽InputStream聽input聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽file.getInputStream();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽鍐欏叆鏂囦歡<img src="http://www.tkk7.com/images/dot.gif" /></span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /></span><span style="COLOR: #000000">}</span></span></div><br /><br />鐢熸垚緙╃暐鍥?(鐩綍)<br />銆銆褰撶敤鎴蜂笂浼犱簡鍥劇墖鍚庯紝蹇呴』鐢熸垚緙╃暐鍥句互渚跨敤鎴瘋兘蹇熸祻瑙堛傛垜浠笉闇鍊熷姪絎笁鏂硅蔣浠訛紝JDK鏍囧噯搴撳氨鍖呭惈浜嗗浘鍍忓鐞嗙殑API銆傛垜浠妸涓寮犲浘鐗囨寜姣斾緥緙╂斁鍒?20X120澶у皬錛屼互涓嬫槸鍏抽敭浠g爜錛?br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img id="Codehighlighter1_71_1006_Open_Image" onclick="this.style.display='none'; Codehighlighter1_71_1006_Open_Text.style.display='none'; Codehighlighter1_71_1006_Closed_Image.style.display='inline'; Codehighlighter1_71_1006_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_71_1006_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_71_1006_Closed_Text.style.display='none'; Codehighlighter1_71_1006_Open_Image.style.display='inline'; Codehighlighter1_71_1006_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">聽createPreviewImage(String聽srcFile,聽String聽destFile)聽</span><span id="Codehighlighter1_71_1006_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" /></span><span id="Codehighlighter1_71_1006_Open_Text"><span style="COLOR: #000000">{<br /><img id="Codehighlighter1_81_852_Open_Image" onclick="this.style.display='none'; Codehighlighter1_81_852_Open_Text.style.display='none'; Codehighlighter1_81_852_Closed_Image.style.display='inline'; Codehighlighter1_81_852_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_81_852_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_81_852_Closed_Text.style.display='none'; Codehighlighter1_81_852_Open_Image.style.display='inline'; Codehighlighter1_81_852_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽聽聽</span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000">聽</span><span id="Codehighlighter1_81_852_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" /></span><span id="Codehighlighter1_81_852_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽File聽fi聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽File(srcFile);聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽src</span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽File聽fo聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽File(destFile);聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽dest</span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽BufferedImage聽bis聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽ImageIO.read(fi);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">聽w聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽bis.getWidth();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">聽h聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽bis.getHeight();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">聽scale聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽(</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">)w</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">h;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">聽nw聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽IMAGE_SIZE;聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽final聽int聽IMAGE_SIZE聽=聽120;</span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">聽nh聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽(nw聽</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">聽h)聽</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">聽w;<br /><img id="Codehighlighter1_440_510_Open_Image" onclick="this.style.display='none'; Codehighlighter1_440_510_Open_Text.style.display='none'; Codehighlighter1_440_510_Closed_Image.style.display='inline'; Codehighlighter1_440_510_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_440_510_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_440_510_Closed_Text.style.display='none'; Codehighlighter1_440_510_Open_Image.style.display='inline'; Codehighlighter1_440_510_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(聽nh</span><span style="COLOR: #000000">></span><span style="COLOR: #000000">IMAGE_SIZE聽)聽</span><span id="Codehighlighter1_440_510_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" /></span><span id="Codehighlighter1_440_510_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽nh聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽IMAGE_SIZE;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽nw聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽(nh聽</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">聽w)聽</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">聽h;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽聽聽聽聽}</span></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">聽sx聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽(</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">)nw聽</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">聽w;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">聽sy聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽(</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">)nh聽</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">聽h;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽transform.setToScale(sx,sy);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽AffineTransformOp聽ato聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽AffineTransformOp(transform,聽</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽BufferedImage聽bid聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽BufferedImage(nw,聽nh,聽BufferedImage.TYPE_3BYTE_BGR);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽ato.filter(bis,bid);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽ImageIO.write(bid,聽</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">jpeg</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,聽fo);<br /><img id="Codehighlighter1_873_1004_Open_Image" onclick="this.style.display='none'; Codehighlighter1_873_1004_Open_Text.style.display='none'; Codehighlighter1_873_1004_Closed_Image.style.display='inline'; Codehighlighter1_873_1004_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_873_1004_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_873_1004_Closed_Text.style.display='none'; Codehighlighter1_873_1004_Open_Image.style.display='inline'; Codehighlighter1_873_1004_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽聽聽}</span></span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000">(Exception聽e)聽</span><span id="Codehighlighter1_873_1004_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" /></span><span id="Codehighlighter1_873_1004_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽e.printStackTrace();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">throw</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽RuntimeException(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Failed聽in聽create聽preview聽image.聽Error:聽</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">聽e.getMessage());<br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽}</span></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div><br />瀹炵幇RSS (鐩綍)<br />銆銆RSS鏄竴涓爣鍑嗙殑XML鏂囦歡錛孯ss闃呰鍣ㄥ彲浠ヨ鍙栬繖涓猉ML鏂囦歡鑾峰緱鏂囩珷鐨勪俊鎭紝浣跨敤鎴峰彲浠ラ氳繃Rss闃呰鍣ㄨ岄潪嫻忚鍣ㄩ槄璇籅log錛屾垜浠彧瑕佸姩鎬佺敓鎴愯繖涓猉ML鏂囦歡渚垮彲浠ヤ簡銆俁SSLibJ鏄竴涓笓闂ㄨ鍙栧拰鐢熸垚RSS鐨勫皬宸у疄鐢ㄧ殑Java搴擄紝澶у皬浠?5k錛屽彲浠ヤ粠<a target="_blank">http://sourceforge.net/projects/rsslibj/</a>涓嬭澆rsslibj-1_0RC2.jar鍜屽畠闇瑕佺殑EXMLjar涓や釜鏂囦歡錛岀劧鍚庡鍒跺埌web/WEB-INF/lib/涓嬨?br />銆銆浣跨敤RSSLibJ寮傚父綆鍗曪紝鎴戜滑鍏堣緗ソHttpServletResponse鐨凥eader錛岀劧鍚庨氳繃RSSLibJ杈撳嚭XML鍗沖彲錛?br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">Channel聽channel聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽Channel();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />channel.setDescription(account.getDescription());<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />baseUrl聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽baseUrl.substring(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,聽n);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />channel.setLink(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">http://server-name/home.c?accountId=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">聽accountId);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />channel.setTitle(account.getTitle());<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />List聽articles聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽facade.getArticles(accountId,聽account.getMaxPerPage(),聽</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />Iterator聽it聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽articles.iterator();<br /><img id="Codehighlighter1_355_543_Open_Image" onclick="this.style.display='none'; Codehighlighter1_355_543_Open_Text.style.display='none'; Codehighlighter1_355_543_Closed_Image.style.display='inline'; Codehighlighter1_355_543_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_355_543_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_355_543_Closed_Text.style.display='none'; Codehighlighter1_355_543_Open_Image.style.display='inline'; Codehighlighter1_355_543_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(it.hasNext())聽</span><span id="Codehighlighter1_355_543_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" /></span><span id="Codehighlighter1_355_543_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽Article聽article聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽(Article)it.next();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽channel.addItem(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">http://server-name/article.c?articleId=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">聽article.getArticleId(),<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽article.getSummary(),聽article.getTitle()<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽杈撳嚭xml:</span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">response.setContentType(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">text/xml</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />PrintWriter聽pw聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽response.getWriter();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />pw.print(channel.getFeed(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">rss</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">));<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />pw.close();</span></div><br />瀹炵幇鍏ㄦ枃鎼滅儲 (鐩綍)<br />銆銆鍏ㄦ枃鎼滅儲鑳藉ぇ澶ф柟渚跨敤鎴峰揩閫熸壘鍒頒粬浠笇鏈涚殑鏂囩珷錛屼負(fù)blog澧炲姞涓涓叏鏂囨悳绱㈠姛鑳芥槸闈炲父蹇呰鐨勩傜劧鑰岋紝鍏ㄦ枃鎼滅儲涓嶇瓑浜嶴QL鐨凩IKE璇彞錛屽洜涓哄叧緋繪暟鎹簱鐨勮璁″茍涓嶆槸涓哄叏鏂囨悳绱㈣璁$殑錛屾暟鎹簱绱㈠紩瀵瑰叏鏂囨悳绱㈡棤鏁堬紝鍦ㄤ竴涓嚑鐧句竾鏉¤褰曚腑媯绱IKE 錛?A%錛囧彲鑳戒細(xì)鑰楁椂鍑犲垎閽燂紝榪欐槸涓嶅彲鎺ュ彈鐨勩傚垢榪愮殑鏄紝鎴戜滑鑳戒嬌鐢ㄥ厤璐瑰茍涓斿紑婧愮殑綰疛ava瀹炵幇鐨凩ucene鍏ㄦ枃鎼滅儲寮曟搸錛孡ucene鍙互闈炲父瀹規(guī)槗鍦伴泦鎴愬埌鎴戜滑鐨刡log涓?br />銆銆Lucene涓嶆彁渚涚洿鎺ュ鏂囦歡錛屾暟鎹簱鐨勭儲寮曪紝鍙彁渚涗竴涓珮鎬ц兘鐨勫紩鎿庯紝浣嗘帴鍙e嵈鍑轟漢鎰忔枡鍦扮畝鍗曘傛垜浠彧闇瑕佸叧蹇冧互涓嬪嚑涓畝鍗曠殑鎺ュ彛錛?br />銆銆Document錛氫唬琛↙ucene鏁版嵁搴撶殑涓鏉¤褰曪紝涔熶唬琛ㄦ悳绱㈢殑涓鏉$粨鏋溿?br />銆銆Field錛氫竴涓狣ocument鍖呭惈涓涓垨澶氫釜Field錛岀被浼煎叧緋繪暟鎹簱鐨勫瓧孌點(diǎn)?br />銆銆IndexWriter錛氱敤浜庡垱寤烘柊鐨勭儲寮曪紝涔熷氨鏄悜鏁版嵁搴撴坊鍔犳柊鐨勫彲鎼滅儲鐨勫ぇ孌靛瓧絎︿覆銆?br />銆銆Analyzer錛氬皢瀛楃涓叉媶鍒嗘垚鍗曡瘝錛圱oken錛夛紝涓嶅悓鐨勬枃鏈搴斾笉鍚岀殑Analyzer錛屽HtmlAnalyzer錛孭DFAnalyzer銆?br />銆銆Query錛氬皝瑁呬竴涓煡璇紝鐢ㄤ簬瑙f瀽鐢ㄦ埛杈撳叆銆備緥濡傦紝灝嗏渂ea blog鈥濊В鏋愪負(fù)鈥滃悓鏃跺寘鍚玝ea鍜宐log鐨勬枃绔犫濄?br />銆銆Searcher錛氭悳绱竴涓猀uery錛岀粨鏋滃皢浠its榪斿洖銆?br />銆銆Hits錛氬皝瑁呬竴涓悳绱㈢粨鏋滐紝鍖呭惈Document闆嗗悎錛岃兘闈炲父瀹規(guī)槗鍦拌緭鍑虹粨鏋溿?br />銆銆涓嬩竴姝ワ紝鎴戜滑闇瑕佷負(fù)Article琛ㄧ殑content瀛楁寤虹珛鍏ㄦ枃绱㈠紩銆傞鍏堜負(fù)Lucene鏂板緩涓涓暟鎹簱錛岃娉ㄦ剰榪欎釜鏁版嵁搴撴槸Lucene涓撶敤鐨勶紝鎴戜滑涓嶈兘涔熶笉蹇呯煡閬撳畠鐨勫唴閮ㄧ粨鏋勩侺ucene鐨勬瘡涓暟鎹簱瀵瑰簲涓涓洰褰曪紝鍙渶瑕佹寚瀹氱洰褰曞嵆鍙細(xì)<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">String聽indexDir聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">C:/search/blog</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />IndexWriter聽indexWriter聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽IndexWriter(indexDir,聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽StandardAnalyzer(),聽</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />indexWriter.close();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />銆銆鐒跺悗娣誨姞鏂囩珷錛岃Lucene瀵瑰叾绱㈠紩錛?br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />String聽title聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">鏂囩珷鏍囬</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽浠庢暟鎹簱璇誨彇</span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">String聽content聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">鏂囩珷鍐呭</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽浠庢暟鎹簱璇誨彇<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽鎵撳紑绱㈠紩錛?/span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">IndexWriter聽indexWriter聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽IndexWriter(indexDir,聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽StandardAnalyzer(),聽</span><span style="COLOR: #0000ff">false</span><span style="COLOR: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽娣誨姞涓涓柊璁板綍錛?/span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">Document聽doc聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽Document();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />doc.add(Field.Keyword(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">title</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,聽title));<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />doc.add(Field.Text(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">content</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,聽content));<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽寤虹珛绱㈠紩錛?/span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">indexWriter.addDocument(doc);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽鍏抽棴錛?/span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">indexWriter.close();</span></div><br />銆瑕佹悳绱㈡枃绔犻潪甯哥畝鍗曪細(xì)<br />銆鐒跺悗娣誨姞鏂囩珷錛岃瀵瑰叾绱㈠紩錛?br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">String聽title聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">鏂囩珷鏍囬</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽浠庢暟鎹簱璇誨彇</span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">String聽content聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">鏂囩珷鍐呭</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽浠庢暟鎹簱璇誨彇<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽鎵撳紑绱㈠紩錛?/span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">IndexWriter聽indexWriter聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽IndexWriter(indexDir,聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽StandardAnalyzer(),聽</span><span style="COLOR: #0000ff">false</span><span style="COLOR: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽娣誨姞涓涓柊璁板綍錛?/span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">Document聽doc聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽Document();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />doc.add(Field.Keyword(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">title</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,聽title));<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />doc.add(Field.Text(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">content</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,聽content));<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽寤虹珛绱㈠紩錛?/span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">indexWriter.addDocument(doc);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">聽鍏抽棴錛?/span><span style="COLOR: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">indexWriter.close();</span></div><br />銆銆瑕佹悳绱㈡枃绔犻潪甯哥畝鍗曪細(xì)<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">Searcher聽searcher聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽IndexSearcher(dir);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />Query聽query聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽QueryParser.parse(keyword,聽</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">content</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,聽</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">聽StandardAnalyzer());<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />Hits聽hits聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽searcher.search(query);<br /><img id="Codehighlighter1_173_368_Open_Image" onclick="this.style.display='none'; Codehighlighter1_173_368_Open_Text.style.display='none'; Codehighlighter1_173_368_Closed_Image.style.display='inline'; Codehighlighter1_173_368_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_173_368_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_173_368_Closed_Text.style.display='none'; Codehighlighter1_173_368_Open_Image.style.display='inline'; Codehighlighter1_173_368_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(hits聽</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">)</span><span id="Codehighlighter1_173_368_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" /></span><span id="Codehighlighter1_173_368_Open_Text"><span style="COLOR: #000000">{<br /><img id="Codehighlighter1_216_366_Open_Image" onclick="this.style.display='none'; Codehighlighter1_216_366_Open_Text.style.display='none'; Codehighlighter1_216_366_Closed_Image.style.display='inline'; Codehighlighter1_216_366_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_216_366_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_216_366_Closed_Text.style.display='none'; Codehighlighter1_216_366_Open_Image.style.display='inline'; Codehighlighter1_216_366_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽聽聽</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">聽i聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;i聽</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">聽hits.length();聽i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)</span><span id="Codehighlighter1_216_366_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" /></span><span id="Codehighlighter1_216_366_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽Document聽doc聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽hits.doc(i);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽System.out.println(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">found聽in聽</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">聽doc.get(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">title</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">));<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽聽聽聽聽聽System.out.println(doc.get(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">content</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">));<br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽聽聽}</span></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />searcher.close();</span></div>銆銆鎴戜滑璁捐涓涓狶uceneSearcher綾誨皝瑁呭叏鏂囨悳绱㈠姛鑳斤紝鐢變簬蹇呴』閿佸畾鏁版嵁搴撴墍鍦ㄧ洰褰曪紝鎴戜滑鎶婃暟鎹簱璁懼畾鍦?WEB-INF/search/涓嬶紝紜繚鐢ㄦ埛涓嶈兘璁塊棶錛屽茍涓斿湪閰嶇疆鏂囦歡涓垵濮嬪寲鐩綍錛?br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">bean聽</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="luceneSearcher"</span><span style="COLOR: #ff0000">聽class</span><span style="COLOR: #0000ff">="org.crystalblog.search.LuceneSearcher"</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">property聽</span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="directory"</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">value</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000">/WEB-INF/search/</span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">value</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">property</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">bean</span><span style="COLOR: #0000ff">></span></div><br />鏁堟灉濡備笅錛?br /><br /><br />錛堝浘4錛歴earch錛?br /><br />鍙戦丒mail (鐩綍)<br />銆銆Blog鐢ㄦ埛鍙互璁╃郴緇熷皢鏉ヨ鐢ㄦ埛鐨勭暀璦鍙戦佸埌娉ㄥ唽鐨凟mail鍦板潃錛屼負(fù)浜嗛伩鍏嶄嬌鐢⊿MTP鍙戜俊鏈嶅姟鍣紝鎴戜滑鑷繁鎵嬪姩緙栧啓涓涓猄endMail緇勪歡錛岀洿鎺ラ氳繃SMTP鍗忚灝咵mail鍙戦佸埌鐢ㄦ埛淇$銆?br />銆銆SendMail緇勪歡鍙渶閰嶇疆濂紻NS鏈嶅姟鍣ㄧ殑IP鍦板潃錛屽嵆鍙悜鎸囧畾鐨凟mail淇$鍙戦侀偖浠躲傚茍涓旓紝SendMail浣跨敤緙撳啿闃熷垪鍜屽綰跨▼鍦ㄥ悗鍙板彂閫丒mail錛屼笉浼?xì)涓柇姝e父鐨刉eb鏈嶅姟銆傚叿浣撲唬鐮佽鐪婼endMail.java銆?br /><br />嫻嬭瘯 (鐩綍)<br />銆銆鏈嶅姟鍣ㄩ厤緗負(fù)錛歅4 1.4G錛?12M DDR錛?00M Ethernet錛學(xué)indows XP Professional SP2銆?br />銆銆嫻嬭瘯鏈嶅姟鍣ㄥ垎鍒負(fù)WebLogic Server 8.1錛孴omcat 4.1/5.0錛孯esin 2.1.1銆?br />銆銆嫻嬭瘯鏁版嵁搴撲負(fù)MS SQL Server 2000 SP3銆傚鏋滀綘浣跨敤Oracle鎴栬匘B2錛孧ySQL絳夊叾浠栨暟鎹簱騫舵祴璇曟垚鍔燂紝璇峰皢SQL鍒濆鍖栬剼鏈拰璇︾粏閰嶇疆榪囩▼鍙戜竴浠界粰鎴戯紝璋㈣阿銆?br />銆銆鐢變簬鏃墮棿鏈夐檺錛屾病鏈変綔榪涗竴姝ョ殑璋冧紭銆俉ebLogic Server鍜宨Batis鏈夊緢澶氫紭鍖栭夐」錛岃緇嗛厤緗彲浠ュ弬鑰冪浉鍏蟲枃妗c?br /><br />涓枃鏀寔 (鐩綍)<br />銆銆嫻嬭瘯鍙戠幇錛屼腑鏂囦笉鑳藉湪欏甸潰涓甯告樉紺猴紝涓轟簡鏀寔涓枃錛岄鍏堝湪web.xml鍔犲叆Filter錛岀敤浜庡皢杈撳叆緙栫爜璁劇疆涓篻b2312錛?br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">filter</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000">encodingFilter</span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">filter-class</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000">org.crystalblog.web.filter.EncodingFilter</span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">filter-class</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">init-param</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">param-name</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000">encoding</span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">param-name</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">param-value</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000">gb2312</span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">param-value</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">init-param</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">filter</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">filter-mapping</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000">encodingFilter</span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">url-pattern</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000">/*</span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">url-pattern</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">filter-mapping</span><span style="COLOR: #0000ff">></span></div><br />銆銆鐒跺悗鐢ㄦ枃鏈伐鍏鋒悳绱㈡墍鏈夌殑.htm錛?html錛?properties鏂囦歡錛屽皢鈥渋so-8859-1鈥濇浛鎹負(fù)鈥済b2312鈥濓紝鐜板湪欏甸潰涓枃宸茬粡鑳芥甯告樉紺猴紝浣嗘槸Lucene浠嶄笉鑳芥甯歌В鏋愪腑鏂囷紝鍘熷洜鏄爣鍑嗙殑StandardA?nalyzer鍙兘瑙f瀽鑻辨枃錛屽彲浠ヤ粠緗戜笂涓嬭澆涓涓敮鎸佷腑鏂囩殑 Analyzer銆?/span> <img src ="http://www.tkk7.com/zhhp1314520/aggbug/74927.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/zhhp1314520/" target="_blank">鎹曢</a> 2006-10-13 10:08 <a href="http://www.tkk7.com/zhhp1314520/articles/j2ee_file_rss_search.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Caching the result of methods using Spring and EHCache http://www.tkk7.com/zhhp1314520/articles/Spring_and_EHCache.html鎹曢鎹曢Wed, 11 Oct 2006 03:27:00 GMThttp://www.tkk7.com/zhhp1314520/articles/Spring_and_EHCache.htmlhttp://www.tkk7.com/zhhp1314520/comments/74508.htmlhttp://www.tkk7.com/zhhp1314520/articles/Spring_and_EHCache.html#Feedback0http://www.tkk7.com/zhhp1314520/comments/commentRss/74508.htmlhttp://www.tkk7.com/zhhp1314520/services/trackbacks/74508.html闃呰鍏ㄦ枃

鎹曢 2006-10-11 11:27 鍙戣〃璇勮
]]>
spring+AOP+osCachehttp://www.tkk7.com/zhhp1314520/articles/spring_AOP_osCache.html鎹曢鎹曢Wed, 11 Oct 2006 01:43:00 GMThttp://www.tkk7.com/zhhp1314520/articles/spring_AOP_osCache.htmlhttp://www.tkk7.com/zhhp1314520/comments/74426.htmlhttp://www.tkk7.com/zhhp1314520/articles/spring_AOP_osCache.html#Feedback0http://www.tkk7.com/zhhp1314520/comments/commentRss/74426.htmlhttp://www.tkk7.com/zhhp1314520/services/trackbacks/74426.html Introduction

by:http://opensource.atlassian.com/confluence/spring/display/DISC/AOP+Cache

I've written an AOP interceptor which allows you to specify which methods to cache for Spring beans.
Different cache providers are available: Memory HashMap, EHCache, OSCache (which is clusterable) and SwarmCache.

Example

We start by defining a bookManager object which has one method

public 聽List聽getRelated(Book);

which returns a List of Books that are related to the Book that is specified. This method is ideally suited for caching, since the related books will not change that often.
<bean聽id="bookManager"聽class="com.example.BookManager"/>

Next we define the AOP interceptor which will cache the results. This example will return a cached result (the List of Books) instead of a call to bookManager.getRelated(Book), if the method is called with the same Book argument.

Available implementations of CacheInterceptor are:

  • MemoryCacheInterceptor: a simple in-memory cache that's not meant for production
  • EHCacheInterceptor: uses EHCache from Hibernate and should be configured in ehcache.xml as described in the EHCache documentation.
  • SwarmCacheInterceptor: a clusterable cache implementation
  • OSCacheInterceptor: uses OSCache from OpenSymphony and is the one used in this example

The cache in the example is expired after 15 minutes.聽聽
聽聽聽聽聽

< bean聽 id ="cacheInterceptor"
聽聽聽聽class
="org.springframework.aop.interceptor.cache.OSCacheInterceptor" >
聽聽聽聽
< property聽 name ="refreshPeriods" >
聽聽聽聽聽聽聽聽
< props >
聽聽聽聽聽聽聽聽聽聽聽聽
<!-- 聽Cache聽the聽returned聽related聽books聽for聽15聽minutes聽 -->
聽聽聽聽聽聽聽聽聽聽聽聽
< prop聽 key ="com.example.BookManager@getRelated" > 900 </ prop >
聽聽聽聽聽聽聽聽
</ props >
聽聽聽聽
</ property >
聽聽聽聽
<!-- 聽For聽caches聽not聽defined聽under聽'refreshPeriods',聽use聽this聽value聽 -->
聽聽聽聽
< property聽 name ="defaultRefreshPeriod" >
聽聽聽聽聽聽聽聽
< value > -1 </ value >
聽聽聽聽
</ property >
聽聽聽聽
<!-- 聽Which聽method聽to聽call聽for聽non-standard聽objects聽like聽String,聽Boolean聽or聽Number.
聽This聽method聽should聽be聽a聽simple聽method,聽like聽getId()聽or聽toString(),聽but聽should
聽uniquely聽identify聽the聽object.聽
-->
聽聽聽聽
< property聽 name ="identifiers" >
聽聽聽聽聽聽聽聽
< props >
聽聽聽聽聽聽聽聽聽聽聽聽
<!-- 聽If聽a聽method聽contains聽an聽argument聽com.example.Book,
聽聽聽聽聽聽聽聽聽聽聽聽聽the聽generated聽cache聽key聽contains聽the聽value聽of聽Book.getId()聽
-->
聽聽聽聽聽聽聽聽聽聽聽聽
< prop聽 key ="com.example.Book" > getId </ prop >
聽聽聽聽聽聽聽聽
</ props >
聽聽聽聽
</ property >
</ bean >

聽聽聽聽聽聽

refreshPeriods and defaultRefreshPeriod are properties that are specific for the OSCacheInterceptor. The best way to know how to configure a specific CacheInterceptor implementation is by having a look in the Javadoc (see the project.zip file).

refreshPeriods indicates how long the results will be cached in seconds. So a call to com.example.BookManager.getRelated() will be cached for 900 seconds (15 minutes).
When a method is intercepted that is not defined under refreshPeriods, the value of defaultRefreshPeriod will be used.

In order to be able to identify a call to the method with the same parameter, we use the identifiers property. Here you can list the function that needs to be called in order to get a unique identifier for this class. For each class that is used as an argument for the cached methods, specify the method name (which may not have any parameters). This is a better aproach than using the toString() method, since this method can produce long lines while most of the time a simple identifier is available. So in this example, book.getId() will be used to identify separate Book arguments. There is no need to specify arguments that are primitives (float, int), Strings or Numbers (Float, Integer, ...).

Now we wire the cacheInterceptor to the bookManager bean and we're done! Calls to bookManager.getRelated() will from now on be cached for 15 minutes.
Of course you can add as many beans to the cache as you want.

<!-- 聽An聽advisor聽that聽wraps聽bookManager.getRelated()聽with聽the聽cacheInterceptor聽 -->
< bean聽 id ="bookManagerAdvisor"
聽聽聽聽class
="org.springframework.aop.support.RegexpMethodPointcutAdvisor" >
聽聽聽聽
< property聽 name ="advice" >
聽聽聽聽聽聽聽聽
< ref聽 bean ="cacheInterceptor" />
聽聽聽聽
</ property >
聽聽聽聽
< property聽 name ="patterns" >
聽聽聽聽聽聽聽聽
< list >
聽聽聽聽聽聽聽聽聽聽聽聽
< value > .*getRelated </ value >
聽聽聽聽聽聽聽聽
</ list >
聽聽聽聽
</ property >
</ bean >
< bean聽 id ="bookManagerCacheProxyCreator"
聽聽聽聽class
="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" >
聽聽聽聽
< property聽 name ="beanNames" >
聽聽聽聽聽聽聽聽
< value > bookManager </ value >
聽聽聽聽
</ property >
聽聽聽聽
< property聽 name ="interceptorNames" >
聽聽聽聽聽聽聽聽
< list >
聽聽聽聽聽聽聽聽聽聽聽聽
< value > bookManagerAdvisor </ value >
聽聽聽聽聽聽聽聽
</ list >
聽聽聽聽
</ property >
</ bean >

Versions

The first version was written quite some time ago, but since 2006/03/21 there is a new version 聽(2.0.18).

About

I've used this code already in three projects, but not all implementations of the cache (SwarmCache) are well tested. The code is written in the org.springframework.aop.interceptor.cache package and may be copied/used for free.
This code is written by Pieter Coucke聽for Onthoo.com, but may be used for free. Of course, if the Spring core developers are interested in integrating this, they are free to do so. If you find this code useful or have any remarks, please let me know!

Files

See this XML file聽for a sample configuration.
Eclipse project and source code. More info is available in the javadocs.

聽Related

Caching the result of methods using Spring and EHCache
My AOP cache blog 聽and a post about version聽2.0.18.
Attribute based caching



鎹曢 2006-10-11 09:43 鍙戣〃璇勮
]]>
OSCache浣跨敤鎸囧崡http://www.tkk7.com/zhhp1314520/articles/OSCache.html鎹曢鎹曢Wed, 11 Oct 2006 01:37:00 GMThttp://www.tkk7.com/zhhp1314520/articles/OSCache.htmlhttp://www.tkk7.com/zhhp1314520/comments/74424.htmlhttp://www.tkk7.com/zhhp1314520/articles/OSCache.html#Feedback0http://www.tkk7.com/zhhp1314520/comments/commentRss/74424.htmlhttp://www.tkk7.com/zhhp1314520/services/trackbacks/74424.html聽OSCache鏄綋鍓嶈繍鐢ㄦ渶騫跨殑緙撳瓨鏂規(guī)錛孞Boss,Hibernate,Spring絳夐兘瀵瑰叾鏈夋敮鎸侊紝涓嬮潰綆鍗曚粙緇嶄竴涓婳SCache鐨勯厤緗拰浣跨敤榪囩▼銆?br />1.瀹夎榪囩▼
浠?a >http://www.opensymphony.com/oscache/download.html涓嬭澆鍚堥傜殑OSCache鐗堟湰錛?br />鎴戜笅杞界殑鏄痮scache-2.0.2-full鐗堟湰銆?br />瑙e帇緙╀笅杞界殑鏂囦歡鍒版寚瀹氱洰褰?/p>

浠庤В鍘嬬緝鐩綍鍙栧緱oscache.jar聽 鏂囦歡鏀懼埌聽 /WEB-INF/lib聽 鎴栫浉搴旂被搴撶洰褰暵?鐩綍涓紝
jar鏂囦歡鍚嶅彲鑳藉惈鏈夌増鏈彿鍜岃鐗堟湰鐨勫彂甯冩棩鏈熶俊鎭瓑錛屽oscache-2.0.2-22Jan04.jar

濡傛灉浣犵殑jdk鐗堟湰涓?.3.x,寤鴻鍦╨ib涓姞鍏pache聽 Common聽 Lib聽 鐨刢ommons-collections.jar鍖呫?br />濡俲dk鏄?.4浠ヤ笂鍒欎笉蹇?/p>

浠巗rc鎴杄tc鐩綍鍙栧緱oscache.properties聽 鏂囦歡錛屾斁鍏rc鏍圭洰褰曟垨鍙戝竷鐜鐨?WEB-INF/classes聽 鐩綍
濡備綘闇瑕佸緩绔嬬鐩樼紦瀛橈紝欏諱慨鏀筼scache.properties聽 涓殑cache.path淇℃伅聽 (鍘繪帀鍓嶉潰鐨?娉ㄩ噴)銆?br />win綾昏礬寰勭被浼間負(fù)c:\app\cache
unix綾昏礬寰勭被浼間負(fù)/opt/myapp/cache

鎷瘋礉OSCache鏍囩搴撴枃浠秓scache.tld鍒?WEB-INF/classes鐩綍銆?/p>

鐜板湪浣犵殑搴旂敤鐩綍綾諱技濡備笅錛?br />$WEB_APPLICATIONWEB-INFliboscache.jar
$WEB_APPLICATIONWEB-INFclassesoscache.properties
$WEB_APPLICATIONWEB-INFclassesoscache.tld

灝嗕笅鍒椾唬鐮佸姞鍏eb.xml鏂囦歡涓?br />紼嬪簭浠g爜錛?br /><taglib>
<taglib-uri>oscache</taglib-uri>
<taglib-location>/WEB-INF/classes/oscache.tld</taglib-location>
</taglib>


涓轟簡渚夸簬璋冭瘯鏃ュ織杈撳嚭錛岄』鍔犲叆commons-logging.jar鍜宭og4j-1.2.8.jar鍒板綋鍓嶇被搴撹礬寰勪腑

鍦╯rc鐩綍鍔犲叆涓嬮潰涓や釜鏃ュ織杈撳嚭閰嶇疆鏂囦歡錛?/p>

log4j.properties聽 鏂囦歡鍐呭涓猴細(xì)
紼嬪簭浠g爜錛?br />log4j.rootLogger=DEBUG,stdout,file

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[start]%d{yyyy/MM/dd/ HH:mm:ss}[DATE]%n%p[PRIORITY]%n%x[NDC]%n%t[THREAD] n%c[CATEGORY]%n%m[MESSAGE]%n%n

log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=oscache.log
log4j.appender.file.MaxFileSize=100KB
log4j.appender.file.MaxBackupIndex=5
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[start]%d{yyyy/MM/dd/ HH:mm:ss}[DATE]%n%p[PRIORITY]%n%x[NDC]%n%t[THREAD] n%c[CATEGORY]%n%m[MESSAGE]%n%n

log4j.logger.org.apache.commons=ERROR
log4j.logger.com.opensymphony.oscache.base=INFO

commons-logging.properties 鏂囦歡鍐呭涓?br />org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog


2.oscache.properties聽 鏂囦歡閰嶇疆鍚戝聽

cache.memory
鍊間負(fù)true聽 鎴柭?false聽 錛岄粯璁や負(fù)鍦ㄥ唴瀛樹腑浣滅紦瀛橈紝
濡傝緗負(fù)false錛岄偅cache鍙兘緙撳瓨鍒版暟鎹簱鎴栫‖鐩樹腑錛岄偅cache榪樻湁浠涔堟剰涔夛細(xì)錛?/p>

cache.capacity
緙撳瓨鍏冪礌涓暟

cache.persistence.class
鎸佷箙鍖栫紦瀛樼被錛屽姝ょ被鎵撳紑錛屽垯蹇呴』璁劇疆cache.path淇℃伅

cache.cluster聽 鐩稿叧
涓洪泦緹よ緗俊鎭?br />濡?br />cache.cluster.multicast.ip涓哄箍鎾璉P鍦板潃
cache.cluster.properties涓洪泦緹ゅ睘鎬?/p>


3.OSCache鐨勫熀鏈敤娉?/p>

cache1.jsp聽 鍐呭濡備笅

紼嬪簭浠g爜錛?br /><%@ page import="java.util.*" %>
<%@ taglib uri="oscache" prefix="cache" %>

<html>
<body>

娌℃湁緙撳瓨鐨勬棩鏈? <%= new Date() %><p>
<!--鑷姩鍒鋒柊-->
<cache:cache time="30">
姣?0縐掑埛鏂扮紦瀛樹竴嬈$殑鏃ユ湡: <%= new Date() %>
</cache:cache>
<!--鎵嬪姩鍒鋒柊-->
<cache:cache key="testcache">
鎵嬪姩鍒鋒柊緙撳瓨鐨勬棩鏈? <%= new Date() %> <p>
</cache:cache>
<a href="cache2.jsp">鎵嬪姩鍒鋒柊</a>

</body>
</html>


cache2.jsp聽 鎵ц鎵嬪姩鍒鋒柊欏甸潰濡備笅
<聽 %@聽 taglib聽 uri="oscache"聽 prefix="cache"聽 %聽 >

<html>
<body>

緙撳瓨宸插埛鏂?..<p>

<cache:flush聽 key="testcache"聽 scope="application"/>

<a聽 href="cache1.jsp">榪斿洖</a>

</body>
</html>


浣犱篃鍙互閫氳繃涓嬮潰璇彞瀹氫箟Cache鐨勬湁鏁堣寖鍥?濡備笉瀹氫箟scope,scope榛樿涓篈pplcation
紼嬪簭浠g爜錛?br /><cache:cache time="30" scope="session">
...
</cache:cache>


4.聽 緙撳瓨榪囨護(hù)鍣?CacheFilter聽

浣犲彲浠ュ湪web.xml涓畾涔夌紦瀛樿繃婊ゅ櫒錛屽畾涔夌壒瀹氳祫婧愮殑緙撳瓨銆?br />紼嬪簭浠g爜錛?br /><filter>
<filter-name>CacheFilter</filter-name>
<filter-class>com.opensymphony.oscache.web.filter.CacheFilter</filter-class>
<init-param>
<param-name>time</param-name>
<param-value>60</param-value>
</init-param>
<init-param>
<param-name>scope</param-name>
<param-value>session</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CacheFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>


涓婇潰瀹氫箟灝嗙紦瀛樻墍鏈?jsp欏甸潰錛岀紦瀛樺埛鏂版椂闂翠負(fù)60縐掞紝緙撳瓨浣滅敤鍩熶負(fù)Session

娉ㄦ剰錛孋acheFilter鍙崟鑾稨ttp澶翠負(fù)200鐨勯〉闈㈣姹傦紝鍗沖彧瀵規(guī)棤閿欒璇鋒眰浣滅紦瀛橈紝
鑰屼笉瀵瑰叾浠栬姹傦紙濡?00,404,400錛変綔緙撳瓨澶勭悊


OSCache綆浠?


OSCache鏄疧penSymphony緇勭粐鎻愪緵鐨勪竴涓狫2EE鏋舵瀯涓璚eb搴旂敤灞傜殑緙撳瓨鎶鏈疄鐜扮粍浠訛紝瀹冪殑鍑虹幇瑙e喅浜嗘垜浠潰涓寸殑闂銆?OSCache
鐩墠鏈鏂扮殑紼沖畾鐗堟湰鏄?.0錛屾湰鏂囦腑鐨勪緥瀛愰兘鏄熀浜庤繖涓増鏈殑錛屽鏋滃ぇ瀹惰繍琛屼緥瀛愮殑榪囩▼涓彂鐢熼棶棰橈紝璇烽鍏堢‘璁ゆ槸鍚﹂噰鐢ㄤ簡姝g‘鐨勮蔣浠剁増鏈?

2.1 涓昏鐗瑰緛


1. 鍏煎澶氱鏀寔JSP鐨剋eb鏈嶅姟鍣?

宸茬粡閫氳繃鍏煎嫻嬭瘯鐨剋eb鏈嶅姟鍣ㄥ寘鎷琌rionServer (1.4.0鎴栬呬互涓婄増鏈? 銆丮acromedia JRun (3.0鎴栬呬互涓婄増鏈? 銆丅EA Weblogic (7.x鎴栬呬互涓婄増鏈? 銆両BM Websphere (5.0鐗堟湰)銆丼ilverstream (3.7.4鐗堟湰)銆丆aucho Resin (1.2.3鎴栬呬互涓婄増鏈?銆乀omcat (4.0鎴栬呬互涓婄増鏈? 錛屽叾浠栨敮鎸乻ervlet2.3銆乯sp1.2鐨剋eb鏈嶅姟鍣ㄥ簲璇ラ兘鏄畬鍏ㄥ吋瀹?/font>OSCache
鐨勩?

2. 鍙夌殑緙撳瓨鍖?

浣犲彲浠ヤ嬌鐢ㄥ唴瀛樸佺‖鐩樼┖闂淬佸悓鏃朵嬌鐢ㄥ唴瀛樺拰紜洏鎴栬呮彁渚涜嚜宸辯殑鍏朵粬璧勬簮錛堥渶瑕佽嚜宸辨彁渚涢傞厤鍣級浣滀負(fù)緙撳瓨鍖恒?

浣跨敤鍐呭瓨浣滀負(fù)緙撳瓨鍖哄皢鍙互鎻愪緵鏇村ソ鐨勬ц兘
浣跨敤紜洏浣滀負(fù)緙撳瓨鍖哄彲浠ュ湪鏈嶅姟鍣ㄩ噸璧峰悗榪呴熸仮澶嶇紦瀛樺唴瀹?
鍚屾椂浣跨敤鍐呭瓨鍜岀‖鐩樹綔涓虹紦瀛樺尯鍒欏彲浠ュ噺灝戝鍐呭瓨鐨勫崰鐢?
3. 鐏墊椿鐨勭紦瀛樼郴緇?

OSCache
鏀寔瀵歸儴鍒嗛〉闈㈠唴瀹規(guī)垨鑰呭欏甸潰綰х殑鍝嶅簲鍐呭榪涜緙撳瓨錛岀紪紼嬭呭彲浠ユ牴鎹笉鍚岀殑闇姹傘佷笉鍚岀殑鐜閫夋嫨涓嶅悓鐨勭紦瀛樼駭鍒?

4. 瀹歸敊

鍦ㄤ竴鑸殑web搴旂敤涓紝濡傛灉鏌愪釜欏甸潰闇瑕佸拰鏁版嵁搴撴墦浜ら亾錛岃屽綋瀹㈡埛璇鋒眰鍒拌揪鏃訛紝web搴旂敤鍜屾暟鎹簱涔嬮棿鏃犳硶榪涜浜や簰錛岄偅涔堝皢榪斿洖緇欑敤鎴?緋葷粺鍑洪敊"鎴栬呯被浼肩殑鎻愮ず淇℃伅錛屽鏋滀嬌鐢ㄤ簡
OSCache
鐨勮瘽錛屼綘鍙互浣跨敤緙撳瓨鎻愪緵緇欑敤鎴鳳紝緇欒嚜宸辮耽寰楃淮鎶ょ郴緇熸垨鑰呴噰鍙栧叾浠栬ˉ鏁戠殑鏃墮棿銆?

鍏跺畠鐗規(guī)ц繕鍖呮嫭瀵歸泦緹ょ殑鏀寔銆佺紦瀛樹富鍔ㄥ埛鏂扮瓑鐗規(guī)э紝澶у鍙互鍙傝僌penSymphony緗戠珯涓婄殑鍏朵粬璧勬簮鑾峰彇鏇村鐨勪俊鎭?

3
OSCache
緇勪歡鐨勫畨瑁?


OSCache
鏄竴涓熀浜巜eb搴旂敤鐨勭粍浠訛紝浠栫殑瀹夎宸ヤ綔涓昏鏄web搴旂敤榪涜閰嶇疆錛屽ぇ姒傜殑姝ラ濡備笅錛?

1. 涓嬭澆銆佽В鍘嬬緝
OSCache


璇峰埌
OSCache鐨勪富欏礹ttp://www.opensymphony.com/oscache/download.html涓嬭澆Oscache鐨勬渶鏂扮増鏈紝浣滆呬笅杞界殑鏄?/font>OSCache
鐨勬渶鏂扮ǔ瀹氱増鏈?.0銆?

灝嗕笅杞藉悗鐨勩俍ip鏂囦歡瑙e帇緙╁埌c:\
oscache錛堝悗闈㈢殑绔犺妭涓皢浣跨敤%OSCache
_Home%鏉ヨ〃紺鴻繖涓洰褰曪級鐩綍涓?

2. 鏂板緩绔嬩竴涓獁eb搴旂敤

3. 灝嗕富瑕佺粍浠?
OSCache_Home%\oscache
.jar鏀懼叆WEB-INF\lib鐩綍

4. commons-logging.jar銆乧ommons-collections.jar鐨勫鐞?

OSCache緇勪歡鐢↗akarta Commons Logging鏉ュ鐞嗘棩蹇椾俊鎭紝鎵浠ラ渶瑕乧ommons-logging.jar鐨勬敮鎸侊紝璇峰皢%OSCache
_Home%\lib\core\commons-logging.jar鏀懼叆classpath錛堥氬父鎰忓懗鐫灝嗚繖涓枃浠舵斁鍏EB-INF\lib鐩綍錛?
濡傛灉浣跨敤JDK1.3,璇峰皢%
OSCache
_Home%\lib\core\commons-collections.jar鏀懼叆classpath錛屽鏋滀嬌鐢↗DK1.4鎴栬呬互涓婄増鏈紝鍒欎笉闇瑕佷簡
5. 灝?/font>oscache.properties銆?/font>oscache
.tld鏀懼叆WEB-INF\class鐩綍

%
OSCache_Home%\oscache.properties鍖呭惈浜嗗OSCache
榪愯鐗瑰緛鍊肩殑璁劇疆淇℃伅
%
OSCache_Home%\oscache.tld鍖呭惈浜?/font>OSCache
鎻愪緵鐨勬爣絳懼簱鐨勫畾涔夊唴瀹?
6. 淇敼web.xml鏂囦歡

鍦╳eb.xml鏂囦歡涓鍔犱笅闈㈢殑鍐呭錛屽鍔犲
OSCache
鎻愪緵鐨則aglib鐨勬敮鎸侊細(xì)

<taglib>
<taglib-uri>
oscache
</taglib-uri>
<taglib-location>/WEB-INF/classes/
oscache
.tld</taglib-location>
</taglib>




4 寮濮嬩嬌鐢?/font>OSCache
涓殑緙撳瓨緇勪歡


OSCache
涓寜鐓х紦瀛樿寖鍥寸殑涓嶅悓鍒嗕負(fù)涓ょ涓嶅悓鐨勬柟寮忥細(xì)涓縐嶆槸緙撳瓨JSP欏甸潰涓儴鍒嗘垨鑰呭叏閮ㄥ唴瀹癸紝涓縐嶆槸鍩轟簬鏁翠釜欏甸潰鏂囦歡鐨勭紦瀛樸?

4.1 JSP閮ㄥ垎鍐呭緙撳瓨


4.1.1 Cache-
OSCache
鎻愪緵鐨勭紦瀛樻爣絳?


榪欐槸
OSCache
鎻愪緵鐨勬爣絳懼簱涓渶閲嶈鐨勪竴涓爣絳撅紝鍖呮嫭鍦ㄦ爣絳句腑鐨勫唴瀹瑰皢搴旂敤緙撳瓨鏈哄埗榪涜澶勭悊錛屽鐞嗙殑鏂瑰紡灝嗗彇鍐充簬緙栫▼鑰呭cache鏍囩灞炴х殑璁劇疆銆?

絎竴嬈¤姹傚埌杈炬椂錛屾爣絳句腑鐨勫唴瀹硅澶勭悊騫朵笖緙撳瓨璧鋒潵錛屽綋涓嬩竴涓姹傚埌杈炬椂錛岀紦瀛樼郴緇熶細(xì)媯鏌ヨ繖閮ㄥ垎鍐呭鐨勭紦瀛樻槸鍚﹀凡緇忓け鏁堬紝涓昏鏄互涓嬪嚑欏癸細(xì)

1. 緙撳瓨鏃墮棿瓚呰繃浜哻ache鏍囩璁劇疆鐨則ime鎴栬卍uration灞炴ц瀹氱殑瓚呮椂鏃墮棿
2. cron灞炴ц瀹氱殑鏃墮棿姣旂紦瀛樹俊鎭殑寮濮嬫椂闂存洿鏅?
3. 鏍囩涓紦瀛樼殑鍐呭鍦ㄧ紦瀛樺悗鍙堣閲嶆柊鍒鋒柊榪?
4. 鍏朵粬緙撳瓨瓚呮湡璁懼畾
濡傛灉絎﹀悎涓婇潰鍥涢」涓殑浠諱綍涓欏癸紝琚紦瀛樼殑鍐呭瑙嗕負(fù)宸茬粡澶辨晥錛岃繖鏃惰緙撳瓨鐨勫唴瀹瑰皢琚噸鏂板鐞嗗茍涓旇繑鍥炲鐞嗚繃鍚庣殑淇℃伅錛屽鏋滆緙撳瓨鐨勫唴瀹規(guī)病鏈夊け鏁堬紝閭d箞榪斿洖緇欑敤鎴風(fēng)殑灝嗘槸緙撳瓨涓殑淇℃伅銆?

cache鏍囩鐨勫睘鎬ц鏄?

key - 鏍囪瘑緙撳瓨鍐呭鐨勫叧閿瘝銆傚湪鎸囧畾鐨勪綔鐢ㄨ寖鍥村唴蹇呴』鏄敮涓鐨勩傞粯璁ょ殑key鏄璁塊棶欏甸潰鐨刄RI鍜屽悗闈㈢殑璇鋒眰瀛楃涓層?

浣犲彲浠ュ湪鍚屼竴涓〉闈腑浣跨敤寰堝cache鏍囩鑰屼笉鎸囧畾浠栫殑key灞炴э紝榪欑鎯呭喌涓嬬郴緇熶嬌鐢ㄨ欏甸潰鐨刄RI鍜屽悗闈㈢殑璇鋒眰瀛楃涓詫紝鍙﹀鍐嶈嚜鍔ㄧ粰榪欎簺key澧炲姞涓涓儲寮曞兼潵鍖哄垎榪欎簺緙撳瓨鍐呭銆備絾鏄笉鎺ㄨ崘閲囩敤榪欐牱鐨勬柟寮忋?

scope - 緙撳瓨鍙戠敓浣滅敤鐨勮寖鍥達(dá)紝鍙互鏄痑pplication鎴栬卻ession

time - 緙撳瓨鍐呭鐨勬椂闂存錛屽崟浣嶆槸縐掞紝榛樿鏄?600縐掞紝涔熷氨鏄竴涓皬鏃訛紝濡傛灉璁懼畾涓涓礋鍊鹼紝閭d箞榪欓儴鍒嗚緙撳瓨鐨勫唴瀹瑰皢姘歌繙涓嶈繃鏈熴?

duration - 鎸囧畾緙撳瓨鍐呭澶辨晥鐨勬椂闂達(dá)紝鏄浉瀵箃ime鐨勫彟涓涓夋嫨錛屽彲浠ヤ嬌鐢ㄧ畝鍗曟棩鏈熸牸寮忔垨鑰呯鍚圲SO-8601鐨勬棩鏈熸牸寮忋傚錛歞uration='PT5M' duration='5s'絳?

refresh - false 鎴栬卼rue銆?

濡傛灉refresh灞炴ц緗負(fù)true錛屼笉綆″叾浠栫殑灞炴ф槸鍚︾鍚堟潯浠訛紝榪欓儴鍒嗚緙撳瓨鐨勫唴瀹歸兘灝嗚鏇存柊錛岃繖緇欑紪紼嬭呬竴縐嶉夋嫨錛屽喅瀹氫粈涔堟椂鍊欏繀欏誨埛鏂般?

mode - 濡傛灉緙栫▼鑰呬笉甯屾湜琚紦瀛樼殑鍐呭澧炲姞鍒扮粰鐢ㄦ埛鐨勫搷搴斾腑錛屽彲浠ヨ緗甿ode灞炴т負(fù)"silent"

鍏跺畠鍙敤鐨勫睘鎬ц繕鍖呮嫭錛歝ron 銆乬roups銆乴anguage銆乺efreshpolicyclass銆乺efreshpolicyparam銆?

涓婇潰鐨勮繖浜涘睘鎬у彲浠ュ崟鐙嬌鐢紝涔熷彲浠ユ牴鎹渶瑕佺粍鍚堜嬌鐢紝涓嬮潰鐨勪緥瀛愬皢璁茶В榪欎簺甯哥敤灞炴х殑浣跨敤鏂瑰紡銆?

4.1.2 Cache鏍囩瀹炰緥鍒嗘瀽:


1. 鏈綆鍗曠殑cache鏍囩鐢ㄦ硶

浣跨敤榛樿鐨勫叧閿瓧鏉ユ爣璇哻ache鍐呭錛岃秴鏃舵椂闂存槸榛樿鐨?600縐?

<cache:cache>
<%
//鑷繁鐨凧SP浠g爜鍐呭
%>
</cache:cache>




2. 鐢ㄨ嚜宸辨寚瀹氱殑瀛楃涓叉爣璇嗙紦瀛樺唴瀹癸紝騫朵笖璁懼畾浣滅敤鑼冨洿涓簊ession銆?

<cache:cache key="foobar" scope="session">
<%
//鑷繁鐨凧SP浠g爜鍐呭
%>
</cache:cache>
3.鍔ㄦ佽瀹歬ey鍊鹼紝浣跨敤鑷繁鎸囧畾鐨則ime灞炴ц瀹氱紦瀛樺唴瀹圭殑瓚呮椂鏃墮棿錛屼嬌鐢ㄥ姩鎬乺efresh鍊煎喅瀹氭槸鍚﹀己鍒跺唴瀹瑰埛鏂般?

鍥犱負(fù)
OSCache
浣跨敤key鍊兼潵鏍囪瘑緙撳瓨鍐呭錛屼嬌鐢ㄧ浉鍚岀殑key鍊煎皢浼?xì)琚湄?fù)浣跨敤鐩稿悓鐨勭殑緙撳瓨鍐呭錛屾墍浠ヤ嬌鐢ㄥ姩鎬佺殑key鍊煎彲浠ヨ嚜鐢辯殑鏍規(guī)嵁涓嶅悓鐨勮鑹層佷笉鍚岀殑瑕佹眰鍐沖畾浣跨敤涓嶅悓鐨勭紦瀛樺唴瀹廣?

<cache:cache key="<%= product.getId() %>" time="1800" refresh="<%= needRefresh %>">
<%
//鑷繁鐨凧SP浠g爜鍐呭
%>
</cache:cache>




4. 璁劇疆time灞炴т負(fù)璐熸暟浣跨紦瀛樺唴瀹規(guī)案涓嶈繃鏈?

<cache:cache time="-1">
<%
//鑷繁鐨凧SP浠g爜鍐呭
%>




5. 浣跨敤duration灞炴ц緗秴鏈熸椂闂?

<cache:cache duration='PT5M'>
<%
//鑷繁鐨凧SP浠g爜鍐呭
%>




6. 浣跨敤mode灞炴т嬌琚紦瀛樼殑鍐呭涓嶅姞鍏ョ粰瀹㈡埛鐨勫搷搴斾腑

<cache:cache mode='silent'>
<%
//鑷繁鐨凧SP浠g爜鍐呭
%>




4.2 鐢–ashFilter瀹炵幇欏甸潰綰х紦瀛?


鍦?/font>OSCache
緇勪歡涓彁渚涗簡涓涓狢acheFilter鐢ㄤ簬瀹炵幇欏甸潰綰х殑緙撳瓨錛屼富瑕佺敤浜庡web搴旂敤涓殑鏌愪簺鍔ㄦ侀〉闈㈣繘琛岀紦瀛橈紝灝ゅ叾鏄偅浜涢渶瑕佺敓鎴恜df鏍煎紡鏂囦歡/鎶ヨ〃銆佸浘鐗囨枃浠剁瓑鐨勯〉闈紝涓嶄粎鍑忓皯浜嗘暟鎹簱鐨勪氦浜掋佸噺灝戞暟鎹簱鏈嶅姟鍣ㄧ殑鍘嬪姏錛岃屼笖瀵逛簬鍑忓皯web鏈嶅姟鍣ㄧ殑鎬ц兘娑堣楁湁寰堟樉钁楃殑鏁堟灉銆?

榪欑鍔熻兘鐨勫疄鐜版槸閫氳繃鍦╳eb.xml涓繘琛岄厤緗潵鍐沖畾緙撳瓨鍝竴涓垨鑰呬竴緇勯〉闈紝鑰屼笖榪樺彲浠ヨ緗紦瀛樼殑鐩稿叧灞炴э紝榪欑鍩轟簬閰嶇疆鏂囦歡鐨勫疄鐜版柟寮忓浜嶫2EE鏉ヨ搴旇鏄竴縐嶆爣鍑嗙殑瀹炵幇鏂瑰紡浜嗐?

[娉╙ 鍙湁瀹㈡埛璁塊棶鏃惰繑鍥瀐ttp澶翠俊鎭腑浠g爜涓?00錛堜篃灝辨槸璁塊棶宸茬粡鎴愬姛錛夌殑欏甸潰淇℃伅鎵嶈兘澶熻緙撳瓨

1. 緙撳瓨鍗曚釜鏂囦歡

淇敼web.xml錛屽鍔犲涓嬪唴瀹癸紝紜畾瀵?testContent.jsp欏甸潰榪涜緙撳瓨銆?

<filter>
<filter-name>CacheFilter</filter-name>
<filter-class>com.opensymphony.
oscache
.web.filter.CacheFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CacheFilter</filter-name>
<!-瀵?testContent.jsp欏甸潰鍐呭榪涜緙撳瓨-->
<url-pattern>/testContent.jsp</url-pattern>
</filter-mapping>




2. 緙撳瓨URL pattern

淇敼web.xml錛屽鍔犲涓嬪唴瀹癸紝紜畾瀵?.jsp欏甸潰榪涜緙撳瓨銆?

<filter>
<filter-name>CacheFilter</filter-name>
<filter-class>com.opensymphony.
oscache
.web.filter.CacheFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CacheFilter</filter-name>
<!-瀵規(guī)墍鏈塲sp欏甸潰鍐呭榪涜緙撳瓨-->
<url-pattern>*.jsp</url-pattern>
</filter-mapping>




3. 鑷繁璁懼畾緙撳瓨灞炴?

鍦ㄩ〉闈㈢駭緙撳瓨鐨勬儏鍐典笅錛屽彲浠ラ氳繃璁劇疆CacheFilter鐨勫垵濮嬪睘鎬ф潵鍐沖畾緙撳瓨鐨勪竴浜涚壒鎬э細(xì)time灞炴ц緗紦瀛樼殑鏃墮棿孌碉紝榛樿涓?600縐掞紝鍙互鏍規(guī)嵁鑷繁鐨勯渶瑕佸彧鏈夌殑璁劇疆錛岃宻cope灞炴ц緗紝榛樿涓篴pplication錛屽彲閫夐」鍖呮嫭application銆乻ession

<filter>
<filter-name>CacheFilter</filter-name>
<filter-class>com.opensymphony.
oscache
.web.filter.CacheFilter</filter-class>
<init-param>
<param-name>time</param-name>
<param-value>600</param-value>
</init-param>
<init-param>
<param-name>scope</param-name>
<param-value>session</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CacheFilter</filter-name>
<!-瀵規(guī)墍鏈塲sp欏甸潰鍐呭榪涜緙撳瓨-->
<url-pattern>*.jsp</url-pattern>
</filter-mapping>





鎹曢 2006-10-11 09:37 鍙戣〃璇勮
]]>
J2EE For Weblogic寮鍙戜腑Weblogic.xml鏂囦歡鐨勯厤緗?/title><link>http://www.tkk7.com/zhhp1314520/articles/Weblogic_deploy.html</link><dc:creator>鎹曢</dc:creator><author>鎹曢</author><pubDate>Wed, 11 Oct 2006 01:29:00 GMT</pubDate><guid>http://www.tkk7.com/zhhp1314520/articles/Weblogic_deploy.html</guid><wfw:comment>http://www.tkk7.com/zhhp1314520/comments/74423.html</wfw:comment><comments>http://www.tkk7.com/zhhp1314520/articles/Weblogic_deploy.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/zhhp1314520/comments/commentRss/74423.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/zhhp1314520/services/trackbacks/74423.html</trackback:ping><description><![CDATA[ <p>聽聽聽聽聽聽weblogic Server鍏佽閫氳繃璁劇疆weblogic搴旂敤紼嬪簭鎵╁睍鎻忚堪絎︼紙weblogic.xml錛夐厤緗甹sp瀹瑰櫒錛?br />璇ユ枃浠墮氬父浣嶄簬web搴旂敤紼嬪簭鐨剋eb-inf鐩綍涓嬨備竴鑸笉閫氳繃淇敼weblogic鏂囦歡鐩存帴閰嶇疆錛?br />鑰屾槸閫氳繃鎺у埗鍙伴厤緗鏂囦歡錛屽湪Deploments-->web Application-->defaultWebApp涓厤緗?br />鍙湪寮鍙戝拰鐢熶駭鐜涓厤緗笉鍚岀殑淇℃伅銆?br />涓昏閰嶇疆淇℃伅錛?br />compilerSupportsEncoding //true錛嶏紞鏀寔浣跨敤瀛楃闆?br />encoding //鎸囧畾jsp鏂囦歡鐨勯粯璁ゅ瓧絎﹂泦錛屽gb2312錛?br />vervose //鏄惁灝嗚皟璇曚俊鎭緭鍑哄埌嫻忚鍣ㄥ拰鏃ュ織錛?br />keepgenerated //鏄惁璁╃紪璇慾sp鏂囦歡浜х敓鐨?java鏂囦歡鎸佺畫瀛樺湪錛?br />Page Check Seconds //姝f暟錛嶏紞鍦ㄤ互縐掍負(fù)鍗曚綅鐨勬椂闂撮棿闅旀鏌sp鏂囦歡鏄惁鍙戠敓浜嗕慨鏀癸紝濡傛灉鏄垯閲嶆柊緙栬瘧錛?br />聽聽聽聽聽聽聽聽聽聽 0錛嶏紞鍦ㄦ瘡涓涓姹傛鏌sp;<br />聽聽聽聽聽聽聽聽聽聽 -1錛嶏紞涓嶅jsp鏂囦歡榪涜媯鏌ャ?br />Precompile //true錛嶏紞鍦╳eblogic鏈嶅姟鍣ㄥ惎鍔ㄦ椂鑷姩緙栬瘧鎵鏈夌殑jsp銆?br />Debug Enable //true錛嶏紞鏄惁鍏佽璋冭瘯銆?br /><br />Weblogic .xml<br /></p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff"><?</span> <span style="COLOR: #ff00ff">xml聽version="1.0"聽encoding="GB2312"</span> <span style="COLOR: #0000ff">?></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"><!</span> <span style="COLOR: #ff00ff">DOCTYPE聽weblogic-web-app聽PUBLIC聽"-//BEA聽Systems,聽Inc.//DTD聽Web聽Application聽8.1//EN"聽"http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd"</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">weblogic-web-app</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span> <span style="COLOR: #008000"><!--</span> <span style="COLOR: #008000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽涓簑eb.xml鎵瀹氫箟瑙掕壊璧嬪?br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽濡傛灉鏄疻eblogic聽8.1聽SP2聽鎴栬呬箣鍓嶇殑鐗堟湰錛屽彲浠ヤ笉瀹氫箟security-role-assignment<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽濡傛灉鏄疭P3錛屽繀欏繪墜宸ユ坊鍔犳墍鏈塸rincipal錛堣鑹叉垨瑙掕壊緇勶級錛?br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽璇︾粏浠嬬粛璇峰弬鑰兟燩AFA3寮鍙戣璁℃寚鍗椔犳枃妗B犮?br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽</span> <span style="COLOR: #008000">--></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">security-role-assignment</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000"><!--</span> <span style="COLOR: #008000">聽role-name聽蹇呴』璺焪eb.xml涓璼ecurity-role鏍囪涓嬬殑role-name鍙栧肩浉鍚屄?/span> <span style="COLOR: #008000">--></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">role-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">pafaDemoUser</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">role-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000"><!--</span> <span style="COLOR: #008000">聽principal-name聽蹇呴』鏄疷M涓畾涔夌殑瑙掕壊鎴栬呰鑹茬粍錛屼笉鑳芥槸鐢ㄦ埛聽</span> <span style="COLOR: #008000">--></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">principal-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">r_usermanager_rm_user</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">principal-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">principal-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">p_g_rmtest03_myopr</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">principal-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">聽聽聽聽<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">principal-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">Administrators</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">principal-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">聽聽聽聽<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">security-role-assignment</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">jsp-descriptor</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">jsp-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">pageCheckSeconds</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">1</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">jsp-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">jsp-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">compilerSupportsEncoding</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">true</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">jsp-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">jsp-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">encoding</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">GB2312</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">jsp-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">jsp-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">verbose</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">true</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">jsp-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">jsp-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">printNulls</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">false</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">jsp-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">jsp-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">keepgenerated</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">true</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">jsp-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">jsp-descriptor</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">weblogic-web-app</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <img src ="http://www.tkk7.com/zhhp1314520/aggbug/74423.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/zhhp1314520/" target="_blank">鎹曢</a> 2006-10-11 09:29 <a href="http://www.tkk7.com/zhhp1314520/articles/Weblogic_deploy.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://szyxfhm.com" target="_blank">日本免费v片一二三区</a>| <a href="http://8222se.com" target="_blank">亚洲天堂中文字幕</a>| <a href="http://42329c.com" target="_blank">中文精品人人永久免费</a>| <a href="http://manghuo365.com" target="_blank">亚洲精品免费在线视频</a>| <a href="http://gzqhit.com" target="_blank">亚洲国产精品无码AAA片</a>| <a href="http://meijibear.com" target="_blank">亚洲国产一区视频</a>| <a href="http://773311h.com" target="_blank">国产成人免费在线</a>| <a href="http://aqddv.com" target="_blank">h视频免费高清在线观看</a>| <a href="http://mabaolu.com" target="_blank">国产91成人精品亚洲精品</a>| <a href="http://591se591se.com" target="_blank">亚洲人成无码网站在线观看</a>| <a href="http://5ggy.com" target="_blank">亚洲午夜无码毛片av久久京东热</a>| <a href="http://se988.com" target="_blank">久久精品国产亚洲AV久</a>| <a href="http://vinsotec.com" target="_blank">亚洲欧洲高清有无</a>| <a href="http://778002.com" target="_blank">亚洲人成网77777亚洲色</a>| <a href="http://54vpn.com" target="_blank">久久国产成人亚洲精品影院</a>| <a href="http://8xk7u9.com" target="_blank">亚洲愉拍99热成人精品热久久</a>| <a href="http://57gt.com" target="_blank">精品国产亚洲男女在线线电影 </a>| <a href="http://2222jjjj.com" target="_blank">久久精品免费观看</a>| <a href="http://guanxianedu.com" target="_blank">亚洲国产AV无码一区二区三区</a>| <a href="http://kanzhelu23.com" target="_blank">亚洲国产精品99久久久久久</a>| <a href="http://18yinren.com" target="_blank">国产亚洲美女精品久久久久</a>| <a href="http://bohaolg.com" target="_blank">搜日本一区二区三区免费高清视频</a>| <a href="http://ywzms.com" target="_blank">国产精品免费久久久久久久久 </a>| <a href="http://xxnxgay.com" target="_blank">一个人看的免费视频www在线高清动漫</a>| <a href="http://www222yy.com" target="_blank">九九视频高清视频免费观看</a>| <a href="http://sztsa.com" target="_blank">国产成人AV免费观看</a>| <a href="http://gs168sz.com" target="_blank">免费a级毛片无码a∨免费软件</a>| <a href="http://9898vip.com" target="_blank">免费无码一区二区三区 </a>| <a href="http://yy6090qpgdy.com" target="_blank">亚洲欧洲国产成人精品</a>| <a href="http://gzweida88.com" target="_blank">亚洲无成人网77777</a>| <a href="http://kkxzz.com" target="_blank">亚洲国产成人手机在线电影bd</a>| <a href="http://240842.com" target="_blank">亚洲熟女综合色一区二区三区</a>| <a href="http://chinacry.com" target="_blank">老司机免费午夜精品视频</a>| <a href="http://342030.com" target="_blank">香蕉视频免费在线播放</a>| <a href="http://011107.com" target="_blank">jizz中国免费</a>| <a href="http://57798b.com" target="_blank">APP在线免费观看视频</a>| <a href="http://87fulitv.com" target="_blank">午夜精品一区二区三区免费视频</a>| <a href="http://5222133.com" target="_blank">亚洲高清中文字幕免费</a>| <a href="http://shmtweld.com" target="_blank">四虎影视大全免费入口</a>| <a href="http://lanchenews.com" target="_blank">国产99视频精品免费视频7</a>| <a href="http://lai228.com" target="_blank">亚洲色偷偷综合亚洲AV伊人</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>