锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲日韩在线视频,www.亚洲一区,中文字幕亚洲免费无线观看日本http://www.tkk7.com/youngturk/archive/2016/08/09/431509.htmlyoungturkyoungturkTue, 09 Aug 2016 09:49:00 GMThttp://www.tkk7.com/youngturk/archive/2016/08/09/431509.htmlhttp://www.tkk7.com/youngturk/comments/431509.htmlhttp://www.tkk7.com/youngturk/archive/2016/08/09/431509.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/431509.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/431509.html
//瀹炵幇鍘嬬緝鏂囦歡鍔熻兘錛岄噰鐢?/span>commons-io-2.0.1.jar 錛?/span>commons-compress-1.5.jar鎻掍歡
        final OutputStream out = new FileOutputStream("D:/EDI/EDi.zip");  //瀹炰緥鏂囦歡杈撳嚭嫻?/span>
        ArchiveOutputStream os = new ArchiveStreamFactory().createArchiveOutputStream(ArchiveStreamFactory.ZIP, out);  
        //瀹炰緥鍖栧瓨妗h緭鍑烘祦錛屽伐鍘傛柟娉曞垱寤簔ip鐨勫瓨妗h緭鍑烘祦
//        File f1 = new File(file.getPath());
        os.putArchiveEntry(new ZipArchiveEntry(file.getName()));  //鐢熸垚瀛樻。鏂囦歡鍚?/span>
        IOUtils.copy(new FileInputStream(file), os);  //娣誨姞鎷瘋礉瀛樻。鏂囦歡
        
        os.closeArchiveEntry();  
        os.close();  
        
        //*************************
        try {
            File input = new File("D:/EDI/EDi.zip");//鑾峰緱涓嬭澆鏂囦歡璺緞
            contentType="application/octet-stream";
            docStream = new FileInputStream(input);//鑾峰緱杈撳叆嫻佸悕縐?/span>
            contentDisposition =URLEncoder.encode(input.getName() ,"UTF-8");
           } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
           }  
           return "download";
WEBWORK鐨勬枃浠朵笅杞芥満鍒躲備嬌鐢ㄨ搗鏉ヨ繕鏄瘮杈冪畝鍗曠殑銆?/span>
涓嬮潰鏄敤娉曡鏄庯細
棣栧厛鍦ㄤ竴涓狝CTION涓紝濡傛灉鍒ゆ柇鏈夋潈闄愯繘琛屾枃浠朵笅杞姐?/span>
鍒欙細
1銆佽鍑鴻涓嬭澆鏂囦歡錛屽茍鐢熸垚涓涓祦銆?鏂囦歡鍚嶅簲褰撲粠璇鋒眰鐨剅equest涓鍑猴紝鎴栦粠鐢ㄦ埛鐨勮〃涓彇鍑恒?/span>
public String downLoadFile(String fileName){
   try {
    File input = new File("e:/engilish literature.doc");
    docStream = new FileInputStream(input);
    contentDisposition = "test.txt";
   } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }  
   return "download";
}
2銆佸皢杈撳嚭瀵煎悜鍒頒竴涓壒孌婄殑RESULT涓幓銆傚彨鍋歋team Result銆?/span>
         <action name="register" class="com.job2easy.web.user.RegisterAction">
             <result name="success" type="dispatcher">
                 <param name="location">/home/register-result.jsp</param>
             </result>
             <result name="input">
                 <param name="location">/home/register.jsp</param>
             </result>
             <result name="download" type="stream">
                 <param name="contentType">application/x-msdownload</param>
                 <param name="inputName">docStream</param>
                 <param name="bufferSize">1024</param>              
                 <param name="contentDisposition">attachment;filename="${contentDisposition}"</param>
             </result>

             <interceptor-ref name="params"/>
         </action>
3銆佽繖涓棿鏈夊嚑涓弬鏁伴渶瑕侀厤緗細
     contentType璁炬垚 application/x-msdownload 灝卞彲浠ャ傝繖鏍鋒祻瑙堝櫒浼氫繚璇佸脊鍑轟竴涓笅杞芥枃浠剁殑瀵硅瘽妗嗐?/span>
    inputName 榪欎釜姣旇緝閲嶈錛岃繖涓悕瀛楁槸杈撳叆嫻佺殑鍚嶇О錛?浠ュ悗瑕乻team result鐨勫疄鐜扮被涓負鏍規嵁OGNL鐨勮〃杈懼紡鍘繪煡鎵劇殑銆?/span>
    contentDisposition 榪欎釜鏄笅杞戒箣鍚庯紝淇濆瓨鍦ㄧ敤鎴風鐨勬枃浠跺悕縐般?span style="color: #ff0000;">${contentDisposition} 鐪嬩竴涓嬩唬鐮併傚鏋滃啓鎴愪笂榪扮殑鏂瑰紡錛屽氨鏈夋満浼氬湪ACTION涓緗枃浠跺悕銆?/span>
4銆佸彟澶栦竴涓弬鏁幫細contentLength灝辨槸涓嬭澆鏂囦歡鐨勫ぇ灝忥紝webwork鐨剆tream result浼間箮瀹炵幇鏈夐棶棰橈紝涓嶈兘鏍規嵁鏂囦歡鐨勫ぇ灝忓姩鎬佽繘琛岃緗紝鍙兘鍐欐銆?/span>
     榪欎釜鍙傛暟鐨勬剰涔夋槸鍛婅瘔嫻忚涓嬭澆鐨勬枃浠舵湁澶氬ぇ錛屼互渚挎祻瑙堝櫒姝g‘鐨勬樉紺鴻繘搴︽潯銆傚鏋滆繖涓姛鑳藉緢閲嶈鐨勮瘽錛屽彲浠ラ噸鏂板啓涓涓猂ESULT鏉ュ疄鐜般?/span>
欏?/dt>
0
韙?/dt>


youngturk 2016-08-09 17:49 鍙戣〃璇勮
]]>
緇忓吀http://www.tkk7.com/youngturk/archive/2016/08/08/431494.htmlyoungturkyoungturkMon, 08 Aug 2016 07:07:00 GMThttp://www.tkk7.com/youngturk/archive/2016/08/08/431494.htmlhttp://www.tkk7.com/youngturk/comments/431494.htmlhttp://www.tkk7.com/youngturk/archive/2016/08/08/431494.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/431494.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/431494.htmlhttp://blog.csdn.net/jackfrued/article/details/44921941

youngturk 2016-08-08 15:07 鍙戣〃璇勮
]]>
sql琛屽垪浜掕漿http://www.tkk7.com/youngturk/archive/2016/08/04/431457.htmlyoungturkyoungturkThu, 04 Aug 2016 09:51:00 GMThttp://www.tkk7.com/youngturk/archive/2016/08/04/431457.htmlhttp://www.tkk7.com/youngturk/comments/431457.htmlhttp://www.tkk7.com/youngturk/archive/2016/08/04/431457.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/431457.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/431457.html鏁版嵁鍒楀嚭鏉ュ涓嬶細
 ID NAME    COUR SCORE
--- ------- ---- -----
  1 name_1  璇枃    33
  1 name_1  鏁板    63
  1 name_1  鑻辮    71
  1 name_1  鍘嗗彶    68
  1 name_1  鍖栧    94
  2 name_2  璇枃    85
  2 name_2  鏁板     4
  2 name_2  鑻辮    98
  2 name_2  鍘嗗彶     9
  2 name_2  鍖栧    12
  3 name_3  璇枃    49
  3 name_3  鏁板    96
  3 name_3  鑻辮    30
  3 name_3  鍘嗗彶    60
  3 name_3  鍖栧     2
瑕佸疄鐜扮殑琛岃漿鍒楃殑鏁堟灉濡備笅(鎴栬呯被浼肩殑緇撴灉)錛?/div>
 ID NAME    SCORES
--- ------- --------------------
  1 name_1  33,63,71,94,68
  2 name_2  85,4,98,12,9
  3 name_3  49,2,60,96,30
閫氳繃case琛ㄨ揪寮?/div>
select id,name,sum(case when course='璇枃' then score end) "璇枃",
sum(case when course='鏁板' then score end) "鏁板",
sum(case when course='鑻辮' then score end) "鑻辮",
sum(case when course='鍘嗗彶' then score end) "鍘嗗彶",
sum(case when course='鍖栧' then score end) "鍖栧"
from HANG2LIE
group by id,name;

union鏈夊幓閲嶅姛鑳斤細
緇撴瀯濡備笅錛?/div>
 ID NAME       Chinese       Math    English    History  Chemistry
--- ------- ---------- ---------- ---------- ---------- ----------
  2 name_2          85          4         98          9         12
  1 name_1          33         63         71         68         94
  3 name_3          49         96         30         60          2
鎴戜滑瑕佸疄鐜板涓嬬殑鏌ヨ鏁堟灉錛?span style="background-color: yellow;">鍒楄漿琛?/span>
 ID NAME     COUR SCORE
--- -------- ---- -----
  2 name_2   璇枃    85
  1 name_1   璇枃    33
  3 name_3   璇枃    49
  2 name_2   鏁板     4
  1 name_1   鏁板    63
  3 name_3   鏁板    96
  2 name_2   鑻辮    98
  1 name_1   鑻辮    71
  3 name_3   鑻辮    30
  2 name_2   鍘嗗彶     9
  1 name_1   鍘嗗彶    68
  3 name_3   鍘嗗彶    60
  2 name_2   鍖栧    12
  1 name_1   鍖栧    94
  3 name_3   鍖栧     2
1銆侀泦鍚堟煡璇?/div>
瀹炵幇鐨凷QL璇彞錛?/div>
select id,name,'璇枃' course,chinese score from lie2hang
union
select id,name,'鏁板' course,math score from lie2hang
union
select id,name,'鑻辮' course,english score from lie2hang
union
select id,name,'鍘嗗彶' course,history score from lie2hang
union
select id,name,'鍖栧' course,chemistry score from lie2hang;


youngturk 2016-08-04 17:51 鍙戣〃璇勮
]]>oracle 鍒嗛〉 浼垪 鍙兘灝忎簬 涓嶈兘澶т簬http://www.tkk7.com/youngturk/archive/2016/08/04/431449.htmlyoungturkyoungturkThu, 04 Aug 2016 00:53:00 GMThttp://www.tkk7.com/youngturk/archive/2016/08/04/431449.htmlhttp://www.tkk7.com/youngturk/comments/431449.htmlhttp://www.tkk7.com/youngturk/archive/2016/08/04/431449.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/431449.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/431449.htmlselect * from (select A.*, rownum rn from T_CD_LOC A where rownum > 20) where rn <41 閿?br />

select * from (select t.* ,rownum rn from T_CD_LOC t where rownum<=40) where rn>=20 瀵?br />
firstIndex=0
pageNumber
pageSize=20
select * from (select A.*,rownum rn from T_CD_LOC a where rownum < ((firstIndex+pageNumber+1)*pageSize) where rn >((firstIndex+pageNumber)*pageSize)


youngturk 2016-08-04 08:53 鍙戣〃璇勮
]]>js鎬庝箞鍒鋒柊閮戒笉綆$敤http://www.tkk7.com/youngturk/archive/2016/07/13/431182.htmlyoungturkyoungturkWed, 13 Jul 2016 07:36:00 GMThttp://www.tkk7.com/youngturk/archive/2016/07/13/431182.htmlhttp://www.tkk7.com/youngturk/comments/431182.htmlhttp://www.tkk7.com/youngturk/archive/2016/07/13/431182.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/431182.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/431182.html

youngturk 2016-07-13 15:36 鍙戣〃璇勮
]]>
Ehcache瀛︿範 杞?http://www.tkk7.com/youngturk/archive/2016/07/10/431149.htmlyoungturkyoungturkSun, 10 Jul 2016 09:14:00 GMThttp://www.tkk7.com/youngturk/archive/2016/07/10/431149.htmlhttp://www.tkk7.com/youngturk/comments/431149.htmlhttp://www.tkk7.com/youngturk/archive/2016/07/10/431149.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/431149.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/431149.html闃呰鍏ㄦ枃

youngturk 2016-07-10 17:14 鍙戣〃璇勮
]]>
java 铏氭嫙鏈虹洃鎺?/title><link>http://www.tkk7.com/youngturk/archive/2016/07/09/431147.html</link><dc:creator>youngturk</dc:creator><author>youngturk</author><pubDate>Sat, 09 Jul 2016 08:06:00 GMT</pubDate><guid>http://www.tkk7.com/youngturk/archive/2016/07/09/431147.html</guid><wfw:comment>http://www.tkk7.com/youngturk/comments/431147.html</wfw:comment><comments>http://www.tkk7.com/youngturk/archive/2016/07/09/431147.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/youngturk/comments/commentRss/431147.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/youngturk/services/trackbacks/431147.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #111111; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 23.3999996185303px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px;">3銆?span style="margin: 0px; padding: 0px;">JConsole</span>鐩戞帶</span></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #111111; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 23.3999996185303px; background-color: #ffffff;">     JMX(Java Management Extensions)鏄竴涓負搴旂敤紼嬪簭妞嶅叆綆$悊鍔熻兘鐨勬鏋躲侸MX鏄竴濂楁爣鍑嗙殑浠g悊鍜屾湇鍔★紝瀹為檯涓婏紝鐢ㄦ埛鍙互鍦ㄤ換浣旿ava搴旂敤紼嬪簭涓嬌鐢ㄨ繖浜涗唬鐞嗗拰鏈嶅姟瀹炵幇綆$悊銆傚彲浠ュ埄鐢↗DK鐨凧Console鏉ヨ闂甌omcat JMX鎺ュ彛瀹炴柦鐩戞帶錛屽叿浣撴楠ゅ涓嬶細</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #111111; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 23.3999996185303px; background-color: #ffffff;">1錛夐鍏堬紝鎵撳紑Tomcat5鐨刡in鐩綍涓殑catalina.bat鏂囦歡錛屾坊鍔狅細</p><div style="line-height: 26px; margin: 5px 0px;"><pre style="white-space: pre-wrap; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: 'Courier New' !important;">JAVA_OPTS=<span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">"</span><span style="margin: 0px; padding: 0px; color: #800000; line-height: 1.5 !important;">-Xms512m -Xmx512m -Xmn256m -XX:PermSize=64m -XX:MaxPermSize=64m <span style="margin: 0px; padding: 0px; color: #993300; line-height: 1.5 !important;"><span style="margin: 0px; padding: 0px;">-Djava.rmi.server.hostname=<span style="margin: 0px; padding: 0px;">192.168.222.132</span> -Dcom.sun.management.jmxremote.port=<span style="margin: 0px; padding: 0px;">1090</span> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false</span></span></span><span style="margin: 0px; padding: 0px; color: #993300; line-height: 1.5 !important;">"<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" /></span><span style="margin: 0px; padding: 0px;">-Dcom.sun.management.jmxremote錛氫唬琛ㄥ紑鍚疛MX鐨勭鐞嗗姛鑳?/span></pre><pre style="white-space: pre-wrap; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: 'Courier New' !important;"></pre></div><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #111111; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 23.3999996185303px; background-color: #ffffff;">2錛夐噸鍚痶omcat錛屽茍鏌ョ湅鐩戞帶绔彛錛堜笂闈㈤厤緗殑1090錛夋槸鍚﹀凡鍚姩</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #111111; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 23.3999996185303px; background-color: #ffffff;">3錛夋墦寮jdk鐨刡in鐩綍錛堝C:\Program Files\Java\jdk1.7.0_17\bin錛変笅鐨凧Console錛屽茍杈撳叆iP鍜岀洃鎺х鍙h繘琛岃繛鎺?/p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #111111; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 23.3999996185303px; background-color: #ffffff;">     <img src="http://images.cnitblog.com/i/360230/201408/031743302437353.jpg" alt="" width="561" height="358" style="border: 0px; max-width: 100%; margin: 0px; padding: 0px;" /></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #111111; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 23.3999996185303px; background-color: #ffffff;"> </p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #111111; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 23.3999996185303px; background-color: #ffffff;">鐩戞帶緇撴灉錛?/p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #111111; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 23.3999996185303px; background-color: #ffffff;">     <img src="http://images.cnitblog.com/i/360230/201408/031744319469768.jpg" alt="" width="575" height="476" style="border: 0px; max-width: 100%; margin: 0px; padding: 0px;" /></p><img src ="http://www.tkk7.com/youngturk/aggbug/431147.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/youngturk/" target="_blank">youngturk</a> 2016-07-09 16:06 <a href="http://www.tkk7.com/youngturk/archive/2016/07/09/431147.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>hibernate 鍒犻櫎鍏寵仈琛?/title><link>http://www.tkk7.com/youngturk/archive/2016/07/09/431146.html</link><dc:creator>youngturk</dc:creator><author>youngturk</author><pubDate>Sat, 09 Jul 2016 06:21:00 GMT</pubDate><guid>http://www.tkk7.com/youngturk/archive/2016/07/09/431146.html</guid><wfw:comment>http://www.tkk7.com/youngturk/comments/431146.html</wfw:comment><comments>http://www.tkk7.com/youngturk/archive/2016/07/09/431146.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/youngturk/comments/commentRss/431146.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/youngturk/services/trackbacks/431146.html</trackback:ping><description><![CDATA[<div>http://www.itzhai.com/hibernate-one-to-many-association-mapping-configuration-and-the-cascade-delete-problem.html<span style="font-size: 13px; background-color: #eeeeee;">棣栧厛涓句竴涓畝鍗曠殑涓瀵瑰鍙屽悜鍏寵仈鐨勯厤緗細</span></div><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><br />涓鐨勪竴绔細QuestionType綾?br /><br /><span style="color: #0000FF; ">package</span> com.exam.entity;<br /><span style="color: #0000FF; ">import</span> java.util.Set;<br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> QuestionType {<br />    <span style="color: #0000FF; ">private</span> String typeName;<br />    <span style="color: #0000FF; ">private</span> <span style="color: #0000FF; ">char</span> typeUniqueness;<br />    <span style="color: #0000FF; ">private</span> Set quesion;<br />    <span style="color: #0000FF; ">public</span> String getTypeName() {<br />        <span style="color: #0000FF; ">return</span> typeName;<br />    }<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> setTypeName(String typeName) {<br />        <span style="color: #0000FF; ">this</span>.typeName = typeName;<br />    }<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">char</span> getTypeUniqueness() {<br />        <span style="color: #0000FF; ">return</span> typeUniqueness;<br />    }<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> setTypeUniqueness(<span style="color: #0000FF; ">char</span> typeUniqueness) {<br />        <span style="color: #0000FF; ">this</span>.typeUniqueness = typeUniqueness;<br />    }<br />    <span style="color: #0000FF; ">public</span> Set getQuesion() {<br />        <span style="color: #0000FF; ">return</span> quesion;<br />    }<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> setQuesion(Set quesion) {<br />        <span style="color: #0000FF; ">this</span>.quesion = quesion;<br />    }<br />}<br /><br />閰嶇疆鏂囦歡錛?br /><br /><hibernate-mapping <span style="color: #0000FF; ">package</span>="com.exam.entity"><br />    <<span style="color: #0000FF; ">class</span> name="QuestionType" table="exam_question_type"><br />        <id name="typeName" column="type_name"></id><br />        <property name="typeUniqueness"  column="type_uniqueness"/><br />        <set name="quesion" inverse="true" cascade="delete"><br />            <key column="question_type_name"/><br />            <one-to-many <span style="color: #0000FF; ">class</span>="Question"/><br />        </set><br />    </<span style="color: #0000FF; ">class</span>><br /></hibernate-mapping><br /><br />澶氱殑涓绔細Question綾?br /><br /><span style="color: #0000FF; ">package</span> com.exam.entity;<br /><span style="color: #0000FF; ">import</span> java.util.Date;<br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> Question {<br />    <span style="color: #0000FF; ">private</span> <span style="color: #0000FF; ">int</span> questionNo;<br />    <span style="color: #0000FF; ">private</span> QuestionType questionType;<br />    <span style="color: #0000FF; ">private</span> String questionsTitle;<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">int</span> getQuestionNo() {<br />        <span style="color: #0000FF; ">return</span> questionNo;<br />    }<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> setQuestionNo(<span style="color: #0000FF; ">int</span> questionNo) {<br />        <span style="color: #0000FF; ">this</span>.questionNo = questionNo;<br />    }<br />    <span style="color: #0000FF; ">public</span> QuestionType getQuestionType() {<br />        <span style="color: #0000FF; ">return</span> questionType;<br />    }<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> setQuestionType(QuestionType questionType) {<br />        <span style="color: #0000FF; ">this</span>.questionType = questionType;<br />    }<br />    <span style="color: #0000FF; ">public</span> String getQuestionsTitle() {<br />        <span style="color: #0000FF; ">return</span> questionsTitle;<br />    }<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> setQuestionsTitle(String questionsTitle) {<br />        <span style="color: #0000FF; ">this</span>.questionsTitle = questionsTitle;<br />    }<br />}<br /><br />閰嶇疆鏂囦歡錛?br /><br /><hibernate-mapping <span style="color: #0000FF; ">package</span>="com.exam.entity"><br />    <<span style="color: #0000FF; ">class</span> name="Question" table="exam_question"><br />        <id name="questionNo" column="question_no" ><br />            <generator <span style="color: #0000FF; ">class</span>="increment" /><br />        </id><br />        <many-to-one name="questionType" column="question_type_name"/><br />        <property name="questionsTitle" column="questions_title" length="200" />    <br />    </<span style="color: #0000FF; ">class</span>><br /></hibernate-mapping><br /><br />棣栧厛璇存槑涓涓嬩竴浜涘父鐢ㄧ殑灞炴э細<br /><br /><many-to-one>鍏冪礌鍖呭惈浠ヤ笅灞炴э細<br /><br />name錛氳瀹氭槧灝勭殑鎸佷箙鍖栫被鐨勫睘鎬у悕<br />column錛氳瀹氬拰鎸佷箙鍖栫被鐨勫睘鎬у搴旂殑琛ㄧ殑澶栭敭<br /><span style="color: #0000FF; ">class</span>錛氳瀹氭寔涔呭寲綾葷殑灞炴х殑綾誨瀷<br />cascade錛氳瀹氭槸鍚︾駭鑱?br />lazy錛氳瀹氭槸鍚﹀歡榪熷姞杞?br /><br /><set>鍏冪礌鍖呭惈浠ヤ笅灞炴э細<br /><br />name錛氳瀹氭槧灝勭殑鎸佷箙鍖栫被鐨勫睘鎬у悕<br />cascade錛氳緗槸鍚︾駭鑱?br />inverse錛氳瀹氬弽鍚戞帶鍒訛紝濡傛灉涓簍rue鍒欎竴鐨勪竴绔笉緇存姢澶栭敭<br /><key>錛氳瀹氫笌鎵鍏寵仈鐨勬寔涔呭寲綾誨搴旂殑琛ㄧ殑澶栭敭銆?br />one-to-many錛氳瀹氭墍鍏寵仈鐨勬寔涔呭寲綾?br /><br />濡傛灉瑕佸涓瀵瑰鍏寵仈鏄犲皠榪涜綰ц仈鍒犻櫎錛屽彲浠ユ寜鐓т笂闈㈢殑涓句緥榪涜閰嶇疆錛?br /><br />棣栧厛鐪嬪埌涓鐨勪竴绔細<br /><br /><set name="quesion" inverse="true" cascade="delete"><br />    <key column="question_type_name"/><br />    <one-to-many <span style="color: #0000FF; ">class</span>="Question"/><br /></set><br /><br />榪欓噷璁劇疆inverse琛ㄧず涓鐨勪竴绔笉緇存姢澶栭敭錛岃緗甤ascade=”delete”琛ㄧず鍒犻櫎涓鐨勪竴绔椂瀵瑰叧鑱斿埌寰楀鐨勬墍鏈夌殑瀵硅薄涔熶竴璧峰垹闄?br /><br />鍐嶇湅鍒板鐨勪竴绔細<br /><br /><many-to-one name="questionType" column="question_type_name"/><br /><br />榪欓噷鐨刢olumn琛ㄧず澶栭敭鐨勫悕錛岄渶瑕佸拰涓鐨勪竴绔緗殑key鏍囩閲岀殑column淇濇寔涓鑷達紝琛ㄧず緇存姢鍚屼竴涓敭鍊箋?br /><br />鍙互鎸夌収濡備笅鐨勪唬鐮佹墽琛屽垹闄ゆ搷浣滐細<br /><br />session.beginTransaction();<br /><br />QuestionType questionType = (QuestionType) session.load(QuestionType.<span style="color: #0000FF; ">class</span>, "鍒ゆ柇棰?);            <br />session.delete(questionType);        <br />session.getTransaction().commit();<br /><br />榪欓噷浣跨敤load鏌ヤ笂鏉ョ殑瀵硅薄鏄寔涔呯姸鎬佺殑錛圥ersistent錛夛紝鍙湁鏄疨ersistent鐘舵佺殑瀵硅薄鎵嶅彲浠ヤ嬌鐢╯ession.delete()鎿嶄綔榪涜綰ц仈鍒犻櫎錛岀敱new鍒涘緩鐨勫璞″睘浜嶵ransient鐘舵侊紝涓嶈兘榪涜session.delete()鎿嶄綔銆?/div><img src ="http://www.tkk7.com/youngturk/aggbug/431146.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/youngturk/" target="_blank">youngturk</a> 2016-07-09 14:21 <a href="http://www.tkk7.com/youngturk/archive/2016/07/09/431146.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>hibernate 鍒犻櫎鍏寵仈琛?/title><link>http://www.tkk7.com/youngturk/archive/2016/07/09/431145.html</link><dc:creator>youngturk</dc:creator><author>youngturk</author><pubDate>Sat, 09 Jul 2016 06:18:00 GMT</pubDate><guid>http://www.tkk7.com/youngturk/archive/2016/07/09/431145.html</guid><wfw:comment>http://www.tkk7.com/youngturk/comments/431145.html</wfw:comment><comments>http://www.tkk7.com/youngturk/archive/2016/07/09/431145.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/youngturk/comments/commentRss/431145.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/youngturk/services/trackbacks/431145.html</trackback:ping><description><![CDATA[闇瑕佸厛鍒犲瓙琛紝鍐嶅垹闄や富琛紝鍚﹀垯鎶ラ敊 濂芥枃绔? http://www.itzhai.com/hibernate-one-to-many-association-mapping-configuration-and-the-cascade-delete-problem.html <img src ="http://www.tkk7.com/youngturk/aggbug/431145.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/youngturk/" target="_blank">youngturk</a> 2016-07-09 14:18 <a href="http://www.tkk7.com/youngturk/archive/2016/07/09/431145.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>middlegen鐢熸垚pojohttp://www.tkk7.com/youngturk/archive/2016/07/05/431099.htmlyoungturkyoungturkTue, 05 Jul 2016 06:24:00 GMThttp://www.tkk7.com/youngturk/archive/2016/07/05/431099.htmlhttp://www.tkk7.com/youngturk/comments/431099.htmlhttp://www.tkk7.com/youngturk/archive/2016/07/05/431099.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/431099.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/431099.html

youngturk 2016-07-05 14:24 鍙戣〃璇勮
]]>
MyBatis 闇瑕佺爺絀?/title><link>http://www.tkk7.com/youngturk/archive/2016/06/27/431027.html</link><dc:creator>youngturk</dc:creator><author>youngturk</author><pubDate>Mon, 27 Jun 2016 05:47:00 GMT</pubDate><guid>http://www.tkk7.com/youngturk/archive/2016/06/27/431027.html</guid><wfw:comment>http://www.tkk7.com/youngturk/comments/431027.html</wfw:comment><comments>http://www.tkk7.com/youngturk/archive/2016/06/27/431027.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/youngturk/comments/commentRss/431027.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/youngturk/services/trackbacks/431027.html</trackback:ping><description><![CDATA[http://www.cnblogs.com/xdp-gacl/p/4261895.html<img src ="http://www.tkk7.com/youngturk/aggbug/431027.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/youngturk/" target="_blank">youngturk</a> 2016-06-27 13:47 <a href="http://www.tkk7.com/youngturk/archive/2016/06/27/431027.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>ftp sockethttp://www.tkk7.com/youngturk/archive/2016/06/27/431026.htmlyoungturkyoungturkMon, 27 Jun 2016 04:45:00 GMThttp://www.tkk7.com/youngturk/archive/2016/06/27/431026.htmlhttp://www.tkk7.com/youngturk/comments/431026.htmlhttp://www.tkk7.com/youngturk/archive/2016/06/27/431026.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/431026.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/431026.html

youngturk 2016-06-27 12:45 鍙戣〃璇勮
]]>
XML闈㈣瘯棰?/title><link>http://www.tkk7.com/youngturk/archive/2016/06/24/431013.html</link><dc:creator>youngturk</dc:creator><author>youngturk</author><pubDate>Fri, 24 Jun 2016 08:41:00 GMT</pubDate><guid>http://www.tkk7.com/youngturk/archive/2016/06/24/431013.html</guid><wfw:comment>http://www.tkk7.com/youngturk/comments/431013.html</wfw:comment><comments>http://www.tkk7.com/youngturk/archive/2016/06/24/431013.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/youngturk/comments/commentRss/431013.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/youngturk/services/trackbacks/431013.html</trackback:ping><description><![CDATA[http://blog.csdn.net/sweetsnow24/article/details/7447110 http://jingyan.baidu.com/article/b7001fe1738d9a0e7282dda6.html http://wenku.baidu.com/link?url=YjPcc8q-E9jnAEqsEJQZ7juMw8TICa0q9ppU3ICqEyQJBl4JGQynegQT03DQA0oyA-CxGAtDKJ_pvuvo3prfVeLEsxzC7VUWjWMsQVAxht_ 闂1錛歑ML鏄粈涔堬紵 銆銆絳旓細XML鍗沖彲鎵╁睍鏍囪璇█錛圗xtensible Markup language錛夛紝浣犲彲浠ユ牴鎹嚜宸辯殑闇瑕佹墿灞昘ML銆俋ML涓彲浠ヨ交鏉懼畾涔?books>, <orders>絳夎嚜瀹氫箟鏍囩錛岃屽湪HTML絳夊叾浠栨爣璁拌璦涓繀欏諱嬌鐢ㄩ瀹氫箟鐨勬爣絳撅紝姣斿<p>錛岃屼笉鑳戒嬌鐢ㄧ敤鎴峰畾涔夌殑鏍囩銆備嬌鐢―TD鍜孹ML Schema鏍囧噯鍖朮ML緇撴瀯銆俋ML涓昏鐢ㄤ簬浠庝竴涓郴緇熷埌鍙︿竴緋葷粺鐨勬暟鎹紶杈擄紝姣斿浼佷笟綰у簲鐢ㄧ殑瀹㈡埛绔笌鏈嶅姟绔? 銆銆闂2錛欴TD涓嶺ML Schema鏈変粈涔堝尯鍒紵 銆銆絳旓細DTD涓嶺ML Schema鏈変互涓嬪尯鍒細DTD涓嶄嬌鐢╔ML緙栧啓鑰孹ML Schema鏈韓灝辨槸xml鏂囦歡錛岃繖鎰忓懗鐫XML瑙f瀽鍣ㄧ瓑宸叉湁鐨刋ML宸ュ叿鍙互鐢ㄦ潵澶勭悊XML Schema銆傝屼笖XML Schema 鏄璁′簬DTD涔嬪悗鐨勶紝瀹冩彁渚涗簡鏇村鐨勭被鍨嬫潵鏄犲皠xml鏂囦歡涓嶅悓鐨勬暟鎹被鍨嬨侱TD鍗蟲枃妗g被鍨嬫弿榪幫紙Document Type definition錛夋槸瀹氫箟XML鏂囦歡緇撴瀯鐨勪紶緇熸柟寮忋? 銆銆闂3錛歑Path鏄粈涔堬紵 銆銆絳旓細XPath鏄敤浜庝粠XML鏂囨。媯绱㈠厓绱犵殑XML鎶鏈俋ML鏂囨。鏄粨鏋勫寲鐨勶紝鍥犳XPath鍙互浠嶺ML鏂囦歡瀹氫綅鍜屾绱㈠厓绱犮佸睘鎬ф垨鍊箋備粠鏁版嵁媯绱㈡柟闈㈡潵璇達紝XPath涓嶴QL寰堢浉浼鹼紝浣嗘槸瀹冩湁鑷繁鐨勮娉曞拰瑙勫垯銆? 銆銆闂4錛歑SLT鏄粈涔? 銆銆絳旓細XSLT涔熸槸甯哥敤鐨刋ML鎶鏈紝鐢ㄤ簬灝嗕竴涓猉ML鏂囦歡杞崲涓哄彟涓縐峏ML錛孒TML鎴栬呭叾浠栫殑鏍煎紡銆俋SLT涓鴻漿鎹ML鏂囦歡璇︾粏瀹氫箟浜嗚嚜宸辯殑璇硶錛屽嚱鏁板拰鎿嶄綔絎︺傞氬父鐢盭SLT寮曟搸瀹屾垚杞崲錛孹SLT寮曟搸璇誨彇XSLT璇硶緙栧啓鐨刋ML鏍峰紡琛ㄦ垨鑰匵SL鏂囦歡鐨勬寚浠ゃ俋SLT澶ч噺浣跨敤閫掑綊鏉ユ墽琛岃漿鎹€備竴涓父瑙乆SLT浣跨敤灝辨槸灝哫ML鏂囦歡涓殑鏁版嵁浣滀負HTML欏甸潰鏄劇ず銆俋SLT涔熷彲浠ュ緢鏂逛究鍦版妸涓縐峏ML鏂囦歡杞崲涓哄彟涓縐峏ML鏂囨。銆? 銆銆闂5錛氫粈涔堟槸XML鍏冪礌鍜屽睘鎬? 銆銆絳旓細鏈濂戒婦涓緥瀛愭潵瑙i噴銆備笅闈㈡槸綆鍗曠殑XML鐗囨柇銆? 銆銆Xml浠g爜 銆銆<Orders> 銆銆<Order id="123"> 銆銆<Symbol>6758.T</Symbol> 銆銆<Price>2300</Price> 銆銆<Order> 銆銆<Orders> 銆銆渚嬪瓙涓璱d鏄厓绱犵殑涓涓睘鎬э紝鍏朵粬鍏冪礌閮芥病鏈夊睘鎬с? 銆銆闂6錛氫粈涔堟槸鏍煎紡鑹ソ鐨刋ML 銆銆絳旓細榪欎釜闂緇忓父鍦ㄧ數璇濋潰璇曚腑鍑虹幇銆備竴涓牸寮忚壇濂界殑XML鎰忓懗鐫璇ML鏂囨。璇硶涓婃槸姝g‘鐨勶紝姣斿瀹冩湁涓涓牴鍏冪礌錛屾墍鏈夌殑寮鏀炬爣絳懼悎閫傚湴闂悎錛屽睘鎬у煎繀欏誨姞寮曞彿絳夌瓑銆傚鏋滀竴涓猉ML涓嶆槸鏍煎紡鑹ソ鐨勶紝閭d箞瀹冨彲鑳戒笉鑳借鍚勭XML瑙f瀽鍣ㄦ紜湴澶勭悊鍜岃В鏋愩? 銆銆闂7錛歑ML鍛藉悕絀洪棿鏄粈涔堬紵瀹冧負浠涔堝緢閲嶈錛? 銆銆絳旓細XML鍛藉悕絀洪棿涓嶫ava鐨刾ackage綾諱技錛岀敤鏉ラ伩鍏嶄笉鍚屾潵婧愬悕縐扮浉鍚岀殑鏍囩鍙戠敓鍐茬獊銆俋ML鍛藉悕絀洪棿鍦╔ML鏂囨。欏墮儴浣跨敤xmlns灞炴у畾涔夛紝璇硶涓簒mlns:prefix=鈥橴RI鈥欍俻refix涓嶺ML鏂囨。涓疄闄呮爣絳句竴璧蜂嬌鐢ㄣ備笅闈緥瀛愪負XML鍛藉悕絀洪棿鐨勪嬌鐢ㄣ? 銆銆Xml浠g爜 銆銆<root xmlns:inst="http://instruments.com/inst" 銆銆<inst:phone> 銆銆<inst:number>837363223</inst:number> 銆銆</inst:phone> 銆銆</root> 銆銆闂8錛欴OM鍜孲AX瑙f瀽鍣ㄦ湁浠涔堝尯鍒? 銆銆絳旓細榪欏張鏄竴閬撳父瑙侀潰璇曢錛屼笉浠呭嚭鐜板湪XML闈㈣瘯棰樹腑錛屽湪Java闈㈣瘯涓篃浼氶棶鍒般侱OM鍜孲AX瑙f瀽鍣ㄧ殑涓昏鍖哄埆鍦ㄤ簬瀹冧滑瑙f瀽XML鏂囨。鐨勬柟寮忋備嬌鐢―OM瑙f瀽鏃訛紝XML鏂囨。浠ユ爲褰㈢粨鏋勭殑褰㈠紡鍔犺澆鍒板唴瀛樹腑錛岃孲AX鏄簨浠墮┍鍔ㄧ殑瑙f瀽鍣ㄣ? 銆銆闂9錛歑ML CDATA鏄粈涔? 銆銆絳旓細榪欓亾棰樺緢綆鍗曚篃寰堥噸瑕侊紝浣嗗緢澶氱紪紼嬩漢鍛樺瀹冪殑浜嗚В騫朵笉娣便侰DATA鏄寚瀛楃鏁版嵁錛屽畠鏈夌壒孌婄殑鎸囦護琚玐ML瑙f瀽鍣ㄨВ鏋愩俋ML瑙f瀽鍣ㄨВ鏋怷ML鏂囨。涓墍鏈夌殑鏂囨湰錛屾瘮濡?name>This is name of person</name>錛屾爣絳劇殑鍊間篃浼氳瑙f瀽錛屽洜涓烘爣絳懼間篃鍙兘鍖呭惈XML鏍囩錛屾瘮濡?name><firstname>First Name</firstname></name>銆侰DATA閮ㄥ垎涓嶄細琚玐ML瑙f瀽鍣ㄨВ鏋愩? 銆銆闂10錛欽ava鐨刋ML鏁版嵁緇戝畾鏄粈涔? 銆銆絳旓細Java鐨刋ML緇戝畾鎸囦粠XML鏂囦歡涓垱寤虹被鍜屽璞★紝浣跨敤Java緙栫▼璇█淇敼XML鏂囨。銆俋ML緇戝畾鐨凧ava API錛孞AXB鎻愪緵浜嗙粦瀹歑ML鏂囨。鍜孞ava瀵硅薄鐨勪究鍒╂柟寮忋傚彟涓涓彲閫夌殑XML緇戝畾鏂規硶鏄嬌鐢ㄥ紑婧愬簱錛屾瘮濡俋ML Beans銆侸ava涓璛ML緇戝畾鐨勪竴涓渶澶х殑浼樺娍灝辨槸鍒╃敤Java緙栫▼鑳藉姏鍒涘緩鍜屼慨鏀筙ML鏂囨。銆? 銆銆浠ヤ笂鐨刋ML闈㈣瘯闂瓟棰樻敹闆嗚嚜寰堝緙栫▼浜哄憳錛屼絾瀹冧滑瀵逛簬浣跨敤XML鎶鏈殑姣忎釜浜洪兘鏄湁鐢ㄧ殑銆傜敱浜嶺ML鍏鋒湁騫沖彴鐙珛鐨勭壒鎬э紝XPath錛孹SLT錛孹Query絳塜ML鎶鏈秺鏉ヨ秺閲嶈銆傚敖綆ML鏈夊啑浣欏拰鏂囨。浣撶Н澶х瓑緙虹偣錛屼絾瀹冨湪web鏈嶅姟浠ュ強甯﹀銆侀熺巼浣滀負嬈¤鑰冭檻鍥犵礌鐨勭郴緇熼棿鏁版嵁浼犺緭璧峰緢澶т綔鐢紝琚箍娉涚敤浜庤法騫沖彴鏁版嵁浼犺緭銆? <img src ="http://www.tkk7.com/youngturk/aggbug/431013.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/youngturk/" target="_blank">youngturk</a> 2016-06-24 16:41 <a href="http://www.tkk7.com/youngturk/archive/2016/06/24/431013.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>SQL SERVER 鐨勭敤鎴鋒暟錛岃繛鎺ワ紝榪炴帴姹?license http://www.tkk7.com/youngturk/archive/2016/06/24/431010.htmlyoungturkyoungturkFri, 24 Jun 2016 07:00:00 GMThttp://www.tkk7.com/youngturk/archive/2016/06/24/431010.htmlhttp://www.tkk7.com/youngturk/comments/431010.htmlhttp://www.tkk7.com/youngturk/archive/2016/06/24/431010.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/431010.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/431010.html

youngturk 2016-06-24 15:00 鍙戣〃璇勮
]]>
涓夊垎閽熻浣犵湅鎳俲ava緗戠粶閫氫俊http://www.tkk7.com/youngturk/archive/2016/06/23/430997.htmlyoungturkyoungturkThu, 23 Jun 2016 02:02:00 GMThttp://www.tkk7.com/youngturk/archive/2016/06/23/430997.htmlhttp://www.tkk7.com/youngturk/comments/430997.htmlhttp://www.tkk7.com/youngturk/archive/2016/06/23/430997.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/430997.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/430997.htmlpackage con120722; Java浠g爜 鏀惰棌浠g爜 import java.io.*; import java.net.*; public class Client { Socket socket; BufferedReader in; PrintWriter out; public Client() { try { socket = new Socket("localhost", 10000); in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = new PrintWriter(socket.getOutputStream(),true); BufferedReader line = new BufferedReader(new InputStreamReader(System.in)); out.println(line.readLine()); line.close(); out.close(); in.close(); socket.close(); } catch (IOException e) {} } public static void main(String[] args) { new Client(); } }

youngturk 2016-06-23 10:02 鍙戣〃璇勮
]]>
Xms Xmx PermSize MaxPermSize 鍖哄埆 java 鍐呭瓨http://www.tkk7.com/youngturk/archive/2016/06/21/430983.htmlyoungturkyoungturkTue, 21 Jun 2016 13:58:00 GMThttp://www.tkk7.com/youngturk/archive/2016/06/21/430983.htmlhttp://www.tkk7.com/youngturk/comments/430983.htmlhttp://www.tkk7.com/youngturk/archive/2016/06/21/430983.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/430983.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/430983.html

youngturk 2016-06-21 21:58 鍙戣〃璇勮
]]>
java闈㈣瘯棰橈細濡備綍瑙e喅鍐呭瓨婧㈠嚭http://www.tkk7.com/youngturk/archive/2016/06/21/430982.htmlyoungturkyoungturkTue, 21 Jun 2016 13:37:00 GMThttp://www.tkk7.com/youngturk/archive/2016/06/21/430982.htmlhttp://www.tkk7.com/youngturk/comments/430982.htmlhttp://www.tkk7.com/youngturk/archive/2016/06/21/430982.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/430982.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/430982.html

youngturk 2016-06-21 21:37 鍙戣〃璇勮
]]>
jquery涓璦jax澶勭悊璺ㄥ煙鐨勪笁澶ф柟寮?錛宩Query瀛︿範涔媕Query Ajax鐢ㄦ硶璇﹁Вhttp://www.tkk7.com/youngturk/archive/2016/06/20/430977.htmlyoungturkyoungturkMon, 20 Jun 2016 15:10:00 GMThttp://www.tkk7.com/youngturk/archive/2016/06/20/430977.htmlhttp://www.tkk7.com/youngturk/comments/430977.htmlhttp://www.tkk7.com/youngturk/archive/2016/06/20/430977.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/430977.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/430977.html

youngturk 2016-06-20 23:10 鍙戣〃璇勮
]]>
鎴戠殑鐞嗚В--鍏充簬jmx http://www.tkk7.com/youngturk/archive/2016/06/20/430971.htmlyoungturkyoungturkMon, 20 Jun 2016 01:40:00 GMThttp://www.tkk7.com/youngturk/archive/2016/06/20/430971.htmlhttp://www.tkk7.com/youngturk/comments/430971.htmlhttp://www.tkk7.com/youngturk/archive/2016/06/20/430971.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/430971.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/430971.html
http://www.cnblogs.com/Javame/p/3881187.html
JMX Java Management Extensions錛孞ava綆$悊鎵╁睍錛屽垵姝ョ湅浜嗕簺璧勬枡錛屼互涓烘槸涓撻棬綆$悊錛岀洃鎺vm鐨勪竴浜涗俊鎭殑錛岀壒鍒槸visual VM榪欎釜鐩戞帶jvm鐨勪笢瑗匡紝榪樻湁涓涓坊鍔燡MX榪炴帴鐨勬椂鍊欙紙鎴戣嚜宸辨兂閿欎簡錛岄偅鏍風殑璇濆簲璇ュ彨jvm Management Extensions錛夛紝鍏跺疄浠栬兘浣垮緱鍩轟簬java璇█寮鍙戠殑紼嬪簭鑳借綆$悊錛屽茍涓旀槸鍙墿灞曠殑銆? Jdk浠ュ墠鏄氳繃JVMPI涔嬬被鏉ョ洃嫻婮ava紼嬪簭榪愯涓殑jvm鍜岀郴緇熺殑涓緋誨垪鎯呭喌錛岀幇鍦ㄩ氳繃jmx灝卞彲浠ュ仛鍒幫紝榪欐槸閫氳繃java.lang.management 鍖呮潵瀹炵幇鐨勶紝榪欎釜鍖呮槸 JMX 鍦?JDK鏂歸潰 鐨勪竴涓簲鐢紝騫朵笉鏄〃紺簀mx灝辨槸涓涓洃鎺vm鐨勪笢瑗褲? 鎴戜滑鍙互鐢╦mx鏉ョ洃鎺ф垜浠殑緋葷粺錛岄氳繃鍏竷API鐨勬柟寮忥紝浣嗘槸錛岃繖閲岄噰鐢ㄧ洃鎺ц繖涓瘝錛屼篃鏄彈浜嗗墠闈㈢殑渚嬪瓙鐨勫獎鍝嶏紝瀹為檯涓婏紝涓漢瑙夊緱錛屽氨鍙互鐢╦mx鏉ュ紑鍙戞垜浠殑緋葷粺銆? 鐜板湪鐨刯boss錛宧ibernate錛宼omcat鍚勭搴旂敤閮藉彿縐板疄鐜頒簡JMX瑙勮寖錛屽皢鍙鐞嗭紝鍙皟鐢ㄧ殑MBean娉ㄥ唽鍒癕BeanServer涓紝閫氳繃涓縐嶇被浼?#8220;web鏈嶅姟”鐨勬柟寮忓叕甯冨嚭鍘伙紝騫朵笖浼存湁涓涓悕瀛楋紝鍙互閫氳繃璇ュ悕瀛楁壘鍒拌MBean銆傚茍涓旓紝榪欓噷鐨凪Bean鏄彲浠ヨ綆$悊鐨勶紝璇村埌榪欓噷鍙堟兂鍒頒簡OSGI銆? JMX涓嶹eb Service 涓漢璁や負錛屾垜浠疄鐜癑MX瑙勮寖錛屽皢涓滆タ鍙戝竷鍑哄幓錛屽拰閫氳繃web Service鐨勬柟寮忔槸寰堢被浼肩殑錛屼篃鏄彲浠ヨ繙紼嬭皟鐢ㄧ殑錛屽彧鏄浉瀵圭殑web Service鐨勬柟寮忔洿鍔燬OA涓浜涳紝涓嶈繃JMX鍙風О涔熻鎻愪緵瀵歸潪java瀹㈡埛绔殑鏀寔錛屼篃灝辨槸璺ㄨ璦浜嗗惂銆傘傘? 鐜板湪鐨凧MX榪炴帴鏂瑰紡錛? JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9999/server"); JMXConnector jmxc = JMXConnectorFactory.connect(url, null); 鐪嬩簡涓嬫簮鐮侊紝璨屼技榪樻槸閫氳繃RMI鏉ュ疄鐜扮殑錛屼笉鐭ラ亾瀹冭鎬庝箞瀹炵幇闈瀓ava瀹㈡埛绔敮鎸併? 浠庤繖閲岋紝鎴戣寰桱MX鍙互瀹炵幇鐨勶紝鎴戜滑涔熼兘鍙互閫氳繃web Service瀹炵幇錛屽彧鏄湅鍦ㄥ畠鏈変釜“M”涓婏紝浠ュ悗濡傛灉鏈変粈涔堢郴緇熺鐞嗭紝鐩戞帶鏂歸潰鐨勶紝鍙互鑰冭檻浣跨敤瀹冿紝涔熻寮鍙戯紝涓漢瑙夊緱榪樻槸浣跨敤web service濂戒竴浜涖? 璇村埌榪欓噷錛屾劅瑙塐SGI涓嶫MX涔熷ソ鍍忥紝鍦ㄧ湅鍒癑MX鑳藉瀵筂Bean榪涜綆$悊鐨勬椂鍊欙紝鎴戝氨瑙夊緱璺烵SGI寰堝儚錛孫SGI綆$悊鐨勬槸Bundle錛屾壘浜嗘壘璧勬簮錛屽師鏉ユ棭灝辨湁浜鴻冭檻榪囦簡錛? http://teamojiao.iteye.com/blog/438334 欏轟究錛屽湪鏌ヨ祫鏂欑殑鏃跺欙紝鍙戠幇涓涓笢瑗匡紝 if your question means, how to manage an OSGi runtime with JMX, you should have a look at MAEXO (http://code.google.com/p/maexo/). With MAEXO bundles up and running you will transparently get MBeans for a fair amount of services of the OSGi runtime as well as MBeans for your own services and bundles. Just have a look at the screencast. 鎽樹竴浜涜瘽錛氫粎鍋氬弬鑰? <緗戝弸鍥炲> 涓涓ぇ緋葷粺涓紝鍚勫唴閮ㄦā鍧楃郴緇熶箣闂寸殑鍩轟簬鎺ュ彛鏂瑰紡鐨勪簰鐩歌皟鐢ㄥ拰娌葷悊錛屼嬌鐢綂锝嶏綐鏄渶浣蟲柟妗堬紟 甯︽潵鐨勫ソ澶勬槸 1.闈㈠悜鎺ュ彛錛岃繙紼嬭皟鐢ㄥ浜庡紑鍙戜漢鍛樻槸閫忔槑鐨勶紝妯″潡鍦ㄨ皟鐢綂锝嶏綐鎺ュ彛鏃訛紝涓庤皟鐢ㄦ湰鍦版柟娉曞嚑涔庣浉鍚岋紟 2.鍙鍖栫殑娌葷悊鐣岄潰錛屻閫氳繃銆Jconsole絳夛綂锝嶏綐瀹㈡埛绔紝鍙互瀹炴椂鐩戞帶緋葷粺錛屽茍涓斿彲瀹炴椂璋冪敤鏂規硶榪涜鏌愪簺鎿嶄綔錛? 鍏稿瀷搴旂敤鍦烘櫙錛氥 鏌愯亰澶╃郴緇燂紝涓鍙版湇鍔″櫒浣滀負 鍦ㄧ嚎鐢ㄦ埛鍒楄〃鏈嶅姟鍣?A1錛屻锝庡彴鏈嶅姟鍣ㄤ負鐢ㄦ埛鎻愪緵鑱婂ぉ涓氬姟澶勭悊 N1 ,N2,N3...錛? 涓鍙版湇鍔″櫒浣滀負鍚庡彴娌葷悊緋葷粺A2錛庛 緋葷粺娌葷悊鍛樼幇鍦ㄨ繘琛屼笅闈㈣繖鏍蜂竴涓搷浣滐紝瀵熺湅鏌愮敤鎴鋒槸鍚﹀湪綰匡紝鎵懼埌璇ョ敤鎴鳳紝鍙戠幇鍏跺湪綰匡紝鍒欏皢璇ョ敤鎴峰姞鍏ラ粦鍚嶅崟錛屽茍韙笅綰匡紟 瀵瑰簲鐨勶綂锝嶏綐鎺ュ彛鍙互鐢變互涓嬪嚑涓細銆 A1涓篈2鎻愪緵鏌ヨ鍦ㄧ嚎鐢ㄦ埛锝婏綅锝樻帴鍙o紝鍔犲叆榛戝悕鍗曟帴鍙o紝kickout鎺ュ彛錛? 錛★紤涓篘1..絳夋湇鍔″櫒鎻愪緵浠ヤ笅鎺ュ彛錛氥娉ㄥ唽涓氬姟鏈嶅姟鍣紝娣誨姞鍦ㄧ嚎鐢ㄦ埛錛庢煡鎵鵑粦鍚嶅崟鐢ㄦ埛 N1...鍒癗3涓猴肌錛戞彁渚沰ickout鎺ュ彛錛? 鍥犳鍦ㄤ笂闈㈢殑韙笅綰挎搷浣滐紝鍒欑敱鐢ㄦ埛鍦ˋ2鐨勶綏锝咃絺鐣岄潰鍙戝嚭錛屼氦鐢盇1鎵ц錛孉1璁板綍榛戝悕鍗曚箣鍚庯紝鍐嶆壘鍒扮敤鎴鋒墍鍦ㄤ笟鍔℃湇鍔″櫒璋冪敤N1鎻愪緵鐨勬帴鍙h鐢ㄦ埛涓嬬嚎錛? 浠ヤ笂鎯呭艦鏄湪鐢熶駭鐜涓嬬殑閮ㄧ講錛岃屽湪寮鍙戝伐浣滐紝鍒欏彲浠ュ皢A1,A2,N...N3絳夊姛鑳藉悎騫跺湪涓涓簲鐢ㄤ腑璋冭瘯錛庛鐢變簬浣跨敤鐨勬槸锝婏綅锝樻帴鍙o紝鍦ㄦ湰鍦拌皟璇曞悎騫朵箣鍚庯紝鍙互鐩存帴璋冪敤搴旂敤鍐呴儴鎺ュ彛鏂規硶錛? 榪欐牱鍊熷姪锝婏綅锝樺疄鐜扮殑搴旂敤妯″潡鐨勭伒媧葷粍瑁呬笌鎷嗗垎錛屼嬌寰楃郴緇熺殑鍙互鏍規嵁璐熻澆闇瑕侊紝鏍規嵁鎬ц兘鎯呭喌錛岀伒媧葷殑鎷嗗垎鍜屾暣鍚堥儴緗插垎甯冨紡鐨勫簲鐢紟 鏇夸唬鏂規錛岄夋嫨webservice,xmlrpc絳夛紝浣嗘槸榪欎簺閮介渶瑕佹墜宸ョ紪鍐欐垨鐢ㄥ伐鍏風敓鎴愬ぇ閲忕殑浠g爜鏉ヨ緟鍔╁畬鎴愭帴鍙i棿鐨刯ava瀵硅薄搴忓垪鍖栥銆? 緇忓吀锝婏綅锝樻渚嬶細 錛戯紟錛絺锝忥綋锝擄紟浣跨敤锝婏綅锝樻不鐞嗗唴閮ㄧ殑鍚勪釜锝擄絽锝掞綎锝夛絻锝呫? 2錛庛鍩轟簬锝婏絹锝栵絹鐨勫紑婧愮綉綆¤蔣浠?Hyperic HQ 錛岄氳繃锝婏綅锝樹笌鍚勮娌葷悊璧勬簮榪涜閫氳鍜屼俊鎭噰闆嗭紟 <緗戝弸鍥炲>JMX鏄竴涓不鐞嗙殑妗嗘灦銆? 褰撴垜浠兂浣跨敤JMX鐨勬椂鍊欙紝灝辮闂紝鎴戜滑鐨勭郴緇熷綋涓湁闇瑕佺洃鎺ф不鐞嗙殑璧勬簮鎴栬呭璞″悧錛熷疄浜嬫眰鏄竴鐐癸紝鎴戜滑涓嶈兘涓轟簡鎯充嬌鐢ㄤ竴涓珮绔殑鎶鏈紝灝辨鏇茬郴緇熺殑鏈潵闈㈢洰銆? 鍋囧絎竴涓棶棰樻槸鑲畾鐨勶紝鎺ヤ笅鏉ュ氨鏄湅榪欎簺璧勬簮鏄惁鏈夌敓鍛藉懆鏈熴? 緇忓吀妗堜緥錛歫boss灝辨槸灝嗘墍鏈夊彲閮ㄧ講鐨勭粍浠朵綔涓鴻祫婧愭潵娌葷悊錛岃繖浜涚粍寤洪兘鏈夊叾鐢熷懡鍛ㄦ湡銆傝繖涓悊蹇電敋鑷沖歡浼稿埌浜嗗叾緋葷粺鍐呴儴錛屽皢鍏跺唴閮ㄧ殑鏈嶅姟浣滀負緇勪歡綰沖叆鍒?JMX涓潵錛屾垚灝變簡jboss鍩轟簬jmx鐨勫井鍐呮牳緋葷粺銆?img src ="http://www.tkk7.com/youngturk/aggbug/430971.html" width = "1" height = "1" />

youngturk 2016-06-20 09:40 鍙戣〃璇勮
]]>
java socket緙栫▼ http://www.tkk7.com/youngturk/archive/2016/06/19/430970.htmlyoungturkyoungturkSun, 19 Jun 2016 14:20:00 GMThttp://www.tkk7.com/youngturk/archive/2016/06/19/430970.htmlhttp://www.tkk7.com/youngturk/comments/430970.htmlhttp://www.tkk7.com/youngturk/archive/2016/06/19/430970.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/430970.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/430970.htmlhttp://www.ibm.com/developerworks/cn/linux/l-cn-socketftp/涓錛岀綉緇滅紪紼嬩腑涓や釜涓昏鐨勯棶棰?/span>

涓涓槸濡備綍鍑嗙‘鐨勫畾浣嶇綉緇滀笂涓鍙版垨澶氬彴涓繪満錛屽彟涓涓氨鏄壘鍒頒富鏈哄悗濡備綍鍙潬楂樻晥鐨勮繘琛屾暟鎹紶杈撱?br />
鍦═CP/IP鍗忚涓璉P灞備富瑕佽礋璐g綉緇滀富鏈虹殑瀹氫綅錛屾暟鎹紶杈撶殑璺敱錛岀敱IP鍦板潃鍙互鍞竴鍦扮‘瀹欼nternet涓婄殑涓鍙頒富鏈恒?br />
鑰孴CP灞傚垯鎻愪緵闈㈠悜搴旂敤鐨勫彲闈狅紙tcp錛夌殑鎴栭潪鍙潬錛圲DP錛夌殑鏁版嵁浼犺緭鏈哄埗錛岃繖鏄綉緇滅紪紼嬬殑涓昏瀵硅薄錛屼竴鑸笉闇瑕佸叧蹇僆P灞傛槸濡備綍澶勭悊鏁版嵁鐨勩?br />
鐩墠杈冧負嫻佽鐨勭綉緇滅紪紼嬫ā鍨嬫槸瀹㈡埛鏈?鏈嶅姟鍣紙C/S錛夌粨鏋勩傚嵆閫氫俊鍙屾柟涓鏂逛綔涓烘湇鍔″櫒絳夊緟瀹㈡埛鎻愬嚭璇鋒眰騫朵簣浠ュ搷搴斻傚鎴峰垯鍦ㄩ渶瑕佹湇鍔℃椂鍚戞湇鍔″櫒鎻?nbsp;鍑虹敵璇楓傛湇鍔″櫒涓鑸綔涓哄畧鎶よ繘紼嬪緇堣繍琛岋紝鐩戝惉緗戠粶绔彛錛屼竴鏃︽湁瀹㈡埛璇鋒眰錛屽氨浼氬惎鍔ㄤ竴涓湇鍔¤繘紼嬫潵鍝嶅簲璇ュ鎴鳳紝鍚屾椂鑷繁緇х畫鐩戝惉鏈嶅姟绔彛錛屼嬌鍚庢潵鐨勫鎴蜂篃 鑳藉強鏃跺緱鍒版湇鍔°?br />
浜岋紝涓ょ被浼犺緭鍗忚錛歍CP錛沀DP

TCP鏄疶ranfer Control Protocol鐨?nbsp;綆縐幫紝鏄竴縐嶉潰鍚戣繛鎺ョ殑淇濊瘉鍙潬浼犺緭鐨勫崗璁傞氳繃TCP鍗忚浼犺緭錛屽緱鍒扮殑鏄竴涓『搴忕殑鏃犲樊閿欑殑鏁版嵁嫻併傚彂閫佹柟鍜屾帴鏀舵柟鐨勬垚瀵圭殑涓や釜socket涔嬮棿蹇呴』寤?nbsp;绔嬭繛鎺ワ紝浠ヤ究鍦═CP鍗忚鐨勫熀紜涓婅繘琛岄氫俊錛屽綋涓涓猻ocket錛堥氬父閮芥槸server socket錛夌瓑寰呭緩绔嬭繛鎺ユ椂錛屽彟涓涓猻ocket鍙互瑕佹眰榪涜榪炴帴錛屼竴鏃﹁繖涓や釜socket榪炴帴璧鋒潵錛屽畠浠氨鍙互榪涜鍙屽悜鏁版嵁浼犺緭錛屽弻鏂歸兘鍙互榪涜鍙戦?nbsp;鎴栨帴鏀舵搷浣溿?br />
UDP鏄疷ser Datagram Protocol鐨勭畝縐幫紝鏄竴縐嶆棤榪炴帴鐨勫崗璁紝姣忎釜鏁版嵁鎶ラ兘鏄竴涓嫭绔嬬殑淇℃伅錛屽寘鎷畬鏁寸殑婧愬湴鍧鎴栫洰鐨勫湴鍧錛屽畠鍦ㄧ綉緇滀笂浠ヤ換浣曞彲鑳界殑璺緞浼犲線鐩殑鍦幫紝鍥犳鑳藉惁鍒拌揪鐩殑鍦幫紝鍒拌揪鐩殑鍦扮殑鏃墮棿浠ュ強鍐呭鐨勬紜ч兘鏄笉鑳借淇濊瘉鐨勩?br />
姣旇緝錛?br />
UDP錛?錛屾瘡涓暟鎹姤涓兘緇欏嚭浜嗗畬鏁寸殑鍦板潃淇℃伅錛屽洜姝ゆ棤闇瑕佸緩绔嬪彂閫佹柟鍜屾帴鏀舵柟鐨勮繛鎺ャ?br />
            2錛孶DP浼犺緭鏁版嵁鏃舵槸鏈夊ぇ灝忛檺鍒剁殑錛屾瘡涓浼犺緭鐨勬暟鎹姤蹇呴』闄愬畾鍦?4KB涔嬪唴銆?br />
           3錛孶DP鏄竴涓笉鍙潬鐨勫崗璁紝鍙戦佹柟鎵鍙戦佺殑鏁版嵁鎶ュ茍涓嶄竴瀹氫互鐩稿悓鐨勬搴忓埌杈炬帴鏀舵柟

TCP錛?錛岄潰鍚戣繛鎺ョ殑鍗忚錛屽湪socket涔嬮棿榪涜鏁版嵁浼犺緭涔嬪墠蹇呯劧瑕佸緩绔嬭繛鎺ワ紝鎵浠ュ湪TCP涓渶瑕佽繛鎺?br />
                鏃墮棿銆?br />
            2錛孴CP浼犺緭鏁版嵁澶у皬闄愬埗錛屼竴鏃﹁繛鎺ュ緩绔嬭搗鏉ワ紝鍙屾柟鐨剆ocket灝卞彲浠ユ寜緇熶竴鐨勬牸寮忎紶杈撳ぇ鐨?nbsp; 

                    鏁版嵁銆?br />
             3錛孴CP鏄竴涓彲闈犵殑鍗忚錛屽畠紜繚鎺ユ敹鏂瑰畬鍏ㄦ紜湴鑾峰彇鍙戦佹柟鎵鍙戦佺殑鍏ㄩ儴鏁版嵁銆?br />
搴旂敤錛?br />
1錛孴CP鍦ㄧ綉緇滈氫俊涓婃湁鏋佸己鐨勭敓鍛藉姏錛屼緥濡傝繙紼嬭繛鎺ワ紙Telnet錛夊拰鏂囦歡浼犺緭錛團TP錛夐兘闇瑕佷笉瀹氶暱搴︾殑鏁版嵁琚彲闈犲湴浼犺緭銆備絾鏄彲闈犵殑浼犺緭鏄浠樺嚭浠d環鐨勶紝瀵規暟鎹唴瀹規紜х殑媯楠屽繀鐒跺崰鐢ㄨ綆楁満鐨勫鐞嗘椂闂村拰緗戠粶鐨勫甫瀹斤紝鍥犳TCP浼犺緭鐨勬晥鐜囦笉濡俇DP楂樸?br />
2錛孶DP鎿嶄綔綆鍗曪紝鑰屼笖浠呴渶瑕佽緝灝戠殑鐩戞姢錛屽洜姝ら氬父鐢ㄤ簬灞鍩熺綉楂樺彲闈犳х殑鍒嗘暎緋葷粺涓璫lient/server搴旂敤紼嬪簭銆備緥濡傝棰戜細璁郴緇燂紝騫朵笉瑕佹眰闊抽瑙嗛鏁版嵁緇濆鐨勬紜紝鍙淇濊瘉榪炶瘡鎬у氨鍙互浜嗭紝榪欑鎯呭喌涓嬫樉鐒朵嬌鐢║DP浼氭洿鍚堢悊涓浜涖?br />
涓夛紝鍩轟簬Socket鐨刯ava緗戠粶緙栫▼

1錛屼粈涔堟槸Socket

緗戠粶涓婄殑涓や釜紼嬪簭閫氳繃涓涓弻鍚戠殑閫氳榪炴帴瀹炵幇鏁版嵁鐨勪氦鎹紝榪欎釜鍙屽悜閾捐礬鐨勪竴绔О涓轟竴涓猄ocket銆係ocket閫氬父鐢ㄦ潵瀹炵幇瀹㈡埛鏂瑰拰鏈嶅姟鏂圭殑榪炴帴銆係ocket鏄疶CP/IP鍗忚鐨勪竴涓崄鍒嗘祦琛岀殑緙栫▼鐣岄潰錛屼竴涓猄ocket鐢變竴涓狪P鍦板潃鍜屼竴涓鍙e彿鍞竴紜畾銆?br />
浣嗘槸錛孲ocket鎵鏀寔鐨勫崗璁綾諱篃涓嶅厜TCP/IP涓縐嶏紝鍥犳涓よ呬箣闂存槸娌℃湁蹇呯劧鑱旂郴鐨勩傚湪Java鐜涓嬶紝Socket緙栫▼涓昏鏄寚鍩轟簬TCP/IP鍗忚鐨勭綉緇滅紪紼嬨?br />
2錛孲ocket閫氳鐨勮繃紼?br />
Server绔疞isten(鐩戝惉)鏌愪釜绔彛鏄惁鏈夎繛鎺ヨ姹傦紝Client绔悜Server 绔彂鍑篊onnect(榪炴帴)璇鋒眰錛孲erver绔悜Client绔彂鍥濧ccept錛堟帴鍙楋級娑堟伅銆備竴涓繛鎺ュ氨寤虹珛璧鋒潵浜嗐係erver绔拰Client 绔兘鍙互閫氳繃Send錛學rite絳夋柟娉曚笌瀵規柟閫氫俊銆?br />
瀵逛簬涓涓姛鑳介綈鍏ㄧ殑Socket錛岄兘瑕佸寘鍚互涓嬪熀鏈粨鏋勶紝鍏跺伐浣滆繃紼嬪寘鍚互涓嬪洓涓熀鏈殑姝ラ錛?br />
銆銆錛?錛?nbsp;鍒涘緩Socket錛?br />
銆銆錛?錛?nbsp;鎵撳紑榪炴帴鍒癝ocket鐨勮緭鍏?鍑烘祦錛?br />
銆銆錛?錛?nbsp;鎸夌収涓瀹氱殑鍗忚瀵筍ocket榪涜璇?鍐欐搷浣滐紱

銆銆錛?錛?nbsp;鍏抽棴Socket.錛堝湪瀹為檯搴旂敤涓紝騫舵湭浣跨敤鍒版樉紺虹殑close錛岃櫧鐒跺緢澶氭枃绔犻兘鎺ㄨ崘濡傛錛屼笉榪囧湪鎴戠殑紼嬪簭涓紝鍙兘鍥犱負紼嬪簭鏈韓姣旇緝綆鍗曪紝瑕佹眰涓嶉珮錛屾墍浠ュ茍鏈犳垚浠涔堝獎鍝嶃傦級

3錛屽垱寤篠ocket

鍒涘緩Socket

java鍦ㄥ寘java.net涓彁渚涗簡涓や釜綾籗ocket鍜孲erverSocket錛屽垎鍒敤鏉ヨ〃紺哄弻鍚戣繛鎺ョ殑瀹㈡埛绔拰鏈嶅姟绔傝繖鏄袱涓皝瑁呭緱闈炲父濂界殑綾伙紝浣跨敤寰堟柟渚褲傚叾鏋勯犳柟娉曞涓嬶細

銆銆Socket(InetAddress address, int port);

銆銆Socket(InetAddress address, int port, boolean stream);

銆銆Socket(String host, int prot);

銆銆Socket(String host, int prot, boolean stream);

銆銆Socket(SocketImpl impl)

銆銆Socket(String host, int port, InetAddress localAddr, int localPort)

銆銆Socket(InetAddress address, int port, InetAddress localAddr, int localPort)

銆銆ServerSocket(int port);

銆銆ServerSocket(int port, int backlog);

銆銆ServerSocket(int port, int backlog, InetAddress bindAddr)

銆銆鍏朵腑address銆乭ost鍜宲ort鍒嗗埆鏄弻鍚戣繛鎺ヤ腑鍙︿竴鏂圭殑IP鍦板潃銆佷富鏈哄悕鍜岀 鍙e彿錛宻tream鎸囨槑socket鏄祦socket榪樻槸鏁版嵁鎶ocket錛宭ocalPort琛ㄧず鏈湴涓繪満鐨勭鍙e彿錛宭ocalAddr鍜?nbsp;bindAddr鏄湰鍦版満鍣ㄧ殑鍦板潃錛圫erverSocket鐨勪富鏈哄湴鍧錛夛紝impl鏄痵ocket鐨勭埗綾伙紝鏃㈠彲浠ョ敤鏉ュ垱寤簊erverSocket鍙堝彲 浠ョ敤鏉ュ垱寤篠ocket銆俢ount鍒欒〃紺烘湇鍔$鎵鑳芥敮鎸佺殑鏈澶ц繛鎺ユ暟銆備緥濡傦細瀛︿範瑙嗛緗?nbsp;http://www.xxspw.com

銆銆Socket client = new Socket("127.0.01.", 80);

銆銆ServerSocket server = new ServerSocket(80);

銆銆娉ㄦ剰錛屽湪閫夋嫨绔彛鏃訛紝蹇呴』灝忓績銆傛瘡涓涓鍙f彁渚涗竴縐嶇壒瀹氱殑鏈嶅姟錛屽彧鏈夌粰鍑烘紜殑绔彛錛屾墠 鑳借幏寰楃浉搴旂殑鏈嶅姟銆?~1023鐨勭鍙e彿涓虹郴緇熸墍淇濈暀錛屼緥濡俬ttp鏈嶅姟鐨勭鍙e彿涓?0,telnet鏈嶅姟鐨勭鍙e彿涓?1,ftp鏈嶅姟鐨勭鍙e彿涓?3, 鎵浠ユ垜浠湪閫夋嫨绔彛鍙鋒椂錛屾渶濂介夋嫨涓涓ぇ浜?023鐨勬暟浠ラ槻姝㈠彂鐢熷啿紿併?br />
銆銆鍦ㄥ垱寤簊ocket鏃跺鏋滃彂鐢熼敊璇紝灝嗕駭鐢烮OException錛屽湪紼嬪簭涓繀欏誨涔嬩綔鍑哄鐞嗐傛墍浠ュ湪鍒涘緩Socket鎴朣erverSocket鏄繀欏繪崟鑾鋒垨鎶涘嚭渚嬪銆?br />
4錛岀畝鍗曠殑Client/Server紼嬪簭

1. 瀹㈡埛绔▼搴?br />
銆銆import java.io.*;

銆銆import java.net.*;

銆銆public class TalkClient {

銆銆銆銆public static void main(String args[]) {

銆銆銆銆銆銆try{

銆銆銆銆銆銆銆銆Socket socket=new Socket("127.0.0.1",4700);

銆銆銆銆銆銆銆銆//鍚戞湰鏈虹殑4700绔彛鍙戝嚭瀹㈡埛璇鋒眰

銆銆銆銆銆銆銆銆BufferedReader sin=new BufferedReader(new InputStreamReader(System.in));

銆銆銆銆銆銆銆銆//鐢辯郴緇熸爣鍑嗚緭鍏ヨ澶囨瀯閫燘ufferedReader瀵硅薄

銆銆銆銆銆銆銆銆PrintWriter os=new PrintWriter(socket.getOutputStream());

銆銆銆銆銆銆銆銆//鐢盨ocket瀵硅薄寰楀埌杈撳嚭嫻侊紝騫舵瀯閫燩rintWriter瀵硅薄

銆銆銆銆銆銆銆銆BufferedReader is=new BufferedReader(new InputStreamReader(socket.getInputStream()));

銆銆銆銆銆銆銆銆//鐢盨ocket瀵硅薄寰楀埌杈撳叆嫻侊紝騫舵瀯閫犵浉搴旂殑BufferedReader瀵硅薄

銆銆銆銆銆銆銆銆String readline;

銆銆銆銆銆銆銆銆readline=sin.readLine(); //浠庣郴緇熸爣鍑嗚緭鍏ヨ鍏ヤ竴瀛楃涓?/span>

銆銆銆銆銆銆銆銆while(!readline.equals("bye")){

銆銆銆銆銆銆銆銆//鑻ヤ粠鏍囧噯杈撳叆璇誨叆鐨勫瓧絎︿覆涓?nbsp;"bye"鍒欏仠姝㈠驚鐜?/span>

銆銆銆銆銆銆銆銆銆銆os.println(readline);

銆銆銆銆銆銆銆銆銆銆//灝嗕粠緋葷粺鏍囧噯杈撳叆璇誨叆鐨勫瓧絎︿覆杈撳嚭鍒癝erver

銆銆銆銆銆銆銆銆銆銆os.flush();

銆銆銆銆銆銆銆銆銆銆//鍒鋒柊杈撳嚭嫻侊紝浣縎erver椹笂鏀跺埌璇ュ瓧絎︿覆

銆銆銆銆銆銆銆銆銆銆System.out.println("Client:"+readline);

銆銆銆銆銆銆銆銆銆銆//鍦ㄧ郴緇熸爣鍑嗚緭鍑轟笂鎵撳嵃璇誨叆鐨勫瓧絎︿覆

銆銆銆銆銆銆銆銆銆銆System.out.println("Server:"+is.readLine());

銆銆銆銆銆銆銆銆銆銆//浠嶴erver璇誨叆涓瀛楃涓詫紝騫舵墦鍗板埌鏍囧噯杈撳嚭涓?/span>

銆銆銆銆銆銆銆銆銆銆readline=sin.readLine(); //浠庣郴緇熸爣鍑嗚緭鍏ヨ鍏ヤ竴瀛楃涓?/span>

銆銆銆銆銆銆銆銆} //緇х畫寰幆

銆銆銆銆銆銆銆銆os.close(); //鍏抽棴Socket杈撳嚭嫻?/span>

銆銆銆銆銆銆銆銆is.close(); //鍏抽棴Socket杈撳叆嫻?/span>

銆銆銆銆銆銆銆銆socket.close(); //鍏抽棴Socket

銆銆銆銆銆銆}catch(Exception e) {

銆銆銆銆銆銆銆銆System.out.println("Error"+e); //鍑洪敊錛屽垯鎵撳嵃鍑洪敊淇℃伅

銆銆銆銆銆銆}

銆銆}

}

銆2. 鏈嶅姟鍣ㄧ紼嬪簭

銆銆import java.io.*;

銆銆import java.net.*;

銆銆import java.applet.Applet;

銆銆public class TalkServer{

銆銆銆銆public static void main(String args[]) {

銆銆銆銆銆銆try{

銆銆銆銆銆銆銆銆ServerSocket server=null;

銆銆銆銆銆銆銆銆try{

銆銆銆銆銆銆銆銆銆銆server=new ServerSocket(4700);

銆銆銆銆銆銆銆銆//鍒涘緩涓涓猄erverSocket鍦ㄧ鍙?700鐩戝惉瀹㈡埛璇鋒眰

銆銆銆銆銆銆銆銆}catch(Exception e) {

銆銆銆銆銆銆銆銆銆銆System.out.println("can not listen to:"+e);

銆銆銆銆銆銆銆銆//鍑洪敊錛屾墦鍗板嚭閿欎俊鎭?/span>

銆銆銆銆銆銆銆銆}

銆銆銆銆銆銆銆銆Socket socket=null;

銆銆銆銆銆銆銆銆try{

銆銆銆銆銆銆銆銆銆銆socket=server.accept();

銆銆銆銆銆銆銆銆銆銆//浣跨敤accept()闃誨絳夊緟瀹㈡埛璇鋒眰錛屾湁瀹㈡埛

銆銆銆銆銆銆銆銆銆銆
//璇鋒眰鍒版潵鍒欎駭鐢熶竴涓猄ocket瀵硅薄錛屽茍緇х畫鎵ц

銆銆銆銆銆銆銆銆}catch(Exception e) {

銆銆銆銆銆銆銆銆銆銆System.out.println("Error."+e);

銆銆銆銆銆銆銆銆銆銆//鍑洪敊錛屾墦鍗板嚭閿欎俊鎭?/span>

銆銆銆銆銆銆銆銆}

銆銆銆銆銆銆銆銆String line;

銆銆銆銆銆銆銆銆BufferedReader is=new BufferedReader(new InputStreamReader(socket.getInputStream()));

銆銆銆銆銆銆銆銆銆//鐢盨ocket瀵硅薄寰楀埌杈撳叆嫻侊紝騫舵瀯閫犵浉搴旂殑BufferedReader瀵硅薄

銆銆銆銆銆銆銆銆PrintWriter os=newPrintWriter(socket.getOutputStream());

銆銆銆銆銆銆銆銆銆//鐢盨ocket瀵硅薄寰楀埌杈撳嚭嫻侊紝騫舵瀯閫燩rintWriter瀵硅薄

銆銆銆銆銆銆銆銆BufferedReader sin=new BufferedReader(new InputStreamReader(System.in));

銆銆銆銆銆銆銆銆銆//鐢辯郴緇熸爣鍑嗚緭鍏ヨ澶囨瀯閫燘ufferedReader瀵硅薄

銆銆銆銆銆銆銆銆System.out.println("Client:"+is.readLine());

銆銆銆銆銆銆銆銆//鍦ㄦ爣鍑嗚緭鍑轟笂鎵撳嵃浠庡鎴風璇誨叆鐨勫瓧絎︿覆

銆銆銆銆銆銆銆銆line=sin.readLine();

銆銆銆銆銆銆銆銆//浠庢爣鍑嗚緭鍏ヨ鍏ヤ竴瀛楃涓?/span>

銆銆銆銆銆銆銆銆while(!line.equals("bye")){

銆銆銆銆銆銆銆銆//濡傛灉璇ュ瓧絎︿覆涓?nbsp;"bye"錛屽垯鍋滄寰幆

銆銆銆銆銆銆銆銆銆銆os.println(line);

銆銆銆銆銆銆銆銆銆銆//鍚戝鎴風杈撳嚭璇ュ瓧絎︿覆

銆銆銆銆銆銆銆銆銆銆os.flush();

銆銆銆銆銆銆銆銆銆銆//鍒鋒柊杈撳嚭嫻侊紝浣緾lient椹笂鏀跺埌璇ュ瓧絎︿覆

銆銆銆銆銆銆銆銆銆銆System.out.println("Server:"+line);

銆銆銆銆銆銆銆銆銆銆//鍦ㄧ郴緇熸爣鍑嗚緭鍑轟笂鎵撳嵃璇誨叆鐨勫瓧絎︿覆

銆銆銆銆銆銆銆銆銆銆System.out.println("Client:"+is.readLine());

銆銆銆銆銆銆銆銆銆銆//浠嶤lient璇誨叆涓瀛楃涓詫紝騫舵墦鍗板埌鏍囧噯杈撳嚭涓?/span>

銆銆銆銆銆銆銆銆銆銆line=sin.readLine();

銆銆銆銆銆銆銆銆銆銆//浠庣郴緇熸爣鍑嗚緭鍏ヨ鍏ヤ竴瀛楃涓?/span>

銆銆銆銆銆銆銆銆} 銆//緇х畫寰幆

銆銆銆銆銆銆銆銆os.close(); //鍏抽棴Socket杈撳嚭嫻?/span>

銆銆銆銆銆銆銆銆is.close(); //鍏抽棴Socket杈撳叆嫻?/span>

銆銆銆銆銆銆銆銆socket.close(); //鍏抽棴Socket

銆銆銆銆銆銆銆銆server.close(); //鍏抽棴ServerSocket

銆銆銆銆銆銆}catch(Exception e){

銆銆銆銆銆銆銆銆System.out.println("Error:"+e);

銆銆銆銆銆銆銆銆//鍑洪敊錛屾墦鍗板嚭閿欎俊鎭?/span>

銆銆銆銆銆銆}

銆銆銆銆}

銆銆}

5錛屾敮鎸佸瀹㈡埛鐨刢lient/server紼嬪簭

鍓嶉潰鐨凜lient/Server紼嬪簭鍙兘瀹炵幇Server鍜屼竴涓鎴風殑瀵硅瘽銆傚湪瀹為檯搴旂敤 涓紝寰寰鏄湪鏈嶅姟鍣ㄤ笂榪愯涓涓案涔呯殑紼嬪簭錛屽畠鍙互鎺ユ敹鏉ヨ嚜鍏朵粬澶氫釜瀹㈡埛绔殑璇鋒眰錛屾彁渚涚浉搴旂殑鏈嶅姟銆備負浜嗗疄鐜板湪鏈嶅姟鍣ㄦ柟緇欏涓鎴鋒彁渚涙湇鍔$殑鍔熻兘錛岄渶瑕佸涓?nbsp;闈㈢殑紼嬪簭榪涜鏀歸狅紝鍒╃敤澶氱嚎紼嬪疄鐜板瀹㈡埛鏈哄埗銆傛湇鍔″櫒鎬繪槸鍦ㄦ寚瀹氱殑绔彛涓婄洃鍚槸鍚︽湁瀹㈡埛璇鋒眰錛屼竴鏃︾洃鍚埌瀹㈡埛璇鋒眰錛屾湇鍔″櫒灝變細鍚姩涓涓笓闂ㄧ殑鏈嶅姟綰跨▼鏉ュ搷 搴旇瀹㈡埛鐨勮姹傦紝鑰屾湇鍔″櫒鏈韓鍦ㄥ惎鍔ㄥ畬綰跨▼涔嬪悗椹笂鍙堣繘鍏ョ洃鍚姸鎬侊紝絳夊緟涓嬩竴涓鎴風殑鍒版潵銆?/div>

youngturk 2016-06-19 22:20 鍙戣〃璇勮
]]>java 鐜鍙橀噺閰嶇疆http://www.tkk7.com/youngturk/archive/2016/06/19/430969.htmlyoungturkyoungturkSun, 19 Jun 2016 14:18:00 GMThttp://www.tkk7.com/youngturk/archive/2016/06/19/430969.htmlhttp://www.tkk7.com/youngturk/comments/430969.htmlhttp://www.tkk7.com/youngturk/archive/2016/06/19/430969.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/430969.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/430969.html

youngturk 2016-06-19 22:18 鍙戣〃璇勮
]]>
JVM浠嬬粛 http://www.tkk7.com/youngturk/archive/2016/06/19/430968.htmlyoungturkyoungturkSun, 19 Jun 2016 14:11:00 GMThttp://www.tkk7.com/youngturk/archive/2016/06/19/430968.htmlhttp://www.tkk7.com/youngturk/comments/430968.htmlhttp://www.tkk7.com/youngturk/archive/2016/06/19/430968.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/430968.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/430968.html

youngturk 2016-06-19 22:11 鍙戣〃璇勮
]]>
鍏充簬Tomcat 6鐨勭儹閮ㄧ講鍜岀儹鍔犺澆 杞?/title><link>http://www.tkk7.com/youngturk/archive/2016/06/19/430967.html</link><dc:creator>youngturk</dc:creator><author>youngturk</author><pubDate>Sun, 19 Jun 2016 13:03:00 GMT</pubDate><guid>http://www.tkk7.com/youngturk/archive/2016/06/19/430967.html</guid><wfw:comment>http://www.tkk7.com/youngturk/comments/430967.html</wfw:comment><comments>http://www.tkk7.com/youngturk/archive/2016/06/19/430967.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/youngturk/comments/commentRss/430967.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/youngturk/services/trackbacks/430967.html</trackback:ping><description><![CDATA[http://greemranqq.iteye.com/blog/1774258 <br /><div>http://www.cnblogs.com/-lpf/p/4317281.html</div><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">鎴戝湪欏圭洰寮鍙戣繃紼嬩腑錛岀粡甯歌鏀瑰姩JAVA/JSP 鏂囦歡錛屼絾鏄張涓嶆兂浠庢柊鍚姩鏈嶅姟鍣?鏈嶅姟鍣ㄤ粠鏂板惎鍔ㄨ姳鏃墮棿)錛屾兂鐩存帴鑾峰緱錛坉ebug錛夌粨鏋?鏈変袱縐嶆柟寮忕儹閮ㄧ講 鍜岀儹鍔犺澆錛?/span><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">1.鐑姞杞斤細鍦╯erver.xml -> context 灞炴т腑 璁劇疆 reloadable="true"</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"> </p><div class="1111616" id="" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; width: 679px; margin-left: 9px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; line-height: 25.2000007629395px; background-color: #ffffff;"><div><div style="padding-right: 3px; padding-bottom: 3px; padding-left: 3px; margin: 0px; font-weight: bold;">Java浠g爜  <a title="鏀惰棌榪欐浠g爜" style="color: #108ac6; text-decoration: underline;"><img src="http://greemranqq.iteye.com/images/icon_star.png" alt="鏀惰棌浠g爜" style="border: 0px;" /></a></div></div><ol start="1" style="font-size: 1em; line-height: 1.4em; margin-left: 0px; padding-top: 2px; padding-bottom: 2px; border: 1px solid #d1d7dc; color: #2b91af;"><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; line-height: 18px; background-color: #fafafa;"><Context docBase="xxx" path="/xxx" reloadable="true"/>  </li></ol></div><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">    </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">2. 鐑儴緗詫細鍦╯erver.xml -> context 灞炴т腑 璁劇疆  autoDeploy="true"</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">  </p><div class="6611161" id="" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; width: 679px; margin-left: 9px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; line-height: 25.2000007629395px; background-color: #ffffff;"><div><div style="padding-right: 3px; padding-bottom: 3px; padding-left: 3px; margin: 0px; font-weight: bold;">Java浠g爜  <a title="鏀惰棌榪欐浠g爜" style="color: #108ac6; text-decoration: underline;"><img src="http://greemranqq.iteye.com/images/icon_star.png" alt="鏀惰棌浠g爜" style="border: 0px;" /></a></div></div><ol start="1" style="font-size: 1em; line-height: 1.4em; margin-left: 0px; padding-top: 2px; padding-bottom: 2px; border: 1px solid #d1d7dc; color: #2b91af;"><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; line-height: 18px; background-color: #fafafa;"><Context docBase="xxx" path="/xxx" autoDeploy="true"/>  </li></ol></div><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">3.鍖哄埆錛?/p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">      鐑姞杞斤細鏈嶅姟鍣ㄤ細鐩戝惉 class 鏂囦歡鏀瑰彉錛屽眬閮ㄨ繘琛屽姞杞斤紝涓嶆竻絀簊ession 錛屼笉閲婃斁鍐呭瓨銆傚紑鍙戜腑鐢ㄧ殑澶氾紝浣嗘槸瑕佽冭檻鍐呭瓨婧㈠嚭鐨勬儏鍐點?/p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">      鐑儴緗詫細 鏁翠釜欏圭洰浠庢柊閮ㄧ講錛屽寘鎷綘浠庢柊鎵撲笂<strong>.war 鏂囦歡銆?浼氭竻絀簊ession 錛岄噴鏀懼唴瀛樸傞」鐩墦鍖呯殑鏃跺欑敤鐨勫銆?/strong></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">涔熷彲浠ラ氳繃Eclipse涓婅緗疄鐜頒笂榪伴厤緗枃浠剁殑淇敼 </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">Eclipse鐨勫伐紼嬪悕鍙抽敭: properties->Tomcat->General->Make this context as reloadable(reloadable="true")涓嶈閫変腑 Eclipse鐨勫伐紼嬪悕鍙抽敭:Tomcat project->Update Context Definition</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"></p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;">娉ㄦ剰:source 灞炴ф湁浜涚増鏈笉鏀寔錛屽鏄撳嚭閿欙紝鍘繪帀灝辮 <br /><br />浜屻?br /></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">涓嶉噸鍚疶omcat鏈変袱縐嶆柟寮忥細鐑儴緗層佺儹鍔犺澆 <br style="margin: 0px; padding: 0px;" />銆銆鐑儴緗詫細瀹瑰櫒鐘跺喌鍦ㄨ繍琛屾椂閲嶆柊閮ㄧ講鏁翠釜欏圭洰銆傝繖綾葷幆澧冧笅涓鑸暣涓唴瀛樹細娓呯┖,閲嶆柊鍔犺澆錛岃繖綾繪柟寮?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆鏈夊彲鑳戒細閫犳垚sessin涓㈠け絳夌幆澧冦倀omcat 6紜疄鍙互鐑儴緗蹭簡,鑰屼笖瀵硅瘽涔熸病涓? <br style="margin: 0px; padding: 0px;" />銆銆鐑姞杞斤細鏈濂芥槸鍦ㄨ皟璇曡繃紼嬩腑浣跨敤錛屽厤鎮d笂鏁翠釜欏圭洰鍔犺澆,Debug鏍囧噯鏍峰紡鏀寔鐑姞杞姐傚鍣ㄧ姸鍐靛湪榪愯鏃墮噸 <br style="margin: 0px; padding: 0px;" />銆銆鏂板姞杞借漿鍙樼紪璇戝悗鐨勭被銆傚湪榪欑被鐜涓嬪唴瀛樹笉浼氭竻絀?sessin涓嶄細涓㈠け,浣嗗鏄撻犳垚鍐呭瓨婧㈠嚭,鎴栬呮壘涓嶅埌鏂?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆娉曘備竴鑸漿鍙樼被鐨勫竷灞鍜屾ā鍨嬪氨浼氭湁寮傚父錛屽湪宸茬粡鏈夌殑鍙橀噺鍜屾柟娉曚腑杞彉鏄笉浼氬嚭闂鐨?Eclipse銆?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆MyEclipse8銆丣Builder銆両ntelliJ IDEA…)銆?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆甯哥敤鐨勪竴瀹氱浜岀錛氱儹鍔犺澆浜嗭紝璁劇疆濡備笅錛?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆鍦╰omcat鐨刢onf涓殑server.xml涓殑host璁劇疆涓坊鍔?lt;Context path="/test" <br style="margin: 0px; padding: 0px;" />銆銆docBase="D:/develop/test" <br style="margin: 0px; padding: 0px;" />銆銆debug="0" privileged="true" reloadable="true"/> <br style="margin: 0px; padding: 0px;" />銆銆reloadable="true" !鏈閲嶈 <br style="margin: 0px; padding: 0px;" />銆銆瀹冨唴閲屾湁寰堝灞炴?鎰忎箟濡備笅錛?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆1>path:鎸囧畾鎷滃欒web搴旂敤鐨刄RL榪涘彛錛?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆2>docBase:鎸囧畾web搴旂敤鐨勬枃浠惰礬寰勶紝鍙互緇欏畾緇濆璺緞錛屼篃鍙互緇欏畾鐩稿浜?lt;Host>鐨刟ppBase灞炴с愰粯璁?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆鎸囧悜tomcat鐨剋ebapps銆戠殑鐩稿浜庡緞錛涜鏄疻eb搴旂敤鏄釜war鏂囦歡錛屽垯鎸囧畾war鏂囦歡鐨勮礬寰勩?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆3>className:鎸囧畾浣挎垚涓轟簨瀹濩ontext緇勪歡鐨凧ava綾葷殑鍚嶅瓧錛岃繖涓狫ava綾誨繀欏諱嬌鎴愪負浜嬪疄org.apache.catalina.Context <br style="margin: 0px; padding: 0px;" />銆銆鎺ュ彛錛岃灞炴х殑榛樿鍊間負org.apache.catalina.StandardContext銆?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆4>reloadable:瑕佹槸榪欎釜灞炴ц緗負true,Tomcat鏈嶅姟鍣ㄥ湪榪愯鐘跺喌涓嬩細鐩戣鍦╓EB-INF/classess鍜學EB- <br style="margin: 0px; padding: 0px;" />銆銆INF/lib鐩涓嬬殑class鏂囦歡鐨勬敼鍔紝浠ュ強鐩戣web搴旂敤鐨刉EB-INF/web.xml鏂囦歡鐨勬敼鍔ㄣ傝鏄嫻嬪埌鐨刢lass <br style="margin: 0px; padding: 0px;" />銆銆鏂囦歡鎴栬厀eb.xml鏂囦歡琚洿鏂幫紝鏈嶅姟鍣ㄤ細鑷姩鍔犺澆Web搴旂敤銆傝灞炴х殑榛樿鍊間負false.鍦╳eb搴旂敤鐨勫紑鍙戝拰璋?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆璇曢樁孌碉紝鎶妑eloadable璁句負true,鍙互鏂逛究瀵箇eb搴旂敤鐨勮皟璇曘傚湪web搴旂敤姝e紡鍙戝竷闃舵錛屾妸reloadable璁句負 <br style="margin: 0px; padding: 0px;" />銆銆false,鍙互鍑忎綆tomcat鐨勮繍琛岃礋鑽鳳紝鎻愰珮Tomcat鐨勮繍琛屾ц兘銆?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆5>cachingAllowed:瑕佹槸涓簍rue,鏍囩ず鍏佽鍚敤闈欐佽祫婧愮殑緙撳瓨銆備嬌鐢ㄧ紦瀛樿兘鎻愰珮鎷滃欓潤鎬佽祫婧愮殑鏁堢巼銆?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆tomcat鎶婇偅涓浜涙椂甯歌瀹㈡埛绔嫓鍊欑殑闈欐佽祫婧?濡?HTML鏂囨。銆佸浘鐗囨枃浠跺拰澹板搷鏂囦歡絳?鏀懼湪緙撳瓨涓紝褰撳鎴峰啀 <br style="margin: 0px; padding: 0px;" />銆銆嬈℃嫓鍊欐湁鍏抽潤鎬佽祫婧愭椂錛孴omcat鍙渶鐩存帴浠庣紦瀛樹腑璇誨彇鐩稿叧鏁版嵁錛屾棤欏誨弽澶嶈鍙栨枃浠剁郴緇熶腑鐨勬枃浠躲傝灞?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆鎬х殑榛樿鍊間負true. <br style="margin: 0px; padding: 0px;" />銆銆6>cacheMaxSize:璁懼畾闈欐佽祫婧愮殑緙撳瓨鐨勬渶澶у閲忥紝浠涓哄崟鍏冦傝鏄紝瑕佹槸璇ュ睘鎬т負100,琛ㄧず100K錛岄粯璁?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆涓?0240(鍗?0M)銆?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆7>workDir:鎸囧畾web搴旂敤鐨勫伐浣滅洰嬈°俆omcat鍦ㄨ繍琛屾椂浼氭妸涓庤繖涓獁eb搴旂敤鐩稿叧鐨勪復搴旇瘯鏂囩珷浠舵斁鍦ㄦ鐩涓嬨?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆8>uppackWar:瑕佹槸姝ら」璁句負true,琛ㄧず灝嗘妸web搴旂敤鐨剋ar鏂囦歡鐫佸紑涓哄紑鏀劇洰嬈″竷灞鍚庡啀榪愯銆傝鏄涓?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆false,鍒欑洿鎺ヨ繍琛寃ar鏂囦歡銆傝灞炴х殑榛樿鍊間負true銆?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆鍚屽織浠紝浣跨敤tomcat6.0鐨勬敞鎰忎簡鍟娿傚綋浣犱嬌鐢ㄦ垜鐨勬柟娉曡緗畉omcat鍚庯紝浣犵殑myeclipse鎶ュ涓嬮敊璇椂錛屼笉瑕佹儕鎱岋紝榪欐槸姝g‘鐨勶紝涓斿惉鎴戣В閲娿?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆console鎶ラ敊錛?nbsp;<br style="margin: 0px; padding: 0px;" />銆銆璀﹀憡: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ' debug' to '0' did not find a matching property. 榪欐槸鐢變簬浣犱嬌鐢ㄧ殑鏄痶omcat6.0,鐢變簬瀹冭礬紼嬬粡榪囪繃紼嬪叾浠栭斿緞瀵筪ebug="0"榪欎釜灞炴ц繘琛屼簡浣挎垚涓轟簨瀹烇紝鎵浠ヨ繖鎼笉鑳藉啀鏈夋灞炴с備綘鍙灝嗗畠鍘繪帀錛屽氨鑳藉娌′簨浜嗗惎鍔ㄤ簡銆?涔熷氨鏄鍘繪帀debug="0“錛屼竾浜婳K錛屽懙鍛點?nbsp;</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.2000007629395px; background-color: #ffffff;"><br /></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">(杞?</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">-------------------------------------------------------------</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">閽堝闇瑕侀噸鏂板惎鍔╰omcat鐨勬湇鍔?閲嶆柊鍚姩鏂瑰紡涓?</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">瀹夎鐗?tomcat/bin/shotdown.bat      鍏抽棴tomcat鏈嶅姟</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">          tomcat/bin/startup.bat         寮鍚痶omcat鏈嶅姟</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; line-height: 19.5px; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; background-color: #fefef2;">鎴栬?->鎴戠殑鐢佃剳-->綆$悊-->鏈嶅姟鍜屽簲鐢ㄧ▼搴?鏈嶅姟-->鎵懼埌Apache Tomcat閲嶅惎</p><img src ="http://www.tkk7.com/youngturk/aggbug/430967.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/youngturk/" target="_blank">youngturk</a> 2016-06-19 21:03 <a href="http://www.tkk7.com/youngturk/archive/2016/06/19/430967.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>apache tomcat mod_js閰嶇疆鏁村悎錛?/title><link>http://www.tkk7.com/youngturk/archive/2016/06/19/430963.html</link><dc:creator>youngturk</dc:creator><author>youngturk</author><pubDate>Sun, 19 Jun 2016 12:42:00 GMT</pubDate><guid>http://www.tkk7.com/youngturk/archive/2016/06/19/430963.html</guid><wfw:comment>http://www.tkk7.com/youngturk/comments/430963.html</wfw:comment><comments>http://www.tkk7.com/youngturk/archive/2016/06/19/430963.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/youngturk/comments/commentRss/430963.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/youngturk/services/trackbacks/430963.html</trackback:ping><description><![CDATA[http://blog.sina.com.cn/s/blog_3c9872d00102w00y.html<br /><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"><span style="word-wrap: normal; word-break: normal; line-height: 19.5px; font-size: 13px; background-color: #ffffff;">Apache涓嶵omcat鏁村悎搴旂敤鏄竴涓佽瘽棰橈紝涓嶇畻鏂版妧鑳斤紝浣嗗闈炶繍緇翠漢鍛樺湪閰嶇疆榪囩▼涓垨璁鎬篃浼氶亣鍒頒竴浜涢棶棰樸傝繖閲屽彧鏄妸鑷繁澶氬洖閰嶇疆鐨勮繃紼嬪仛涓涓憳褰曪紝渚涜嚜宸辯炕闃呭茍鏈涘榪囪礬鐨勪漢鏈夌敤銆?/span></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"><span style="word-wrap: normal; word-break: normal; line-height: 19.5px; font-size: 13px; background-color: #ffffff;">Apache鏄綋涓嬪湪Windows銆乁nix銆丩inux 絳夋搷浣滅郴緇熶腑鏈嫻佽鐨刉eb鏈嶅姟鍣ㄨ蔣浠朵箣涓錛屽叾鍙嶅簲閫熷害蹇佽繍琛屾晥鐜囬珮錛屼笉浠呮敮鎸丠TML絳夐潤鎬侀〉闈紝鍦ㄥ姞杞芥彃浠跺悗涔熷彲鏀寔 PHP 欏甸潰絳夈俆omcat鏄疉pache杞歡鍩洪噾鍗忎細涓嶴un鍏徃鑱斿悎寮鍙戠殑Web鏈嶅姟鍣紝闄ゆ敮鎸丠TML闈欐侀〉闈㈠錛岃繕鏄疛SP銆丼ervlet絳塉AVA WEB搴旂敤鐨勬湇鍔″櫒銆傚湪鐩稿悓榪愯鐜涓嬶紝Tomcat瀵歸潤鎬侀〉闈㈢殑鍙嶅簲閫熷害娌℃湁Apache鐏墊晱錛屾暣鍚?Apache涓嶵omcat鑳戒嬌緋葷粺榪愯浜庝竴涓壇濂界幆澧冧笅錛屽疄鐜癑AVA鐨勫姩鎬佷笌闈欐侀〉闈㈠垎紱伙紝涓嶄粎璁╃郴緇熸洿瀹夊叏錛屽悓鏃朵篃鍙彁楂樼郴緇熸晥鐜囥?/span></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"><span style="word-wrap: normal; word-break: normal; line-height: 19.5px; font-size: 13px; background-color: #ffffff;"><br /></span></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"><span style="word-wrap: normal; word-break: normal; line-height: 19.5px; background-color: #ffffff;"><strong>涓銆丣AVA搴旂敤鍩虹鏋舵瀯</strong></span></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"><span style="word-wrap: normal; word-break: normal; line-height: 19.5px; font-size: 13px; text-indent: 2em; background-color: #ffffff;"><br /></span></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"><span style="word-wrap: normal; word-break: normal; line-height: 19.5px; font-size: 13px; text-indent: 2em; background-color: #ffffff;">閫氱敤鐨凧AVA搴旂敤鏋舵瀯濡備笅錛屽寘鎷琖EB Server銆丄PP Server鍜孌B Server涓変釜閮ㄥ垎錛?/span></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"><div><a target="_blank" style="text-decoration: none; color: #074387;"><img src="http://s5.sinaimg.cn/mw690/0016NEiszy6U3Trv2io14&690" real_src="http://s5.sinaimg.cn/mw690/0016NEiszy6U3Trv2io14&690" name="image_operate_89061437641576399" alt="Apache鍜孴omcat鏁村悎閰嶇疆瀹炵幇JAVA搴旂敤鐨?#8220;鍔ㄩ潤”鍒嗙" title="Apache鍜孴omcat鏁村悎閰嶇疆瀹炵幇JAVA搴旂敤鐨?#8220;鍔ㄩ潤”鍒嗙" action-data="http%3A%2F%2Fs5.sinaimg.cn%2Fmw690%2F0016NEiszy6U3Trv2io14%26690" action-type="show-slide" style="margin: 0px; padding: 0px; border: 0px; list-style: none;" /></a></div><div><strong>1銆乄EB Server</strong></div><div><div>WEB Server緗簬浼佷笟闃茬伀澧欏錛岃繖涓槻鐏涔熷彲浠ヨ涓烘槸涓涓狢ISCO璺敱鍣紝鍦–ISCO璺敱鍣ㄤ笂寮鏀句袱涓鍙d負錛?0鍜?43錛屽叾涓細</div><div>80绔彛錛氱敤浜庢甯哥殑http璁塊棶</div><div>443绔彛錛氱敤浜巋ttps璁塊棶錛屽嵆濡傛灉浣犲湪ie閲屾墦鍏ttps://xxx.xxx.xx榪欐牱鐨勫湴鍧錛岄粯璁よ蛋鐨勬槸443榪欎釜绔彛</div><div>WebServer涓撻棬鐢ㄤ簬瑙f瀽HTML銆丣S錛圝avaScript錛夈丆SS銆丣PG/GIF絳夊浘鐗囨牸寮忔枃浠躲乀XT銆乂BSCRIPT銆丳HP絳?#8220;闈欐?#8221;緗戦〉鍐呭銆?/div><div><strong>2銆丄PP Server</strong></div><div><div>APP Server緗簬浼佷笟闃茬伀澧欏唴錛屽畠鍜學eb Server涔嬮棿鐨勮繛鎺ュ繀欏諱笖涓瀹氫負鍐呴儴IP榪炴帴銆侫pp Server鐢ㄤ簬瑙f瀽鎴戜滑鐨勪換浣曢渶瑕丣ava緙栬瘧鍣ㄦ墠鑳借В鏋愮殑“鍔ㄦ?#8221;緗戦〉錛屽叾瀹濧pp Server鏈韓涔熻兘瑙f瀽浠諱綍闈欐佺綉欏電殑銆傚湪搴旂敤涓垜浠繖鏍鋒潵鎯充竴涓嬶細鎴戜滑璁╄礋璐d笓闂ㄨВ鏋愰潤鎬佺綉欏電殑Web Server鏉ヨВ鏋恏tml絳夊唴瀹癸紝鑰岃App Server涓撻棬鐢ㄤ簬瑙f瀽浠諱綍闇瑕丣ava緙栬瘧鍣ㄦ墠鑳借В鏋愮殑涓滆タ錛岃瀹冧滑鍚勫徃鍏惰亴銆傝繖鏍蜂綔鐨勫ソ澶勶細</div><div> <wbr> 1錛変負App Server“鍑忓帇”錛屽悓鏃朵篃鎻愰珮浜嗘ц兘錛?/div><div> <wbr> 2錛変笉鐢ㄥ啀鎶?080榪欎釜绔彛鏆撮湶鍦╥nternet涓婏紝涔熷緢瀹夊叏錛屾瘯绔熸垜浠殑App Server涓婃槸鏈夋垜浠殑浠g爜鐨勶紝灝辯畻鏄紪璇戣繃鐨勪唬鐮佷篃瀹規槗琚?#8220;鍙嶇紪璇?#8221;錛岃繖鏄緢涓嶅畨鍏ㄧ殑錛?/div><div> <wbr> 3錛変負灝嗘潵榪涗竴姝ョ殑“闆嗙兢鎵╁睍”鎵撳ソ浜嗗熀紜銆?/div></div><div><strong>3銆丏B Server</strong></div><div> <wbr>姣旀柟璇存垜浠敤MySQL錛屽畠闇瑕侀氳繃3306涓嶢pp Server榪涜榪炴帴錛岄偅涔堣繖涓?521鎴戜滑縐頒負鏁版嵁搴撹繛鎺ョ鍙o紝濡傛灉鎶婂畠鏆撮湶鍦↖nternet涓婂氨姣旇緝鍗遍櫓錛屽氨綆楀瘑鐮佸緢澶嶆潅錛屼絾 瀵逛簬楂樻槑鐨勯粦瀹㈡潵璇達紝瑕佹敾鐮翠綘鐨勫彛浠や篃鍙槸鏃墮棿涓婄殑闂鑰屽繁銆傚洜姝ゆ垜浠妸鎴戜滑鐨凞B Server涔熷拰App Server涓鏍鳳紝緗簬鍐呯綉鐨勯槻鐏錛屼換浣曠殑DB榪炴帴涓庣鐞嗗彧鑳介氳繃鍐呯綉鏉ヨ闂?/div><div></div><div><strong>浜屻佺郴緇熷畨瑁呬笌閰嶇疆</strong></div><div></div><div>緋葷粺瀹夎鍖呮嫭MySQL鐨勫畨瑁咃紝WEB Server鍗矨pache鐨勫畨瑁咃紝App Server鍗砊omcat鐨勫畨瑁呫傚叧浜庤繖涓変釜緋葷粺瀹夎緗戜笂鐩稿叧鐨勬枃妗e緢澶氾紝姝ゅ鐣ュ幓銆備互涓嬩富瑕佹憳褰曢渶瑕侀噸鐐歸厤緗殑鍐呭銆?/div><div><strong>1銆丄pache鐨勯厤緗?/strong></div><div>鍋氭妧鏈殑浜哄簲璇ラ兘浼欰pache鐨勫熀紜閰嶇疆錛屽鏋滀笉浼氱‘瀹為渶瑕佸涓瀛︺?/div><div><span style="word-wrap: normal; word-break: normal; line-height: 22.5px; color: #333333; font-family: 'Microsoft YaHei', Verdana, sans-serif, 瀹嬩綋; font-size: 12.5px; letter-spacing: 0.5px; text-indent: 0px; background-color: #ffffff;">Apache鐨勯厤緗富瑕侀泦涓湪</span><strong style="padding: 0px; margin: 0px; color: #333333; font-family: 'Microsoft YaHei', Verdana, sans-serif, 瀹嬩綋; font-size: 12.5px; letter-spacing: 0.5px; line-height: 22.5px; text-indent: 0px; background-color: #ffffff;"><span style="word-wrap: normal; word-break: normal; line-height: 18.75px; padding: 0px; margin: 0px; color: red;">httpd.conf</span></strong><span style="word-wrap: normal; word-break: normal; line-height: 22.5px; color: #333333; font-family: 'Microsoft YaHei', Verdana, sans-serif, 瀹嬩綋; font-size: 12.5px; letter-spacing: 0.5px; text-indent: 0px; background-color: #ffffff;">鏂囦歡涓紝瀹冧綅浜嶢pache鐨勫畨瑁呯洰褰曚笅錛屾瘮濡傛垜鐨勬槸鍦?#8220;</span><span style="word-wrap: normal; word-break: normal; line-height: 22.5px; text-indent: 2em; font-size: 12.5px; letter-spacing: 0.5px;">C:\webserver\apache\apache22\conf</span><span style="word-wrap: normal; word-break: normal; line-height: 22.5px; color: #333333; font-family: 'Microsoft YaHei', Verdana, sans-serif, 瀹嬩綋; font-size: 12.5px; letter-spacing: 0.5px; text-indent: 0px; background-color: #ffffff;">”鐩綍涓嬨傜敤U</span><span style="word-wrap: normal; word-break: normal; line-height: 22.5px; color: #333333; font-family: 'Microsoft YaHei', Verdana, sans-serif, 瀹嬩綋; font-size: 12.5px; letter-spacing: 0.5px; text-indent: 0px; background-color: #ffffff;">ltraedit鎴朜otepad++緙栬緫鍣ㄦ墦寮鏂囦歡錛岄氬父闇瑕佷慨鏀圭殑鍐呭鍖呮嫭ServerName銆?/span><span style="word-wrap: normal; word-break: normal; line-height: 22.5px; text-indent: 2em; font-size: 12.5px; letter-spacing: 0.5px;">DocumentRoot銆乂irtualHost鍐呭絳夈傛澶勬垜淇敼鐨勫唴瀹瑰寘鎷細</span></div><div><span style="word-wrap: normal; word-break: normal; line-height: 22.5px; text-indent: 2em; font-size: 12.5px; letter-spacing: 0.5px;">1錛塂ocumentRoot鍘熺洰褰曚負</span><span style="word-wrap: normal; word-break: normal; line-height: 22.5px; text-indent: 2em; font-size: 12.5px; letter-spacing: 0.5px;">C:/webserver/apache/apache22/htdocs錛屼慨鏀逛負</span><span style="word-wrap: normal; word-break: normal; line-height: 22.5px; text-indent: 2em; font-size: 12.5px; letter-spacing: 0.5px;">D:/WWW/apache/htdocs錛屽皢緗戠珯鍙戝竷璺緞涓嶢pache瀹夎璺緞鍒嗗紑錛?/span></div><div><div style="color: #333333;"><span style="word-wrap: normal; word-break: normal; line-height: 18.75px; text-indent: 2em; font-size: 12.5px; letter-spacing: 0.5px;">2錛夋壘鍒板涓嬬孩鑹叉爣紺哄唴瀹癸細</span></div><div style="color: #333333;"></div><div style="color: #333333;"> <wbr>  <wbr> Options FollowSymLinks</div><div style="color: #333333;"> <wbr>  <wbr> AllowOverride None</div><div> <wbr>  <wbr> Order deny,allow</div><div style="color: #333333;"> <wbr>  <wbr> deny from all</div><div style="color: #333333;"></div><div style="color: #333333;">鎶婅繖涓?#8221;deny from all”鏀規垚”allow fromall’銆?/div><div style="color: #333333;"></div><div style="color: #333333;"> <wbr>  <wbr> Options FollowSymLinks</div><div style="color: #333333;"> <wbr>  <wbr> AllowOverride None</div><div><span style="word-wrap: normal; word-break: normal; color: #333333;"> <wbr>  <wbr></span> Order deny,allow</div><div style="color: #333333;"> <wbr>  <wbr> allow from all</div><div style="color: #333333;"></div></div></div></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"><span style="word-wrap: normal; word-break: normal; line-height: 19.5px; font-size: 13px; background-color: #ffffff;">浠ュ厤璁塊棶Apache鏍圭洰褰曚笅鐨勬枃浠舵椂鍑虹幇浠ヤ笅閿欒鎻愮ず錛?/span></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-align: center; text-indent: 2em; background-color: #919da3;"><img src="http://static.oschina.net/uploads/img/201407/17073206_Ees1.jpg" real_src="http://static.oschina.net/uploads/img/201407/17073206_Ees1.jpg" name="image_operate_371437641891879" alt="Apache鍜孴omcat鏁村悎閰嶇疆瀹炵幇JAVA搴旂敤鐨?#8220;鍔ㄩ潤”鍒嗙" title="Apache鍜孴omcat鏁村悎閰嶇疆瀹炵幇JAVA搴旂敤鐨?#8220;鍔ㄩ潤”鍒嗙" action-data="http%3A%2F%2Fstatic.oschina.net%2Fuploads%2Fimg%2F201407%2F17073206_Ees1.jpg" action-type="show-slide" style="margin: 0px; padding: 0px; border: 0px; list-style: none;" /></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;">3錛夊啀<span style="word-wrap: normal; word-break: normal; text-indent: 2em;">鎵懼埌涓嬮潰榪欐牱鐨勮</span></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;">Options FollowSymLinks indexes</div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;">鎶婂畠娉ㄦ帀鏀規垚涓嬮潰榪欐牱</div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;">#Options FollowSymLinks indexes</div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;">Options None</div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;">浠ュ厤鍦ㄨ闂瓵pache鐩綍鏃跺嚭鐜扮洿鎺ュ垪琛ㄦ樉紺哄瓙鐩綍鎴栫洰褰曚笅鏂囦歡鐨勪笉瀹夊叏鎯呭喌錛屽涓嬪浘鏍峰瓙錛?/div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-align: center; text-indent: 2em; background-color: #919da3;"><img src="http://static.oschina.net/uploads/img/201407/17073206_u6dM.jpg" real_src="http://static.oschina.net/uploads/img/201407/17073206_u6dM.jpg" name="image_operate_34941437641232574" alt="Apache鍜孴omcat鏁村悎閰嶇疆瀹炵幇JAVA搴旂敤鐨?#8220;鍔ㄩ潤”鍒嗙" title="Apache鍜孴omcat鏁村悎閰嶇疆瀹炵幇JAVA搴旂敤鐨?#8220;鍔ㄩ潤”鍒嗙" action-data="http%3A%2F%2Fstatic.oschina.net%2Fuploads%2Fimg%2F201407%2F17073206_u6dM.jpg" action-type="show-slide" style="margin: 0px; padding: 0px; border: 0px; list-style: none;" /></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;">浠ヤ笂閰嶇疆淇敼瀹屾垚鍚庨噸鍚疉pache鏈嶅姟錛屼繚璇佽鑳芥甯歌繍琛屻?/div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"><strong>涓夈丄pache涓嶵omcat鐨勬暣鍚堥厤緗?/strong></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;">Apache(Web Server)璐熻矗澶勭悊HTML闈欐佸唴瀹癸紝Tomcat(App Server)璐熻矗澶勭悊鍔ㄦ佸唴瀹癸紱鍘熺悊鍥懼涓嬶細</div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-align: center; text-indent: 2em; background-color: #919da3;"><img src="http://static.oschina.net/uploads/img/201407/17073206_HKpu.jpg" real_src="http://static.oschina.net/uploads/img/201407/17073206_HKpu.jpg" name="image_operate_78001437642175367" alt="Apache鍜孴omcat鏁村悎閰嶇疆瀹炵幇JAVA搴旂敤鐨?#8220;鍔ㄩ潤”鍒嗙" title="Apache鍜孴omcat鏁村悎閰嶇疆瀹炵幇JAVA搴旂敤鐨?#8220;鍔ㄩ潤”鍒嗙" action-data="http%3A%2F%2Fstatic.oschina.net%2Fuploads%2Fimg%2F201407%2F17073206_HKpu.jpg" action-type="show-slide" style="margin: 0px; padding: 0px; border: 0px; list-style: none;" /></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"><div style="text-indent: 2em;">涓婅堪鏋舵瀯鐨勫師鐞嗘槸錛?span style="word-wrap: normal; word-break: normal; text-indent: 2em;"> <wbr>鍦ˋpache涓杞戒竴涓ā鍧楋紝榪欎釜妯″潡鍙玬od_jk錛?/span><span style="word-wrap: normal; word-break: normal; text-indent: 2em;"> <wbr>Apache閫氳繃80绔彛璐熻矗瑙f瀽浠諱綍闈欐亀eb鍐呭錛?/span><span style="word-wrap: normal; word-break: normal; text-indent: 2em;"> <wbr>浠諱綍涓嶈兘瑙f瀽鐨勫唴瀹癸紝鐢ㄨ〃杈懼紡鍛婅瘔mod_jk錛岃mod_jk媧懼彂緇欑浉鍏崇殑App Server鍘昏В閲娿?/span></div><div style="text-indent: 2em;">鍥犳錛岄鍏堟妸 mod_jk-1.2.31-httpd-2.2.3錛堝彲浠庣綉涓婃悳绱笅杞借妯″潡錛屽http://download.csdn.net/detail/shangkaikuo/4494837錛夋嫹璐濆埌 "/Apache2.2/modules" 鐩綍涓嬨傛帴涓嬫潵錛?/div><div style="text-indent: 2em;"><strong>1銆佹坊鍔?span style="word-wrap: normal; word-break: normal; background-color: #ffffff;"><span style="word-wrap: normal; word-break: normal; line-height: 19.5px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: small; text-indent: 0px;">workers.properties鏂囦歡</span></span></strong></div></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;">鍦?“/Tomcat 8.0/conf ” 鏂囦歡澶逛笅錛堜篃鍙互鏄叾瀹冪洰褰曚笅錛夊鍔?workers.properties 鏂囦歡錛岃緭鍏ヤ互涓嬪唴瀹廣傦紙灝嗗叾涓浉搴旂洰褰曟浛鎹㈡垚鑷繁鏈湴tomcat鎴杍re瀹夎鐩綍錛?/div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"></div><div style="color: #323e32; font-family: 'Microsoft YaHei', 'Helvetica Neue', SimSun; text-indent: 2em; background-color: #919da3;"><div style="text-indent: 2em;"> <wbr>#璁﹎od_jk妯″潡璁よ瘑Tomcat</div><div style="text-indent: 2em;"> <wbr>workers.tomcat_home=d:/webserver/tomcat/tomcat8</div><div style="text-indent: 2em;"> <wbr>#璁﹎od_jk妯″潡璁よ瘑JRE</div><div style="text-indent: 2em;"> <wbr>workers.java_home=C:/java/jdk1.8.0_45/jre</div><div style="text-indent: 2em;"> <wbr>#鎸囧畾鏂囦歡璺緞鍒嗗壊絎?/div><div style="text-indent: 2em;"> <wbr>ps=/</div><div style="text-indent: 2em;"> <wbr>##</div><div style="text-indent: 2em;"> <wbr>#宸ヤ綔绔彛錛屾绔彛搴旇涓巗erver.xml涓瑿onnector鍏冪礌鐨凙JP/1.3鍗忚鎵浣跨敤鐨勭鍙g浉鍖歸厤</div><div style="text-indent: 2em;"> <wbr>worker.list=AJP13</div><div style="text-indent: 2em;"> <wbr>worker.AJP13.port=8009</div><div style="text-indent: 2em;"> <wbr>#Tomcat鏈嶅姟鍣ㄧ殑鍦板潃</div><div style="text-indent: 2em;"> <wbr>worker.AJP13.host=localhost</div><div style="text-indent: 2em;"> <wbr>#綾誨瀷</div><div style="text-indent: 2em;"> <wbr>worker.AJP13.type=ajp13</div><div style="text-indent: 2em;"> <wbr>#璐熻澆騫寵 鍥犳暟</div><div style="text-indent: 2em;"> <wbr>worker.AJP13.lbfactor=1</div><div style="text-indent: 2em;"><span style="word-wrap: normal; word-break: normal; text-indent: 2em; color: #ed1c24;"><br /></span></div><div style="text-indent: 2em;"><span style="word-wrap: normal; word-break: normal; text-indent: 2em; color: #ed1c24;">**娉ㄦ剰錛?/span><span style="word-wrap: normal; word-break: normal; text-indent: 2em; color: #ed1c24;">worker.list=AJP13涓紝AJP13涓鴻嚜瀹氫箟鍚嶇О錛屼絾姝ゅ悕縐板繀欏諱笌涓嬫枃鎵榪扮殑 “/Apache 2.2/conf/httpd.conf ” 鏂囦歡涓紝JkMount鎸囦護瀵瑰簲鐨勫悕縐扮浉鍖歸厤銆?/span></div><div style="text-indent: 2em;"><strong style="line-height: 1.5; text-indent: 2em;">2銆乭ttpd.conf<span style="word-wrap: normal; word-break: normal; background-color: #ffffff;"><span style="word-wrap: normal; word-break: normal; line-height: 19.5px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: small; text-indent: 0px;">鏂囦歡涓坊鍔犻厤緗唴瀹?/span></span></strong></div><div style="text-indent: 2em;"><span style="word-wrap: normal; word-break: normal; text-indent: 2em;">鍔犲叆workers.properties鏂囦歡鍚庯紝鍙慨鏀?“/Apache 2.2/conf/httpd.conf ” 鏂囦歡錛屽姞鍏ヤ互涓嬮厤緗紝娉ㄦ剰JkMount鎸囦護涓殑鍙橀噺蹇呴』涓巜orker.list鎵閰嶇疆鐨勫悕縐扮浉鍚屻?/span></div><div style="text-indent: 2em;"><span style="word-wrap: normal; word-break: normal; text-indent: 2em;"><br /></span></div><div style="text-indent: 2em;"><div style="color: #1723fc; text-indent: 2em;"><span style="word-wrap: normal; word-break: normal; text-indent: 2em;"># 姝ゅmod_jk-1.2.31-httpd-2.2.3鏂囦歡涓轟綘涓嬭澆鐨勬枃浠?/span></div><div style="text-indent: 2em;">LoadModule  <wbr>jk_module  <wbr>modules/mod_jk-1.2.31-httpd-2.2.3.so</div><div style="color: #1723fc; text-indent: 2em;"># 鎸囧畾tomcat鐩戝惉閰嶇疆鏂囦歡鍦板潃</div><div style="text-indent: 2em;">JkWorkersFile  <wbr>"C:/webserver/tomcat/tomcat8/conf/workers.properties"</div><div style="color: #1723fc; text-indent: 2em;">#JkWorkersFile  <wbr>"C:/webserver/apache/apache22/conf/workers.properties"</div><div style="color: #1723fc; text-indent: 2em;"># 鎸囧畾鏃ュ織瀛樻斁浣嶇疆</div><div style="color: #1723fc; text-indent: 2em;">JkLogFile  <wbr>"C:/webserver/tomcat/tomcat8/logs/mod_jk2.log"</div><div style="color: #1723fc; text-indent: 2em;">JkLogLevel  <wbr>info</div><div style="color: #1723fc; text-indent: 2em;"></div><div style="color: #1723fc; text-indent: 2em;">-virtualhost *-</div><div style="color: #1723fc; text-indent: 2em;"></div><div style="text-indent: 2em;"></div><div style="color: #1723fc; text-indent: 2em;"></div><div style="color: #1723fc; text-indent: 2em;"> <wbr>  <wbr> ServerName  <wbr>localhost</div><div style="color: #1723fc; text-indent: 2em;"> <wbr>  <wbr> DocumentRoot  <wbr>"C:/webserver/tomcat/tomcat8/webapps"</div><div style="color: #1723fc; text-indent: 2em;"> <wbr>  <wbr> DirectoryIndex  <wbr>index.html index.htm index.jsp index.action</div><div style="color: #1723fc; text-indent: 2em;"> <wbr>  <wbr> ErrorLog  <wbr>logs/shsc-error_log.txt</div><div style="color: #1723fc; text-indent: 2em;"> <wbr>  <wbr> CustomLog  <wbr>logs/shsc-access_log.txt common</div><div style="color: #1723fc; text-indent: 2em;"></div><div style="text-indent: 2em;"> <wbr>  <wbr> JkMount  <wbr>/*WEB-INF AJP13</div><div style="text-indent: 2em;"> <wbr>  <wbr> JkMount  <wbr>/*j_spring_security_check AJP13</div><div style="text-indent: 2em;"> <wbr>  <wbr> JkMount  <wbr>/*.action AJP13</div><div style="text-indent: 2em;"> <wbr>  <wbr> JkMount  <wbr>/servlet/* AJP13</div><div style="text-indent: 2em;"> <wbr>  <wbr> JkMount  <wbr>/*.jsp AJP13</div><div style="text-indent: 2em;"> <wbr>  <wbr> JkMount  <wbr>/*.do AJP13</div><div style="text-indent: 2em;"> <wbr>  <wbr> JkMount  <wbr>/*.action AJP13</div><div style="text-indent: 2em;"><span style="word-wrap: normal; word-break: normal; color: #1723fc;">-/virtualhost-</span></div><div style="text-indent: 2em;"><span style="word-wrap: normal; word-break: normal; color: #1723fc;"><br /></span></div><div style="text-indent: 2em;"></div><div style="color: #1723fc; text-indent: 2em;"></div><div style="color: #1723fc; text-indent: 2em;"></div><div style="text-indent: 2em;">涓婅堪閰嶇疆涓殑綰㈣壊鍐呭鏄負浜嗗憡璇堿pache鍝簺浜ょ粰Tomcat鍘誨鐞嗭紝鍏跺畠鐨勯兘浜ょ敱Apache鑷韓鍘誨鐞嗐?/div><div style="text-indent: 2em;">鍏朵腑緇胯壊鐨勪袱鍙ユ瘮杈冨叧閿紝鍒嗗埆鍛婅瘔錛欰pache杞藉叆涓涓澶栫殑鎻掍歡錛岀敤浜庤繛鎺omcat錛? <wbr>榪炴帴鏃剁殑閰嶇疆鍙傛暟鎻忚堪浣嶄簬Tomcat瀹夎鐩綍鐨?conf鐩綍涓嬬殑涓涓彨workers.properties鏂囦歡涓紝mod_jk涓鑸嬌鐢╝jp13鍗忚榪炴帴錛屼嬌鐢ㄧ殑鏄痶omcat鐨?009绔彛銆?/div><div style="text-indent: 2em;"></div><div style="text-indent: 2em;">瀹屾垚浠ヤ笂閰嶇疆鍚庯紝閲嶅惎 Apache銆乀omcat銆傛鏃禔pache銆乀omcat鐨勯粯璁ょ洰褰曚負 "C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps ”,Apache浣跨敤榛樿鐨?0绔彛銆乀omcat绔彛鏀規垚1080鎴栧叾瀹冮潪8080榛樿绔彛錛堜慨鏀規槸涓轟簡瀹夊叏錛屼篃鍙互涓嶇敤淇敼錛夈傚湪Tomcat榛樿鐩綍涓嬫坊鍔爐est鐩綍錛屽湪璇ョ洰褰曚笅鍔犲叆index.jsp欏甸潰錛岀劧鍚庨氳繃http://localhost/test/index.jsp璇曡瘯鏄惁鍙互姝e父璁塊棶錛屽欏甸潰鍙甯歌闂紝璇佹槑鏁村悎閰嶇疆宸茬粡鎴愬姛銆?/div><div style="text-indent: 2em;"></div><div style="text-indent: 2em;">鑷蟲錛屼技涔庢暣涓厤緗伐浣滃凡緇忓畬鎴愶紝浣嗘槸濡傛灉浣犳兂璇曠潃鎶婇潤鎬佺殑HTML欏甸潰鏀懼埌Apache鐨刪tdocs鍙戝竷鐩綍涓嬶紝鎶奐SP絳夊姩鎬佸唴瀹規斁鍒癟omcat鐨剋ebapps鐩綍涓嬶紙璇ョ洰褰曚笅涓嶅瓨鏀?.html鏂囦歡錛夛紝鐒跺悗閫氳繃http://localhost/index.html鎯寵闂瓵pache鐩綍涓嬬殑鍐呭錛屼綘浼氬彂鐜?04涔嬬被鐨勪笉鑳借闂殑閿欒銆傚浣曡В鍐籌紝榪欓噷鏆傛椂鍗栦釜鍏沖瓙.......濡傛灉浣犺兘鐪嬪嚭闂錛岃兘瀹規槗瑙e喅鎺夛紝灝辮瘹鎸氫負浣犵偣涓禐錛?/div></div></div> <img src ="http://www.tkk7.com/youngturk/aggbug/430963.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/youngturk/" target="_blank">youngturk</a> 2016-06-19 20:42 <a href="http://www.tkk7.com/youngturk/archive/2016/06/19/430963.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍏充簬Tomcat鍜孴omcat鐨勯潰璇曢棶棰?/title><link>http://www.tkk7.com/youngturk/archive/2016/06/19/430961.html</link><dc:creator>youngturk</dc:creator><author>youngturk</author><pubDate>Sun, 19 Jun 2016 02:31:00 GMT</pubDate><guid>http://www.tkk7.com/youngturk/archive/2016/06/19/430961.html</guid><wfw:comment>http://www.tkk7.com/youngturk/comments/430961.html</wfw:comment><comments>http://www.tkk7.com/youngturk/archive/2016/06/19/430961.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/youngturk/comments/commentRss/430961.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/youngturk/services/trackbacks/430961.html</trackback:ping><description><![CDATA[http://www.jfox.info/guan-yu-Tomcat-he-Tomcat-de-mian-shi-wen-ti <br /><div>http://www.jfox.info/guan-yu-Tomcat-he-Tomcat-de-mian-shi-wen-ti</div><h3>鍏充簬Tomcat鍜孴omcat鐨勯潰璇曢棶棰?/h3><p><strong>涓銆乀omcat鐨勭己鐪佹槸澶氬皯錛屾庝箞淇敼</strong></p><p>Tomcat鐨勭己鐪佺鍙e彿鏄?080.<br />淇敼Tomcat绔彛鍙鳳細<br />1.鎵懼埌Tomcat鐩綍涓嬬殑conf鏂囦歡澶?br />2.榪涘叆conf鏂囦歡澶歸噷闈㈡壘鍒皊erver.xml鏂囦歡<br />3.鎵撳紑server.xml鏂囦歡<br />4.鍦╯erver.xml鏂囦歡閲岄潰鎵懼埌涓嬪垪淇℃伅<br />maxThreads=”150″ minSpareThreads=”25″ maxSpareThreads=”75″<br />enableLookups=”false” redirectPort=”8443″ acceptCount=”100″<br />connectionTimeout=”20000″ disableUploadTimeout=”true” /><br />5.鎶妏ort=”8080″鏀規垚port=”8888″錛屽茍涓斾繚瀛?br />6.鍚姩Tomcat錛屽茍涓斿湪IE嫻忚鍣ㄩ噷闈㈢殑鍦板潃鏍忚緭鍏ttp://127.0.0.1:8888/</p><p>7銆乼omcat榛樿閲囩敤鐨凚IO妯″瀷錛屽湪鍑犵櫨騫跺彂涓嬫ц兘浼氭湁寰堜弗閲嶇殑涓嬮檷銆倀omcat鑷甫榪樻湁NIO鐨勬ā鍨嬶紝鍙﹀涔熷彲浠ヨ皟鐢ˋPR鐨勫簱鏉ュ疄鐜版搷浣滅郴緇熺駭鍒帶鍒躲?br />  NIO妯″瀷鏄唴緗殑錛岃皟鐢ㄥ緢鏂逛究錛屽彧闇瑕佸皢涓婇潰閰嶇疆鏂囦歡涓璸rotocol淇敼鎴?org.apache.coyote.http11.Http11NioProtocol錛岄噸鍚嵆鍙敓鏁堛傚涓嬮潰鐨勫弬鏁伴厤緗紝榛樿鐨勬槸HTTP/1.1銆?br />    <Connector port=”8080″   <br />               protocol=”org.apache.coyote.http11.Http11NioProtocol”  <br />               connectionTimeout=”20000″  <br />               redirectPort=”8443″   <br />               maxThreads=”500″   <br />               minSpareThreads=”20″  <br />               acceptCount=”100″ <br />               disableUploadTimeout=”true” <br />               enableLookups=”false”   <br />               URIEncoding=”UTF-8″ /></p><p><strong>浜屻乼omcat 濡備綍浼樺寲錛?/strong></p><p> 1銆佷紭鍖栬繛鎺ラ厤緗?榪欓噷浠omcat7鐨勫弬鏁伴厤緗負渚嬶紝闇瑕佷慨鏀筩onf/server.xml鏂囦歡錛屼慨鏀硅繛鎺ユ暟錛屽叧闂鎴風dns鏌ヨ銆?/p><p>鍙傛暟瑙i噴錛?/p><p> URIEncoding=”UTF-8″ :浣垮緱tomcat鍙互瑙f瀽鍚湁涓枃鍚嶇殑鏂囦歡鐨剈rl錛岀湡鏂逛究錛屼笉鍍廰pache閲岃繕鏈夋悶涓猰od_encoding錛岃繕瑕佹墜宸ョ紪璇?/p><p> maxSpareThreads : 濡傛灉絀洪棽鐘舵佺殑綰跨▼鏁板浜庤緗殑鏁扮洰錛屽垯灝嗚繖浜涚嚎紼嬩腑姝紝鍑忓皯榪欎釜姹犱腑鐨勭嚎紼嬫繪暟銆?/p><p> minSpareThreads : 鏈灝忓鐢ㄧ嚎紼嬫暟錛宼omcat鍚姩鏃剁殑鍒濆鍖栫殑綰跨▼鏁般?/p><p> enableLookups : 榪欎釜鍔熸晥鍜孉pache涓殑HostnameLookups涓鏍鳳紝璁句負鍏抽棴銆?/p><p> connectionTimeout : connectionTimeout涓虹綉緇滆繛鎺ヨ秴鏃舵椂闂存縐掓暟銆?/p><p> maxThreads : maxThreads Tomcat浣跨敤綰跨▼鏉ュ鐞嗘帴鏀剁殑姣忎釜璇鋒眰銆傝繖涓艱〃紺篢omcat鍙垱寤虹殑鏈澶х殑綰跨▼鏁幫紝鍗蟲渶澶у茍鍙戞暟銆?/p><p> acceptCount : acceptCount鏄綋綰跨▼鏁拌揪鍒癿axThreads鍚庯紝鍚庣畫璇鋒眰浼氳鏀懼叆涓涓瓑寰呴槦鍒楋紝榪欎釜acceptCount鏄繖涓槦鍒楃殑澶у皬錛屽鏋滆繖涓槦鍒椾篃婊′簡錛屽氨鐩存帴refuse connection</p><p> maxProcessors涓巑inProcessors : 鍦?Java涓嚎紼嬫槸紼嬪簭榪愯鏃剁殑璺緞錛屾槸鍦ㄤ竴涓▼搴忎腑涓庡叾瀹冩帶鍒剁嚎紼嬫棤鍏崇殑銆佽兘澶熺嫭绔嬭繍琛岀殑浠g爜孌點傚畠浠叡浜浉鍚岀殑鍦板潃絀洪棿銆傚綰跨▼甯姪紼嬪簭鍛樺啓鍑篊PU鏈 澶у埄鐢ㄧ巼鐨勯珮鏁堢▼搴忥紝浣跨┖闂叉椂闂翠繚鎸佹渶浣庯紝浠庤屾帴鍙楁洿澶氱殑璇鋒眰銆?/p><p>閫氬父Windows鏄?000涓乏鍙籌紝Linux鏄?000涓乏鍙熾?/p><p> useURIValidationHack:</p><p>鎴戜滑鏉ョ湅涓涓媡omcat涓殑涓孌墊簮鐮侊細</p><p>銆恠ecurity銆?/p><p>        if (connector.getUseURIValidationHack()) {</p><p>            String uri = validate(request.getRequestURI());</p><p>            if (uri == null) {</p><p>                res.setStatus(400);</p><p>                res.setMessage(“Invalid URI”);</p><p>                throw new IOException(“Invalid URI”);</p><p>            } else {</p><p>                req.requestURI().setString(uri);</p><p>                // Redoing the URI decoding</p><p>                req.decodedURI().duplicate(req.requestURI());</p><p>                req.getURLDecoder().convert(req.decodedURI(), true);</p><p>鍙互鐪嬪埌濡傛灉鎶妘seURIValidationHack璁炬垚”false”錛屽彲浠ュ噺灝戝畠瀵逛竴浜泆rl鐨勪笉蹇呰鐨勬鏌ヤ粠鑰屽噺鐪佸紑閿銆?/p><p> enableLookups=”false” 錛?涓轟簡娑堥櫎DNS鏌ヨ瀵規ц兘鐨勫獎鍝嶆垜浠彲浠ュ叧闂璂NS鏌ヨ錛屾柟寮忔槸淇敼server.xml鏂囦歡涓殑enableLookups鍙傛暟鍊箋?/p><p> disableUploadTimeout 錛氱被浼間簬Apache涓殑keeyalive涓鏍?/p><p>緇橳omcat閰嶇疆gzip鍘嬬緝(HTTP鍘嬬緝)鍔熻兘</p><p>compression=”on” compressionMinSize=”2048″</p><p>compressableMimeType=”text/html,text/xml,text/javascript,text/css,text/plain”</p><p>HTTP 鍘嬬緝鍙互澶уぇ鎻愰珮嫻忚緗戠珯鐨勯熷害錛屽畠鐨勫師鐞嗘槸錛屽湪瀹㈡埛绔姹傜綉欏靛悗錛屼粠鏈嶅姟鍣ㄧ灝嗙綉欏墊枃浠跺帇緙╋紝鍐嶄笅杞藉埌瀹㈡埛绔紝鐢卞鎴風鐨勬祻瑙堝櫒璐熻矗瑙e帇緙╁茍嫻忚銆傜浉瀵逛簬鏅氱殑嫻忚榪囩▼HTML,CSS,Javascript , Text 錛屽畠鍙互鑺傜渷40%宸﹀彸鐨勬祦閲忋傛洿涓洪噸瑕佺殑鏄紝瀹冨彲浠ュ鍔ㄦ佺敓鎴愮殑錛屽寘鎷珻GI銆丳HP , JSP , ASP , Servlet,SHTML絳夎緭鍑虹殑緗戦〉涔熻兘榪涜鍘嬬緝錛屽帇緙╂晥鐜囨儕浜恒?/p><p>1)compression=”on” 鎵撳紑鍘嬬緝鍔熻兘</p><p>2)compressionMinSize=”2048″ 鍚敤鍘嬬緝鐨勮緭鍑哄唴瀹瑰ぇ灝忥紝榪欓噷闈㈤粯璁や負2KB</p><p>3)noCompressionUserAgents=”gozilla, traviata” 瀵逛簬浠ヤ笅鐨勬祻瑙堝櫒錛屼笉鍚敤鍘嬬緝</p><p>4)compressableMimeType=”text/html,text/xml”銆鍘嬬緝綾誨瀷</p><p>鏈鍚庝笉瑕佸繕浜嗘妸8443绔彛鐨勫湴鏂逛篃鍔犱笂鍚屾牱鐨勯厤緗紝鍥犱負濡傛灉鎴戜滑璧癶ttps鍗忚鐨勮瘽錛屾垜浠皢浼氱敤鍒?443绔彛榪欎釜孌電殑閰嶇疆錛屽鍚э紵</p><p><!–enable tomcat ssl–></p><p>    <Connector port=”8443″ protocol=”HTTP/1.1″</p><p>               URIEncoding=”UTF-8″  minSpareThreads=”25″ maxSpareThreads=”75″</p><p>          enableLookups=”false” disableUploadTimeout=”true” connectionTimeout=”20000″</p><p>          acceptCount=”300″  maxThreads=”300″ maxProcessors=”1000″ minProcessors=”5″</p><p>          useURIValidationHack=”false”</p><p>                    compression=”on” compressionMinSize=”2048″</p><p>                    compressableMimeType=”text/html,text/xml,text/javascript,text/css,text/plain”</p><p>                SSLEnabled=”true”</p><p>           scheme=”https” secure=”true”</p><p>           clientAuth=”false” sslProtocol=”TLS”</p><p>           keystoreFile=”d:/tomcat2/conf/shnlap93.jks” keystorePass=”aaaaaa”</p><p>      /></p><p>濂戒簡錛屾墍鏈夌殑Tomcat浼樺寲鐨勫湴鏂歸兘鍔犱笂浜嗐?/p><p>2銆佷紭鍖朖DK <br />Tomcat榛樿鍙互浣跨敤鐨勫唴瀛樹負128MB,Windows涓?鍦ㄦ枃浠秢tomcat_home}/bin/catalina.bat錛孶nix涓嬶紝鍦ㄦ枃浠?CATALINA_HOME/bin/catalina.sh鐨勫墠闈紝澧炲姞濡備笅璁劇疆錛?<br />JAVA_OPTS=”‘$JAVA_OPTS” -Xms[鍒濆鍖栧唴瀛樺ぇ灝廬 -Xmx[鍙互浣跨敤鐨勬渶澶у唴瀛榏 <br />鎴?<br />璁劇疆鐜鍙橀噺錛歟xport JAVA_OPTS=””$JAVA_OPTS” -Xms[鍒濆鍖栧唴瀛樺ぇ灝廬 -Xmx[鍙互浣跨敤鐨勬渶澶у唴瀛榏” <br />涓鑸鏉ワ紝浣犲簲璇ヤ嬌鐢ㄧ墿鐞嗗唴瀛樼殑 80% 浣滀負鍫嗗ぇ灝忋傚鏋滄湰鏈轟笂鏈堿pache鏈嶅姟鍣紝鍙互鍏堟姌綆桝pache闇瑕佺殑鍐呭瓨錛岀劧鍚庝慨鏀瑰爢澶у皬銆傚緩璁緗負70錛咃紱寤鴻璁劇疆[[鍒濆鍖栧唴瀛樺ぇ灝廬絳変簬[鍙互浣跨敤鐨勬渶澶у唴瀛榏錛岃繖鏍峰彲浠ュ噺灝戝鉤鍑″垎閰嶅爢鑰岄檷浣庢ц兘銆?<br />鏈緥浣跨敤鍔犲叆鐜鍙橀噺鐨勬柟寮忥細 <br /># vi /etc/profile <br />鍔犲叆錛歟xport JAVA_OPTS=””$JAVA_OPTS” -Xms700 —Xmx700 <br /># source /etc/profile</p><p>銆愬弬鏁拌鏄庛?/p><p>-Xms 鏄寚璁懼畾紼嬪簭鍚姩鏃跺崰鐢ㄥ唴瀛樺ぇ灝忋備竴鑸潵璁詫紝澶х偣錛岀▼搴忎細鍚姩鐨?蹇竴鐐癸紝浣嗘槸涔熷彲鑳戒細瀵艱嚧鏈哄櫒鏆傛椂闂村彉鎱€?/p><p>-Xmx 鏄寚璁懼畾紼嬪簭榪愯鏈熼棿鏈澶у彲鍗犵敤鐨勫唴瀛樺ぇ灝忋傚鏋滅▼搴忚繍琛岄渶瑕佸崰 鐢ㄦ洿澶氱殑鍐呭瓨錛岃秴鍑轟簡榪欎釜璁劇疆鍊鹼紝灝變細鎶涘嚭OutOfMemory 寮傚父銆?/p><p>-Xss 鏄寚璁懼畾姣忎釜綰跨▼鐨勫爢鏍堝ぇ灝忋傝繖涓氨瑕佷緷鎹綘鐨勭▼搴忥紝鐪嬩竴涓嚎紼?澶х害闇瑕佸崰鐢ㄥ灝戝唴瀛橈紝鍙兘浼氭湁澶氬皯綰跨▼鍚屾椂榪愯絳夈?/p><p>-XX:PermSize璁劇疆闈炲爢鍐呭瓨鍒濆鍊鹼紝榛樿鏄墿鐞嗗唴瀛樼殑1/64 銆?/p><p>-XX:MaxPermSize璁劇疆鏈澶ч潪鍫嗗唴瀛樼殑澶у皬錛岄粯璁ゆ槸鐗╃悊鍐呭瓨鐨?/4銆?/p><p><strong>涓夈乼omcat 鏈夐偅鍑犵Connector 榪愯妯″紡錛?/strong></p><p>tomcat鐨勮繍琛屾ā寮忔湁3縐?淇敼浠栦滑鐨勮繍琛屾ā寮?3縐嶆ā寮忕殑榪愯鏄惁鎴愬姛,鍙互鐪嬩粬鐨勫惎鍔ㄦ帶鍒跺彴,鎴栬呭惎鍔ㄦ棩蹇?鎴栬呯櫥褰曚粬浠殑榛樿欏甸潰http://localhost:8080/鏌ョ湅鍏朵腑鐨勬湇鍔″櫒鐘舵併?/p><p>1)bio</p><p>榛樿鐨勬ā寮?鎬ц兘闈炲父浣庝笅,娌℃湁緇忚繃浠諱綍浼樺寲澶勭悊鍜屾敮鎸?</p><p>2)nio</p><p>鍒╃敤java鐨勫紓姝o鎶ょ悊鎶鏈?no blocking IO鎶鏈?</p><p>鎯寵繍琛屽湪璇ユā寮忎笅錛岀洿鎺ヤ慨鏀箂erver.xml閲岀殑Connector鑺傜偣,淇敼protocol涓?/p><p> <Connector port=”80″ protocol=”org.apache.coyote.http11.Http11NioProtocol” <br />    connectionTimeout=”20000″ <br />    URIEncoding=”UTF-8″ <br />    useBodyEncodingForURI=”true” <br />    enableLookups=”false” <br />    redirectPort=”8443″ /></p><p>鍚姩鍚?灝卞彲浠ョ敓鏁堛?/p><p>3)apr</p><p>瀹夎璧鋒潵鏈鍥伴毦,浣嗘槸浠庢搷浣滅郴緇熺駭鍒潵瑙e喅寮傛鐨処O闂,澶у箙搴︾殑鎻愰珮鎬ц兘.</p><p>蹇呴』瑕佸畨瑁卆pr鍜宯ative錛岀洿鎺ュ惎鍔ㄥ氨鏀寔apr銆備笅闈㈢殑淇敼綰睘澶氫綑錛屼粎渚涘ぇ瀹舵墿鍏呯煡璇?浣嗕粛鐒墮渶瑕佸畨瑁卆pr鍜宯ative</p><p>濡俷io淇敼妯″紡,淇敼protocol涓簅rg.apache.coyote.http11.Http11AprProtocol</p><img src ="http://www.tkk7.com/youngturk/aggbug/430961.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/youngturk/" target="_blank">youngturk</a> 2016-06-19 10:31 <a href="http://www.tkk7.com/youngturk/archive/2016/06/19/430961.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>spring httpInvoke 瑙e喅榪滅▼璋冪敤榪滅▼鐨勭被鐨勬柟娉?/title><link>http://www.tkk7.com/youngturk/archive/2016/06/19/430960.html</link><dc:creator>youngturk</dc:creator><author>youngturk</author><pubDate>Sun, 19 Jun 2016 02:29:00 GMT</pubDate><guid>http://www.tkk7.com/youngturk/archive/2016/06/19/430960.html</guid><wfw:comment>http://www.tkk7.com/youngturk/comments/430960.html</wfw:comment><comments>http://www.tkk7.com/youngturk/archive/2016/06/19/430960.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/youngturk/comments/commentRss/430960.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/youngturk/services/trackbacks/430960.html</trackback:ping><description><![CDATA[http://zhidao.baidu.com/link?url=6FrnwvBQEZhjM-ooNCuiAra7T6qi9FsFhFvkHBKaOjqovZR86OCsIePi-05nM-fxRrlInEGbElSxlhgO6X7JsaGNdQdNrQ2xE58wglgeQO3 http://blog.csdn.net/liaq325/article/details/8281550 鎽樿嚜浠ヤ笂 spring httpInvoke <br /><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">spring httpInvoke 鍩轟簬spring鏋舵瀯鐨勬湇鍔″櫒涔嬮棿鐨勮繙紼嬭皟鐢ㄥ疄鐜般傞氳繃spring httpInvoke錛屽彲浠ヨ皟鐢ㄨ繙紼嬫帴鍙o紝榪涜鏁版嵁浜や簰銆佷笟鍔¢昏緫鎿嶄綔<br /></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">鏈嶅姟鍣ㄧ錛?琚皟鐢ㄤ竴鏂?</p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><div bg_java"="" style="width: 936.53125px; overflow-y: hidden; position: relative; line-height: 26px;"><div><div><strong>[java]</strong> <a title="view plain" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-position: 0% 0%; background-repeat: no-repeat;">view plain</a><span data-mod="popu_168"> <a title="copy" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-position: 0% 0%; background-repeat: no-repeat;">copy</a><div style="position: absolute; left: 561px; top: 537px; width: 18px; height: 18px; z-index: 99;"></div></span></div></div><ol start="1"><li style="line-height: 18px;">public  class User implements Serializable{//蹇呴』瀹炵幇serializable鎺ュ彛錛岃繙紼嬭皟鐢ㄧ殑鍩虹  </li><li style="line-height: 18px;">    private String username;  </li><li style="line-height: 18px;">    private Date birthday;  </li><li style="line-height: 18px;">    //鏋勯犳柟娉?nbsp; </li><li style="line-height: 18px;">    //set get 鏂規硶  </li><li style="line-height: 18px;">}  </li><li style="line-height: 18px;">public interface UserService{  </li><li style="line-height: 18px;">    User getUser(String username);  </li><li style="line-height: 18px;">}  </li><li style="line-height: 18px;">public UserServiceImpl implements UserService{  </li><li style="line-height: 18px;">    //瀹炵幇userService  </li><li style="line-height: 18px;">}  </li></ol></div><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">閲嶈鐨勯厤緗枃浠舵潵浜嗐傘傘傘?/span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">remote-servlet.xml鏀懼湪欏圭洰鏍圭洰褰曚笅闈紝璺焪eb.xml鐩稿悓鐨勭駭鍒?/span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">鏆撮湶緇欒皟鐢ㄧ錛氭湇鍔$殑瀹炵幇錛屾帴鍙?/p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><div bg_html"="" style="width: 936.53125px; overflow-y: hidden; position: relative; line-height: 26px;"><div><div><strong>[html]</strong> <a title="view plain" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-position: 0% 0%; background-repeat: no-repeat;">view plain</a><span data-mod="popu_168"> <a title="copy" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-position: 0% 0%; background-repeat: no-repeat;">copy</a><div style="position: absolute; left: 563px; top: 900px; width: 18px; height: 18px; z-index: 99;"></div></span></div></div><ol start="1"><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">bean</span> <span style="color: red;">id</span>=<span style="color: blue;">"userService"</span> <span style="color: red;">class</span>=<span style="color: blue;">"org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter"</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"service"</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">bean</span> <span style="color: red;">class</span>=<span style="color: blue;">"com.cd.Liaq.UserServiceImpl"</span><span style="color: #993300; font-weight: bold;">/></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">property</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"serviceInterface"</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">value</span><span style="color: #993300; font-weight: bold;">></span>com.cd.Liaq.UserService<span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">value</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">property</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">bean</span><span style="color: #993300; font-weight: bold;">></span>  </li></ol></div><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">鏆撮湶浜嗘湇鍔$殑瀹炵幇鍜屾帴鍙o紝閭d箞鎬庝箞璁塊棶鏈嶅姟鍛紵</span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">spring灝佽璁塊棶url</span><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><div bg_html"="" style="width: 936.53125px; overflow-y: hidden; position: relative; line-height: 26px;"><div><div><strong>[html]</strong> <a title="view plain" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-position: 0% 0%; background-repeat: no-repeat;">view plain</a><span data-mod="popu_168"> <a title="copy" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-position: 0% 0%; background-repeat: no-repeat;">copy</a><div style="position: absolute; left: 563px; top: 1165px; width: 18px; height: 18px; z-index: 99;"></div></span></div></div><ol start="1"><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">bean</span> <span style="color: red;">class</span>=<span style="color: blue;">"org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    絎竴縐嶏細<span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"urlMap"</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">map</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">            <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">entry</span> <span style="color: red;">key</span>=<span style="color: blue;">"TestUser"</span> <span style="color: red;">value-ref</span>=<span style="color: blue;">"userService"</span><span style="color: #993300; font-weight: bold;">/></span>  </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">map</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">property</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    絎簩縐嶏細<span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">prop</span> <span style="color: red;">key</span>=<span style="color: blue;">"/TestUser"</span><span style="color: #993300; font-weight: bold;">></span>userService<span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">prop</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">bean</span><span style="color: #993300; font-weight: bold;">></span>  </li></ol></div><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">web.xml:閰嶇疆dispatcherServlet鍏辮皟鐢ㄤ竴鏂逛嬌鐢?/span><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><div bg_html"="" style="width: 936.53125px; overflow-y: hidden; position: relative; line-height: 26px;"><div><div><strong>[html]</strong> <a title="view plain" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-position: 0% 0%; background-repeat: no-repeat;">view plain</a><span data-mod="popu_168"> <a title="copy" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-position: 0% 0%; background-repeat: no-repeat;">copy</a><div style="position: absolute; left: 563px; top: 1404px; width: 18px; height: 18px; z-index: 99;"></div></span></div></div><ol start="1"><li style="line-height: 18px;"><!-- spring榪滅▼璋冪敤 -->  </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">servlet</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">servlet-name</span><span style="color: #993300; font-weight: bold;">></span>remote<span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">servlet-name</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">servlet-class</span><span style="color: #993300; font-weight: bold;">></span>org.springframework.web.servlet.DispatcherServlet<span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">servlet-class</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">load-on-startup</span><span style="color: #993300; font-weight: bold;">></span>1<span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">load-on-startup</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">servlet</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">servlet-mapping</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">servlet-name</span><span style="color: #993300; font-weight: bold;">></span>remote<span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">servlet-name</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">url-pattern</span><span style="color: #993300; font-weight: bold;">></span>/remoting/*<span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">url-pattern</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">servlet-mapping</span><span style="color: #993300; font-weight: bold;">></span>  </li></ol></div><span style="font-family: Arial; line-height: 26px; color: #ff6666; background-color: #ffffff;">鍒板涓烘錛氳璋冪敤绔竴鏂瑰畬姣?!!!</span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">瀹㈡埛绔皟鐢細</span><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><div bg_html"="" style="width: 936.53125px; overflow-y: hidden; position: relative; line-height: 26px;"><div><div><strong>[html]</strong> <a title="view plain" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-position: 0% 0%; background-repeat: no-repeat;">view plain</a><span data-mod="popu_168"> <a title="copy" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-position: 0% 0%; background-repeat: no-repeat;">copy</a><div style="position: absolute; left: 563px; top: 1705px; width: 18px; height: 18px; z-index: 99;"></div></span></div></div><ol start="1"><li style="line-height: 18px;"><!-- 閫氳繃http榪炴帴榪滅▼緋葷粺 -->  </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">bean</span> <span style="color: red;">id</span>=<span style="color: blue;">"memberService"</span>  </li><li style="line-height: 18px;">    <span style="color: red;">class</span>=<span style="color: blue;">"org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"serviceUrl"</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">value</span><span style="color: #993300; font-weight: bold;">></span>http://192.9.200.123:8080/MemberSystem/remoting/memberService<span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">value</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">property</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"serviceInterface"</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">value</span><span style="color: #993300; font-weight: bold;">></span>com.cd.Liaq.UserService<span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">value</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">property</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">bean</span><span style="color: #993300; font-weight: bold;">></span>  </li></ol></div><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">閫氳繃spring瀹瑰櫒璋冪敤UserService,鐢ㄥ埌HttpInvokerProxyFactoryBean宸ュ巶錛岄厤緗畇erviceUrl鍜宻erviceInterface</span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">涓轟簡鎻愰珮鏁堢巼錛氬鎴風浣跨敤Commons-HttpClient錛屽鍏ユ敼鍖咃紝鏀瑰啓閰嶇疆</span><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><div bg_html"="" style="width: 936.53125px; overflow-y: hidden; position: relative; line-height: 26px;"><div><div><strong>[html]</strong> <a title="view plain" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-position: 0% 0%; background-repeat: no-repeat;">view plain</a><span data-mod="popu_168"> <a title="copy" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-position: 0% 0%; background-repeat: no-repeat;">copy</a><div style="position: absolute; left: 563px; top: 2006px; width: 18px; height: 18px; z-index: 99;"></div></span></div></div><ol start="1"><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">bean</span> <span style="color: red;">id</span>=<span style="color: blue;">"memberService"</span>  </li><li style="line-height: 18px;">    <span style="color: red;">class</span>=<span style="color: blue;">"org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"serviceUrl"</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">value</span><span style="color: #993300; font-weight: bold;">></span>http://192.9.200.123:8080/MemberSystem/remoting/memberService<span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">value</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">property</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"serviceInterface"</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">value</span><span style="color: #993300; font-weight: bold;">></span>com.cd.Liaq.UserService<span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">value</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">property</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;">     <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"httpInvokerRequestExecutor"</span><span style="color: #993300; font-weight: bold;">></span> //浣跨敤鎸囧畾鐨勬墽琛屽櫒鎵ц  </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">ref</span> <span style="color: red;">bean</span>=<span style="color: blue;">"httpInvokerRequestExecutor"</span> <span style="color: #993300; font-weight: bold;">/></span>    </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">property</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">bean</span><span style="color: #993300; font-weight: bold;">></span>  </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">bean</span> <span style="color: red;">id</span>=<span style="color: blue;">"httpInvokerRequestExecutor"</span> <span style="color: red;">class</span>=<span style="color: blue;">"org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor"</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"httpClient"</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">bean</span> <span style="color: red;">class</span>=<span style="color: blue;">"org.apache.commons.httpclient.HttpClient"</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">            <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"connectionTimeout"</span> <span style="color: red;">value</span>=<span style="color: blue;">"2000"</span> <span style="color: #993300; font-weight: bold;">/></span>    </li><li style="line-height: 18px;">            <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"timeout"</span> <span style="color: red;">value</span>=<span style="color: blue;">"5000"</span> <span style="color: #993300; font-weight: bold;">/></span>    </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">bean</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">property</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">bean</span><span style="color: #993300; font-weight: bold;">></span>    </li></ol></div><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">閰嶇疆瓚呮椂鏃墮棿timeout鍜岃繛鎺ヨ秴鏃禼onnectionTimeout涓や釜灞炴?/span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">浼樺寲鎵ц鍣細澶氱嚎紼?==琚皟鐢ㄧ鍝嶅簲鏃墮棿緙╃煭寰堝</span><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><div bg_html"="" style="width: 936.53125px; overflow-y: hidden; position: relative; line-height: 26px;"><div><div><strong>[html]</strong> <a title="view plain" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-position: 0% 0%; background-repeat: no-repeat;">view plain</a><span data-mod="popu_168"> <a title="copy" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-position: 0% 0%; background-repeat: no-repeat;">copy</a><div style="position: absolute; left: 563px; top: 2513px; width: 18px; height: 18px; z-index: 99;"></div></span></div></div><ol start="1"><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">bean</span> <span style="color: red;">id</span>=<span style="color: blue;">"httpInvokerRequestExecutor"</span> <span style="color: red;">class</span>=<span style="color: blue;">"org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor"</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"httpClient"</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">bean</span> <span style="color: red;">class</span>=<span style="color: blue;">"org.apache.commons.httpclient.HttpClient"</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">            <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"connectionTimeout"</span> <span style="color: red;">value</span>=<span style="color: blue;">"2000"</span> <span style="color: #993300; font-weight: bold;">/></span>    </li><li style="line-height: 18px;">            <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"timeout"</span> <span style="color: red;">value</span>=<span style="color: blue;">"5000"</span> <span style="color: #993300; font-weight: bold;">/></span>    </li><li style="line-height: 18px;">            <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span>  <span style="color: red;">name</span>=<span style="color: blue;">"httpConnectionManager"</span><span style="color: #993300; font-weight: bold;">></span>//鎺у埗榪炴帴  </li><li style="line-height: 18px;">                    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">ref</span>  <span style="color: red;">bean</span>=<span style="color: blue;">"multiThreadedHttpConnectionManager"</span> <span style="color: #993300; font-weight: bold;">/></span>    </li><li style="line-height: 18px;">            <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">property</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">bean</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">property</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">bean</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">bean</span> <span style="color: red;">id</span>=<span style="color: blue;">"multiThreadedHttpConnectionManager"</span> <span style="color: red;">class</span>=<span style="color: blue;">"org.apache.commons.httpclient.MultiThreadedHttpConnectionManager"</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"params"</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">bean</span> <span style="color: red;">class</span>=<span style="color: blue;">"org.apache.commons.httpclient.params.HttpConnectionManagerParams"</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">            <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"maxTotalConnections"</span>  <span style="color: red;">value</span>=<span style="color: blue;">"600"</span> <span style="color: #993300; font-weight: bold;">/></span>    </li><li style="line-height: 18px;">            <span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span> <span style="color: red;">name</span>=<span style="color: blue;">"defaultMaxConnectionsPerHost"</span> <span style="color: red;">value</span>=<span style="color: blue;">"512"</span> <span style="color: #993300; font-weight: bold;">/></span>    </li><li style="line-height: 18px;">        <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">bean</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;">    <span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">property</span><span style="color: #993300; font-weight: bold;">></span>    </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"></</span><span style="color: #993300; font-weight: bold;">bean</span><span style="color: #993300; font-weight: bold;">></span>    </li></ol></div><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">httpClient鐨?.1鐗堟湰涓嶆敮鎸佽繖縐嶉厤緗?/span><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><p style="margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><div bg_html"="" style="width: 936.53125px; overflow-y: hidden; position: relative; line-height: 26px;"><div><div><strong>[html]</strong> <a title="view plain" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-position: 0% 0%; background-repeat: no-repeat;">view plain</a><span data-mod="popu_168"> <a title="copy" style="padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-position: 0% 0%; background-repeat: no-repeat;">copy</a><div style="position: absolute; left: 563px; top: 2950px; width: 18px; height: 18px; z-index: 99;"></div></span></div></div><ol start="1"><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span>  <span style="color: red;">name</span>=<span style="color: blue;">"connectionTimeout"</span> <span style="color: red;">value</span>=<span style="color: blue;">"2000"</span> <span style="color: #993300; font-weight: bold;">/></span>      </li><li style="line-height: 18px;"><span style="color: #993300; font-weight: bold;"><</span><span style="color: #993300; font-weight: bold;">property</span>  <span style="color: red;">name</span>=<span style="color: blue;">"timeout"</span>  <span style="color: red;">value</span>=<span style="color: blue;">"5000"</span> <span style="color: #993300; font-weight: bold;">/></span>    </li></ol></div><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">鍙﹀httpClient鏈韓涔熸槸澶氱嚎紼嬬殑銆傘侶ttpClient that uses a default MultiThreadedHttpConnectionManage</span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;"><bean class="org.apache.commons.httpclient.params.HttpConnectionManagerParams">  </span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">    <property  name="maxTotalConnections"  value="600" />  </span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">    <property  name="defaultMaxConnectionsPerHost"  value="512" />  </span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;"></bean>  </span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">maxConnectionsPerHost 姣忎釜涓繪満鐨勬渶澶у茍琛岄摼鎺ユ暟錛岄粯璁や負2 </span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">public static final int DEFAULT_MAX_HOST_CONNECTIONS = 2; </span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">maxTotalConnections 瀹㈡埛绔誨茍琛岄摼鎺ユ渶澶ф暟錛岄粯璁や負20  </span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">public static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 20; </span><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><property name="connectionTimeout" value="2000"><property name="timeout" value="5000"> </property></property><img src ="http://www.tkk7.com/youngturk/aggbug/430960.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/youngturk/" target="_blank">youngturk</a> 2016-06-19 10:29 <a href="http://www.tkk7.com/youngturk/archive/2016/06/19/430960.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>6. 鍒嗗竷寮忕紦瀛橀泦緹ょ幆澧冮厤緗?杞?/title><link>http://www.tkk7.com/youngturk/archive/2016/06/19/430959.html</link><dc:creator>youngturk</dc:creator><author>youngturk</author><pubDate>Sat, 18 Jun 2016 16:22:00 GMT</pubDate><guid>http://www.tkk7.com/youngturk/archive/2016/06/19/430959.html</guid><wfw:comment>http://www.tkk7.com/youngturk/comments/430959.html</wfw:comment><comments>http://www.tkk7.com/youngturk/archive/2016/06/19/430959.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/youngturk/comments/commentRss/430959.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/youngturk/services/trackbacks/430959.html</trackback:ping><description><![CDATA[     鎽樿: http://www.cnblogs.com/hoojo/archive/2012/07/19/2599534.htmlhttp://www.cnblogs.com/hellowood23/p/5210267.htmlhttp://blog.csdn.net/ni_hao_ya/article/details/9344779http://www.cnblogs.com/hellowood23/p/...  <a href='http://www.tkk7.com/youngturk/archive/2016/06/19/430959.html'>闃呰鍏ㄦ枃</a><img src ="http://www.tkk7.com/youngturk/aggbug/430959.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/youngturk/" target="_blank">youngturk</a> 2016-06-19 00:22 <a href="http://www.tkk7.com/youngturk/archive/2016/06/19/430959.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鎵嬪姩鑾峰彇spring鐨凙pplicationContext鍜宐ean瀵硅薄 http://www.tkk7.com/youngturk/archive/2016/06/18/430958.htmlyoungturkyoungturkSat, 18 Jun 2016 15:56:00 GMThttp://www.tkk7.com/youngturk/archive/2016/06/18/430958.htmlhttp://www.tkk7.com/youngturk/comments/430958.htmlhttp://www.tkk7.com/youngturk/archive/2016/06/18/430958.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/430958.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/430958.htmlWEB欏圭洰錛?/strong>

鏂規硶1錛?/p>

1
ApplicationContext ac1 = WebApplicationContextUtils.getRequiredWebApplicationContext(ServletContext sc)

 鏂規硶2錛?/p>

1
ApplicationContext ac2 = WebApplicationContextUtils.getWebApplicationContext(ServletContext sc)

 鏂規硶3錛?/p>

1
鍐欎竴涓伐鍏風被綾葷戶鎵緼pplicationObjectSupport,騫跺皢榪欎釜鍔犲叆鍒皊pring鐨勫鍣?/code>

 鏂規硶4錛?/p>

1
鍐欎竴涓伐鍏風被綾葷戶鎵縒ebApplicationObjectSupport,騫跺皢榪欎釜鍔犲叆鍒皊pring鐨勫鍣?/code>

 鏂規硶5錛?鎺ㄨ崘)

1
鍐欎竴涓伐鍏風被瀹炵幇ApplicationContextAware鎺ュ彛,騫跺皢榪欎釜鍔犲叆鍒皊pring鐨勫鍣?/code>

 紺轟緥錛?/p>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import java.util.Map;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
 
/**
 * 鑾峰彇ApplicationContext鍜孫bject鐨勫伐鍏風被
 * @author yzl
 *
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public class SpringContextUtils implements ApplicationContextAware {
    private static ApplicationContext applicationContext;
 
    public void setApplicationContext(ApplicationContext arg0)
            throws BeansException {
        applicationContext = arg0;
    }
 
    /**
     * 鑾峰彇applicationContext瀵硅薄
     * @return
     */
    public static ApplicationContext getApplicationContext(){
        return applicationContext;
    }
     
    /**
     * 鏍規嵁bean鐨刬d鏉ユ煡鎵懼璞?/code>
     * @param id
     * @return
     */
    public static Object getBeanById(String id){
        return applicationContext.getBean(id);
    }
     
    /**
     * 鏍規嵁bean鐨刢lass鏉ユ煡鎵懼璞?/code>
     * @param c
     * @return
     */
    public static Object getBeanByClass(Class c){
        return applicationContext.getBean(c);
    }
     
    /**
     * 鏍規嵁bean鐨刢lass鏉ユ煡鎵炬墍鏈夌殑瀵硅薄(鍖呮嫭瀛愮被)
     * @param c
     * @return
     */
    public static Map getBeansByClass(Class c){
        return applicationContext.getBeansOfType(c);
    }
}

 

 

闈濿EB欏圭洰

1
ApplicationContext ac = new FileSystemXmlApplicationContext("applicationContext.xml")

鍙夌殑鎿嶄綔鏂規硶鏈夛細

1
2
3
4
5
6
7
8
9
10
11
涓錛?/code>
String[]   path={"WebRoot/WEB-INF/applicationContext.xml","WebRoot/WEB-INF/applicationContext_task.xml"};
ApplicationContext context = new FileSystemXmlApplicationContext(path);
 
浜岋細
String path="WebRoot/WEB-INF/applicationContext*.xml";
ApplicationContext context = new FileSystemXmlApplicationContext(path);
 
涓夛細
ApplicationContext ctx = new FileSystemXmlApplicationContext("classpath:鍦板潃");
娌℃湁classpath鐨勮瘽灝辨槸浠庡綋鍓嶇殑宸ヤ綔鐩綍


youngturk 2016-06-18 23:56 鍙戣〃璇勮
]]>
Ehcache瀛︿範 杞?/title><link>http://www.tkk7.com/youngturk/archive/2016/06/18/430956.html</link><dc:creator>youngturk</dc:creator><author>youngturk</author><pubDate>Sat, 18 Jun 2016 07:45:00 GMT</pubDate><guid>http://www.tkk7.com/youngturk/archive/2016/06/18/430956.html</guid><wfw:comment>http://www.tkk7.com/youngturk/comments/430956.html</wfw:comment><comments>http://www.tkk7.com/youngturk/archive/2016/06/18/430956.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/youngturk/comments/commentRss/430956.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/youngturk/services/trackbacks/430956.html</trackback:ping><description><![CDATA[     鎽樿: http://ligf06.iteye.com/blog/17108875.    鍦?nbsp;Spring 涓繍鐢?nbsp;EHCache闇瑕佷嬌鐢?Spring 鏉ュ疄鐜頒竴涓?Cache 綆鍗曠殑瑙e喅鏂規錛屽叿浣撻渶姹傚涓嬶細浣跨敤浠繪剰涓涓幇鏈夊紑婧?Cache Framework錛岃姹備嬌鐢?Cache 緋葷粺涓?Service 鎴栧垯 DAO 灞傜殑...  <a href='http://www.tkk7.com/youngturk/archive/2016/06/18/430956.html'>闃呰鍏ㄦ枃</a><img src ="http://www.tkk7.com/youngturk/aggbug/430956.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/youngturk/" target="_blank">youngturk</a> 2016-06-18 15:45 <a href="http://www.tkk7.com/youngturk/archive/2016/06/18/430956.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>搴旂敤鎶鏈葷粨http://www.tkk7.com/youngturk/archive/2016/06/18/430954.htmlyoungturkyoungturkSat, 18 Jun 2016 05:38:00 GMThttp://www.tkk7.com/youngturk/archive/2016/06/18/430954.htmlhttp://www.tkk7.com/youngturk/comments/430954.htmlhttp://www.tkk7.com/youngturk/archive/2016/06/18/430954.html#Feedback0http://www.tkk7.com/youngturk/comments/commentRss/430954.htmlhttp://www.tkk7.com/youngturk/services/trackbacks/430954.html

youngturk 2016-06-18 13:38 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲 无码 在线 专区| 成在人线AV无码免费| 曰批全过程免费视频网址| 97碰公开在线观看免费视频| 国产精品免费观看久久| 日韩亚洲国产二区| 久久亚洲国产欧洲精品一| 亚洲国产成a人v在线| 亚洲AV成人无码网站| 中文无码日韩欧免费视频| 久久成人国产精品免费软件| 永久免费看mv网站入口| 亚洲日韩国产精品第一页一区| 97久久精品亚洲中文字幕无码| 亚洲高清国产拍精品熟女| 久久久久久久国产免费看| 五月亭亭免费高清在线| 亚洲成a人片在线播放| 亚洲视频在线一区| 亚洲a∨国产av综合av下载| 男人的天堂网免费网站| 嫩草影院在线免费观看| 亚洲色欲久久久综合网东京热| 亚洲一区在线观看视频| 一级全免费视频播放| 在线精品一卡乱码免费| 亚洲欧洲日本在线| 亚洲日韩乱码久久久久久| 黄色毛片免费观看| 美丽的姑娘免费观看在线播放| 又大又硬又爽免费视频| 亚洲精品视频久久| 一级毛片免费在线| 黄页网站免费在线观看| 亚洲人精品午夜射精日韩| 国产成人亚洲精品| 两个人看的www免费| 国产精品视_精品国产免费 | 97国产免费全部免费观看| 亚洲精品老司机在线观看| 亚洲国产精品专区|