锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲熟妇无码另类久久久,美女视频黄免费亚洲,亚洲AV无码国产在丝袜线观看http://www.tkk7.com/feng0801/zh-cnFri, 09 May 2025 16:25:13 GMTFri, 09 May 2025 16:25:13 GMT60HttpClient 瓚呮椂寮傚父鍚箟http://www.tkk7.com/feng0801/archive/2018/04/20/433176.htmlForMeBlogForMeBlogFri, 20 Apr 2018 06:36:00 GMThttp://www.tkk7.com/feng0801/archive/2018/04/20/433176.htmlhttp://www.tkk7.com/feng0801/comments/433176.htmlhttp://www.tkk7.com/feng0801/archive/2018/04/20/433176.html#Feedback0http://www.tkk7.com/feng0801/comments/commentRss/433176.htmlhttp://www.tkk7.com/feng0801/services/trackbacks/433176.html

鍏充簬HTTP璇鋒眰瓚呮椂瀛楁瀹氫箟

涓銆丆onnectionRequestTimeout 瓚呮椂
HttpClient 浣跨敤榪炴帴姹犳潵綆$悊榪炴帴錛岃繖涓椂闂存槸浠庤繛鎺ユ睜鑾峰彇榪炴帴鐨勮秴鏃舵椂闂達紝鍙互鑱旀兂浠庢暟鎹簱榪炴帴姹犺幏鍙栨暟鎹簱榪炴帴銆?/div>

浜屻丆onnectTimeout 瓚呮椂
寤虹珛榪炴帴瓚呮椂錛屽鎴風鍜屾湇鍔″櫒闂村緩绔嬭繛鎺ヨ繘琛岀殑涓夋鎻℃墜瀹屾垚鐨勬椂闂?/div>

涓夈丼ocketTimeout 瓚呮椂
鏁版嵁浼犺緭榪囩▼涓暟鎹寘涔嬮棿闂撮殧鐨勬渶澶ф椂闂達紝Http鍝嶅簲鎶ユ枃鍙兘鏈夊涓皬鎶ユ枃緇勬垚錛?/div>
濡傛灉浼犺緭鎶ユ枃鐨勯棿闅旀椂闂磋秴榪囪緗繖涓椂闂達紝浼氭姤 java.net.SocketTimeoutException: Read timed out 寮傚父鐨?/div>


ForMeBlog 2018-04-20 14:36 鍙戣〃璇勮
]]>Eclipse 甯哥敤蹇嵎閿眹鎬?/title><link>http://www.tkk7.com/feng0801/archive/2015/11/20/428306.html</link><dc:creator>ForMeBlog</dc:creator><author>ForMeBlog</author><pubDate>Fri, 20 Nov 2015 08:36:00 GMT</pubDate><guid>http://www.tkk7.com/feng0801/archive/2015/11/20/428306.html</guid><wfw:comment>http://www.tkk7.com/feng0801/comments/428306.html</wfw:comment><comments>http://www.tkk7.com/feng0801/archive/2015/11/20/428306.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/feng0801/comments/commentRss/428306.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/feng0801/services/trackbacks/428306.html</trackback:ping><description><![CDATA[<div><span style="color: #ff6600;">鎻愮ず錛氱紪鍐橢clipse甯哥敤蹇嵎閿啓鎴愭枃妗o紝涓昏鏄負浜嗚嚜宸辯啛鎮変竴涓嬭繖浜涘揩鎹烽敭錛屾柟渚夸互鍚庢煡鎵懼拰緙栫▼涓嬌鐢紒</span></div> <div>涓銆佺紪杈戠被蹇嵎閿?/div> <div>1銆丆trl + 1 蹇熶慨澶嶏紝鍙互瑙e喅寰堝闂錛屼緥濡俰mport綾匯乼ry catch鍖呭洿絳夈?/div> <div>2銆丆trl + Shift + F 鏍煎紡鍖栧綋鍓嶄唬鐮併?/div> <div>3銆丆trl + Shift + M 娣誨姞綾葷殑import寮曞叆銆?/div> <div>4銆丆trl + Shift + M 緇勭粐綾葷殑import寮曞叆錛屾棦鏈塁trl + Shift + M 鐨勪綔鐢紝鍙堝彲浠ュ府浣犲幓闄ゆ病鏈夌敤鐨勫紩鍏ャ?/div> <div>5銆丆trl + Y 閲嶅仛涓嶤trl + Z 鐩稿弽鐨勪綔鐢ㄣ?/div> <div>6銆丄lt + / 鍐呭杈呭姪</div> <div>7銆丆trl + D 鍒犻櫎褰撳墠琛屾垨鑰呴変腑鐨勫琛?/div> <div>8銆丄lt + Down 褰撳墠琛屽拰涓嬮潰涓琛屼氦鎹綅緗?/div> <div>9銆丄lt + Up 褰撳墠琛屽拰涓婇潰涓琛屼氦鎹綅緗?/div> <div>10銆丼hift + Enter 鍦ㄥ綋鍓嶈鐨勪笅涓琛屾彃鍏ョ┖琛?/div> <div>11銆丆trl + / 娉ㄩ噴褰撳墠琛岋紝鍐嶆鎸夊垯鍙栨秷娉ㄩ噴</div> <div>浜屻侀夋嫨蹇嵎閿?/div> <div>1銆丄lt + Shift + Up 閫夋嫨灝佽鍏冪礌</div> <div>2銆丄lt + Shift + Left 閫夋嫨涓婁竴涓厓绱?/div> <div>3銆丄lt + Shift + Right閫夋嫨涓嬩竴涓厓绱?/div> <div>4銆丼hift + Left 浠庡厜鏍囧寮濮嬪線宸﹂夋嫨瀛楃涓?/div> <div>5銆丼hift + Right 浠庡厜鏍囧寮濮嬪線鍙抽夋嫨瀛楃涓?/div> <div>6銆丆trl + Shift + Left 閫変腑鍏夋爣宸﹁竟鐨勫崟璇?/div> <div>7銆丆trl + Shift + Right 閫変腑鍏夋爣鍙寵竟鐨勫崟璇?/div> <div> </div> <div>涓夈佺Щ鍔ㄥ揩鎹烽敭</div> <div>1銆丆trl + Left 鍏夋爣縐誨埌宸﹁竟鍗曡瘝鐨勫紑澶達紝</div> <div>2銆丆trl + Right 鍏夋爣縐誨埌鍙寵竟鍗曡瘝鐨勬湯灝俱?/div> <div> </div> <div>鍥涖佹悳绱㈠揩鎹烽敭</div> <div>1銆丆trl + K 鍙傜収閫変腑鐨勬枃瀛楀揩閫熷畾浣嶅埌涓嬩竴涓紝濡傛灉娌℃湁閫変腑鏂囧瓧鍒欐悳绱笂涓嬈′嬌鐢ㄦ悳绱㈢殑鏂囧瓧銆?/div> <div>2銆丆trl + Shift + K 鍙傜収閫変腑鐨勬枃瀛楀揩閫熷畾浣嶅埌涓婁竴涓?/div> <div>3銆丆trl + J 姝e悜澧為噺鏌ユ壘錛屾寜涓嬭繖涓揩鎹烽敭鍚庯紝浣犳墍杈撳叆鐨勬瘡涓瓧姣嶇紪杈戝櫒閮芥彁渚涘揩閫熷尮閰嶅埌鏌愪釜鍗曡瘝錛屽鏋滄病鏈夊湪鐘舵佹爮涓樉紺烘病鏈夋壘鍒幫紝閫鍑鴻繖涓ā寮忔寜ESC閿?/div> <div>4銆丆trl + Shift + J 鍙嶅悜澧為噺鏌ユ壘</div> <div>5銆丆trl + Shift + U 鍒楀嚭鎵鏈夊寘鍚瓧絎︿覆鐨勮</div> <div>6銆丆trl + G 宸ヤ綔鍖轟腑鐨勫0鏄?/div> <div>7銆丆trl + Shift + G 宸ヤ綔鍖轟腑鐨勫紩鐢?/div> <div> </div> <div>浜斻佸鑸揩鎹烽敭</div> <div>1銆丆trl + Shift + T 鎼滅儲綾?/div> <div>2銆丆trl + Shift + R 鎼滅儲宸ョ▼涓殑鏂囦歡</div> <div>3銆丆trl + E 蹇熸樉紺哄綋鍓嶇紪杈戝尯鐨勪笅鎷夊垪琛?/div> <div>4銆丗4 鎵撳紑綾誨瀷灞傛緇撴瀯</div> <div>5銆丗3 璺寵漿鍒板0鏄庡</div> <div>6銆丄lt + Left 鍓嶄竴涓紪杈戦〉闈?/div> <div>7銆丄lt + Right 涓嬩竴涓紪杈戦〉闈?/div> <div>8銆丆trl + PageUp/PageDown鍦ㄧ紪杈戝櫒涓紝鍒囨崲宸茬粡鎵撳紑鐨勬枃浠?/div> <div> </div> <div>鍏佽皟璇曞揩鎹烽敭</div> <div>1銆丗5 鍗曟璺沖叆</div> <div>2銆丗6 鍗曟璺寵繃</div> <div>3銆丗7 鍗曟榪樺洖</div> <div>4銆丗8 緇х畫</div> <div>5銆丆trl + Shift + D 鏄劇ず鍙橀噺鐨勫?/div> <div>6銆丆trl + shift + B 鍦ㄥ綋鍓嶈璁劇疆鎴栬呭幓鎺夋柇鐐?/div> <div>7銆丆trl + R 榪愯鑷寵錛屾瘮杈冨ソ鐢ㄥ彲浠ョ渷濂藉鐨勬柇鐐?/div> <div> </div> <div>涓冦侀噸鏋勫揩鎹烽敭</div> <div>1銆丄lt + Shift + R 閲嶅懡鍚嶇被鍚嶃佹柟娉曞悕銆佸睘鎬э紙鍙橀噺錛夊悕銆?/div> <div>2銆丄lt + Shift + M 鎶婁竴孌靛嚱鏁板唴鐨勪唬鐮佹娊鍙栨垚鏂規硶錛岃繖鏄噸鏋勯噷闈㈡渶甯哥敤鐨勬柟娉曚箣涓錛岀壒鍒槸瀵逛簬涓澶у潹浠g爜寰堟湁鐢ㄣ?/div> <div>3銆丄lt + Shift + C 淇敼鍑芥暟緇撴瀯錛屾瘮杈冨疄鐢ㄦ湁N涓嚱鏁拌皟鐢ㄤ簡榪欎釜鏂規硶淇敼涓嬈″氨琛屼簡銆?/div> <div>4銆丄lt + Shift + L 鎶藉彇鏈湴鍙橀噺錛屽彲浠ョ洿鎺ユ妸涓浜涢瓟娉曟暟瀛楀拰瀛楃涓叉娊鍙栨垚涓涓彉閲忥紝灝ゅ叾鏄鍑鴻皟鐢ㄧ殑鏃跺欍?/div> <div>5銆丄lt + Shift + F 鎶奀lass涓殑灞閮ㄥ彉閲忓彉涓哄叏灞鍙橀噺</div> <div>6銆丄lt + Shift + I 鍚堝茍鍙橀噺錛屽皢鍒涘緩綆鍖?/div> <div>7銆丄lt + Shift + Z 鎾ら攢閲嶆瀯</div> <div> </div> <div>鍏佸叾浠栧揩鎹烽敭</div> <div>1銆丄lt + Enter 鏄劇ず褰撳墠閫夋嫨璧勬簮鐨勫睘鎬э紝鍦╳indows涓嬫煡鐪嬫枃浠剁殑灞炴у氨鏄繖涓揩鎹烽敭錛岄氬父鍙互鐢ㄦ潵鏌ョ湅鏂囦歡鍦╳indows涓殑瀹為檯璺緞銆?/div> <div>2銆丆trl + Up鏂囨湰緙栬緫鍣ㄥ悜涓婃粴琛?/div> <div>3銆丆trl + Down 鏂囨湰緙栬緫鍣ㄥ悜涓嬫粴琛?/div> <div>4銆丆trl + M 鏈澶у寲褰撳墠鐨凟dit鎴栬匳iew錛屽啀鎸夊垯緙╁皬</div> <div>5銆丆trl + O 蹇熸樉紺篛utline</div> <div>6銆丆trl + T 蹇熸樉紺哄綋鍓嶇被鐨勭戶鎵跨粨鏋勶紝閫変腑鎺ュ彛鏂規硶鎸変笅榪欏揩鎹峰彲浠ヨ煩杞埌瀹炵幇綾伙紝鍦ㄩ」鐩瓺AO涓粡甯哥敤銆?/div> <div>7銆丆trl + W 鍏抽棴褰撳墠Editer</div> <div>8銆丆trl + L 鏂囨湰緙栬緫鍣ㄨ漿鑷寵</div> <div>9銆丗2 鏄劇ず宸ュ叿鎻愮ず鎻忚堪錛岄夋嫨綾繪垨鑰呭彉閲忔寜涓嬭閿細鏈夋彁紺哄嚭鏉?/div><img src ="http://www.tkk7.com/feng0801/aggbug/428306.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/feng0801/" target="_blank">ForMeBlog</a> 2015-11-20 16:36 <a href="http://www.tkk7.com/feng0801/archive/2015/11/20/428306.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>涓轟粈涔堣涓ゆ璋冪敤encodeURI鏉ヨВ鍐充貢鐮侀棶棰?/title><link>http://www.tkk7.com/feng0801/archive/2015/08/18/426866.html</link><dc:creator>ForMeBlog</dc:creator><author>ForMeBlog</author><pubDate>Tue, 18 Aug 2015 03:20:00 GMT</pubDate><guid>http://www.tkk7.com/feng0801/archive/2015/08/18/426866.html</guid><wfw:comment>http://www.tkk7.com/feng0801/comments/426866.html</wfw:comment><comments>http://www.tkk7.com/feng0801/archive/2015/08/18/426866.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/feng0801/comments/commentRss/426866.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/feng0801/services/trackbacks/426866.html</trackback:ping><description><![CDATA[<p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); padding-bottom: 0px; padding-top: 0px; font: 15px/35px 'microsoft yahei'; padding-left: 0px; margin: 0px; widows: 1; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><span style="font-family: 'Courier New'"><span style="font-family: 'Courier New'; background-color: rgb(245,245,245)">浠婂ぉ閬囧埌璋冪敤encodeURL璋冪敤浜屾鐨勭枒闂紝铏界劧涔嬪墠鐭ラ亾瑕佽皟鐢ㄤ簩嬈★紝浣嗘槸鍏蜂綋涓嶆槸澶竻妤氶噷闈㈠叿浣撶殑榪愯榪囩▼錛岃繖鏄漿杞界殑榪欎釜鍐欑殑姣旇緝璇︾粏錛屾妸鏁翠釜榪愯榪囩▼璇︾粏瑙h浜嗕竴涓嬶紝闈炲父涓嶉敊鎵浠ヨ漿杞借繃浜嗕緵鍏朵粬浜哄垎浜?br />.encodeURL鍑芥暟涓昏鏄潵瀵筓RI鏉ュ仛杞爜錛屽畠榛樿鏄噰鐢ㄧ殑UTF-8鐨勭紪鐮?</span><br /><span style="font-family: 'Courier New'; background-color: rgb(245,245,245)">. UTF-8緙栫爜鐨勬牸寮?涓涓眽瀛楁潵涓変釜瀛楄妭鏋勬垚錛屾瘡涓涓瓧鑺備細杞崲鎴?6榪涘埗鐨勭紪鐮侊紝鍚屾椂娣誨姞涓?鍙?</span><br /></span></p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); padding-bottom: 0px; padding-top: 0px; font: 15px/35px 'microsoft yahei'; padding-left: 0px; margin: 0px; widows: 1; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><span style="font-family: 'Courier New'">鍋囪欏甸潰绔緭鍏ョ殑涓枃鏄竴涓?#8220;涓?#8221;錛屾寜鐓т笅闈㈡楠よ繘琛岃В鐮?/span></p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); padding-bottom: 0px; padding-top: 0px; font: 15px/35px 'microsoft yahei'; padding-left: 0px; margin: 0px; widows: 1; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><span style="font-family: 'Courier New'; font-weight: bold; color: rgb(128,0,0)">1</span><span style="font-family: 'Courier New'">.絎竴嬈ncodeURI錛?span style="color: rgb(255,0,255); line-height: 1.5">鎸夌収utf</span></span><span style="font-family: 'Courier New'; color: rgb(255,0,255)">-8鏂瑰紡鑾峰彇瀛楄妭鏁扮粍鍙樻垚[-28,-72-83]錛屽瀛楄妭鐮佹暟緇勮繘琛岄亶鍘嗭紝鎶婃瘡涓瓧鑺傝漿鍖栨垚瀵瑰簲鐨?6榪涘埗鏁幫紝榪欐牱灝卞彉鎴愪簡[E4,B8,AD],鏈鍚庡彉鎴怺%E4,%B8,%AD]  姝ゆ椂宸茬粡娌℃湁浜嗗瀛楄妭瀛楃錛屽叏閮ㄦ槸鍗曞瓧鑺傚瓧絎︺?/span></p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); padding-bottom: 0px; padding-top: 0px; font: 15px/35px 'microsoft yahei'; padding-left: 0px; margin: 0px; widows: 1; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><span style="font-family: 'Courier New'"><span><strong>2銆?span style="font-family: 'Courier New'">絎簩嬈ncodeURI錛岃繘琛岀紪鐮侊紝浼氭妸%鐪嬫垚涓涓漿涔夊瓧絎︼紝騫朵笉緙栫爜%浠ュ悗瀛楃錛屼細鎶?緙栫爜鎴?25.鎶婃暟緇勬渶鍚庡彉鎴?/span><span style="font-family: 'Courier New'; color: rgb(255,0,0)">[</span><span style="font-family: 'Courier New'; color: rgb(255,0,0)">%25E4,%25B8,%25AD</span><span style="font-family: 'Courier New'; color: rgb(255,0,0)">]</span><span style="font-family: 'Courier New'">鐒跺悗灝辨妸澶勭悊鍚庣殑鏁版嵁</span><span style="font-family: 'Courier New'; color: rgb(255,0,0)">[</span><span style="font-family: 'Courier New'; color: rgb(255,0,0)">%25E4,%25B8,%25AD</span><span style="font-family: 'Courier New'; color: rgb(255,0,0)">]</span><span style="font-family: 'Courier New'">鍙戝線鏈嶅姟鍣ㄧ錛?br />褰撳簲鐢ㄦ湇鍔″櫒璋冪敤getParameter鏂規硶錛実etParameter鏂規硶浼氬幓鍚戝簲鐢ㄦ湇鍔″櫒璇鋒眰鍙傛暟<br />搴旂敤鏈嶅姟鍣ㄦ渶鍒濊幏寰楃殑灝辨槸鍙戦佹潵鐨?/span><span style="font-family: 'Courier New'; color: rgb(255,0,0)">[</span><span style="font-family: 'Courier New'; color: rgb(255,0,0)">%25E4,%25B8,%25AD</span><span style="font-family: 'Courier New'; color: rgb(255,0,0)">]</span><span style="font-family: 'Courier New'">錛屽簲鐢ㄦ湇鍔″櫒浼氬榪欎釜鏁版嵁榪涜URLdecode鎿嶄綔錛屽簲鐢ㄦ湇鍔″櫒榪涜瑙g爜鐨勮繖涓嬈★紝涓嶇鏄寜鐓TF-8錛岃繕鏄疓BK錛岃繕鏄疘SO-8859錛?閮借兘寰楀埌</span><span style="font-family: 'Courier New'; color: rgb(255,0,0)">[</span><span style="font-family: 'Courier New'; color: rgb(255,0,0)">%E4,%B8,%AD</span><span style="font-family: 'Courier New'; color: rgb(255,0,0)">]</span><span style="font-family: 'Courier New'">錛屽洜涓洪兘浼氭妸%25瑙f瀽鎴?.騫舵妸榪欎釜鍊艱繑鍥炵粰getParameter鏂規硶</span></strong></span></span></p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); padding-bottom: 0px; padding-top: 0px; font: 15px/35px 'microsoft yahei'; padding-left: 0px; margin: 0px; widows: 1; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><span style="font-family: 'Courier New'"><span><strong>3\銆佸啀鐢║TF-8瑙g爜涓嬈★紝灝卞緱鍒?涓?浜嗐?/strong></span></span></p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); padding-bottom: 0px; padding-top: 0px; font: 15px/35px 'microsoft yahei'; padding-left: 0px; margin: 0px; widows: 1; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><span style="font-family: 'Courier New'"><span><strong>鎯蟲兂鐪嬶紝濡傛灉涓嶇紪鐮佷袱嬈★紝褰撴湇鍔″櫒鑷姩瑙g爜鐨勬椂鍊欙紝鍋囧鏄寜鐓SO-8859鍘昏В鐮乁TF-8緙栫爜鐨勪笢瑗匡紝灝辨槸浼氬嚭鐜頒貢鐮併?/strong></span></span></p> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); padding-bottom: 0px; padding-top: 0px; font: 15px/35px 'microsoft yahei'; padding-left: 0px; margin: 0px; widows: 1; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px">JS:</p> <div id="bd9zfh7" class="dp-highlighter bg_sql" style="overflow: hidden; border-top-color: rgb(204,204,204); width: 938px; white-space: normal; word-spacing: 0px; text-transform: none; border-left-color: rgb(204,204,204); color: rgb(85,85,85); border-bottom-color: rgb(204,204,204); text-align: left; padding-top: 1px; font: 12px/35px Consolas, 'Courier New', Courier, mono, serif; margin: 18px 0px; widows: 1; border-right-color: rgb(204,204,204); letter-spacing: normal; background-color: rgb(231,229,220); text-indent: 0px; -webkit-text-stroke-width: 0px"> <div id="7hvbdvp" class="bar" style="padding-left: 45px"> <div id="19r9hx7" class="tools" style="color: silver; padding-bottom: 10px; padding-top: 3px; font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif; padding-left: 10px; border-left: rgb(108,226,108) 3px solid; padding-right: 8px; background-color: rgb(248,248,248); font-stretch: normal"><strong>[sql]</strong><span id="hjrn97p" class="Apple-converted-space"> </span><a onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" title="view plain" class="ViewSource" style="font-size: 9px; text-decoration: none; border-top: medium none; height: 16px; border-right: medium none; width: 16px;background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-repeat: no-repeat; border-bottom: medium none; background-position: 0% 0%; color: rgb(12,137,207); padding-bottom: 1px; padding-top: 1px; padding-left: 1px; margin: 0px 10px 0px 0px; border-left: medium none; display: inline-block; padding-right: 1px; text-indent: -2000px; background-size: initial; background-origin: initial; background-clip: initial" >view plain</a><a onclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;" title="copy" class="CopyToClipboard" style="font-size: 9px; text-decoration: none; border-top: medium none; height: 16px; border-right: medium none; width: 16px;background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-repeat: no-repeat; border-bottom: medium none; background-position: 0% 0%; color: rgb(12,137,207); padding-bottom: 1px; padding-top: 1px; padding-left: 1px; margin: 0px 10px 0px 0px; border-left: medium none; display: inline-block; padding-right: 1px; text-indent: -2000px; background-size: initial; background-origin: initial; background-clip: initial" >copy</a> <div style="height: 18px; width: 18px; position: absolute; left: 417px; z-index: 99; top: 833px"><embed id="ZeroClipboardMovie_1" name="ZeroClipboardMovie_1" type="application/x-shockwave-flash" align="center" pluginspage="http://www.macromedia.com/go/getflashplayer" height="18" width="18" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" wmode="transparent" flashvars="id=1&width=18&height=18" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false"></div></div></div> <ol class="dp-sql" style="list-style-type: decimal; border-top: medium none; border-right: medium none; border-bottom: medium none; color: rgb(92,92,92); padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 1px 45px; border-left: medium none; padding-right: 0px; background-color: rgb(255,255,255)"><li id="77b1997" class="alt" style="border-top-style: none; list-style-type: decimal-leading-zero; list-style-position: outside; border-bottom-style: none; color: ; padding-bottom: 0px !important; padding-top: 0px !important; border-right-style: none; padding-left: 10px !important; margin: 0px; border-left: rgb(108,226,108) 3px solid; line-height: 18px; padding-right: 3px !important; background-color: rgb(255,255,255)"><span style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: black; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px"><span style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: black; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">document.authorityForm.</span><span id="jvln9nv" class="keyword" style="border-top: medium none; border-right: medium none; border-bottom: medium none; font-weight: bold; color: rgb(0,102,153); padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">action</span><span style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: black; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px"> = basePath3+</span><span id="lp7p9d7" class="string" style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: blue; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">"User_viewUser.do?id="</span><span style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: black; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">+id+</span><span id="9h197tn" class="string" style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: blue; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">"&roleName="</span><span style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: black; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">+encodeURI(encodeURI(roleName))+</span><span id="r9xvj1r" class="string" style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: blue; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">"&roleType="</span><span style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: black; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">+roleType;  </span></span></li></ol></div> <p style="white-space: normal; word-spacing: 0px; text-transform: none; color: rgb(85,85,85); padding-bottom: 0px; padding-top: 0px; font: 15px/35px 'microsoft yahei'; padding-left: 0px; margin: 0px; widows: 1; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><br />JAVA鍚庡彴錛?br />   </p> <div id="jndztvd" class="dp-highlighter bg_sql" style="overflow: hidden; border-top-color: rgb(204,204,204); width: 938px; white-space: normal; word-spacing: 0px; text-transform: none; border-left-color: rgb(204,204,204); color: rgb(85,85,85); border-bottom-color: rgb(204,204,204); text-align: left; padding-top: 1px; font: 12px/35px Consolas, 'Courier New', Courier, mono, serif; margin: 18px 0px; widows: 1; border-right-color: rgb(204,204,204); letter-spacing: normal; background-color: rgb(231,229,220); text-indent: 0px; -webkit-text-stroke-width: 0px"> <div id="vxrlntv" class="bar" style="padding-left: 45px"> <div id="xh77zzn" class="tools" style="color: silver; padding-bottom: 10px; padding-top: 3px; font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif; padding-left: 10px; border-left: rgb(108,226,108) 3px solid; padding-right: 8px; background-color: rgb(248,248,248); font-stretch: normal"><strong>[sql]</strong><span id="p77zpll" class="Apple-converted-space"> </span><a onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" title="view plain" class="ViewSource" style="font-size: 9px; text-decoration: none; border-top: medium none; height: 16px; border-right: medium none; width: 16px;background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); background-repeat: no-repeat; border-bottom: medium none; background-position: 0% 0%; color: rgb(12,137,207); padding-bottom: 1px; padding-top: 1px; padding-left: 1px; margin: 0px 10px 0px 0px; border-left: medium none; display: inline-block; padding-right: 1px; text-indent: -2000px; background-size: initial; background-origin: initial; background-clip: initial" >view plain</a><a onclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;" title="copy" class="CopyToClipboard" style="font-size: 9px; text-decoration: none; border-top: medium none; height: 16px; border-right: medium none; width: 16px;background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); background-repeat: no-repeat; border-bottom: medium none; background-position: 0% 0%; color: rgb(12,137,207); padding-bottom: 1px; padding-top: 1px; padding-left: 1px; margin: 0px 10px 0px 0px; border-left: medium none; display: inline-block; padding-right: 1px; text-indent: -2000px; background-size: initial; background-origin: initial; background-clip: initial" >copy</a> <div style="height: 18px; width: 18px; position: absolute; left: 417px; z-index: 99; top: 1043px"><embed id="ZeroClipboardMovie_2" name="ZeroClipboardMovie_2" type="application/x-shockwave-flash" align="center" pluginspage="http://www.macromedia.com/go/getflashplayer" height="18" width="18" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" wmode="transparent" flashvars="id=2&width=18&height=18" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false"></div></div></div> <ol class="dp-sql" style="list-style-type: decimal; border-top: medium none; border-right: medium none; border-bottom: medium none; color: rgb(92,92,92); padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 1px 45px; border-left: medium none; padding-right: 0px; background-color: rgb(255,255,255)"><li id="l99rb9v" class="alt" style="border-top-style: none; list-style-type: decimal-leading-zero; list-style-position: outside; border-bottom-style: none; color: ; padding-bottom: 0px !important; padding-top: 0px !important; border-right-style: none; padding-left: 10px !important; margin: 0px; border-left: rgb(108,226,108) 3px solid; line-height: 18px; padding-right: 3px !important; background-color: rgb(255,255,255)"><span style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: black; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px"><span style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: black; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">roleName = java.net.URLDecoder.decode(getRequest().getParameter(</span><span id="79nbllj" class="string" style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: blue; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">"roleName"</span><span style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: black; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">),</span><span id="zvxpj79" class="string" style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: blue; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">"UTF-8"</span><span style="border-top: medium none; border-right: medium none; border-bottom: medium none; color: black; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: medium none; padding-right: 0px">);  </span></span></li></ol></div><img src ="http://www.tkk7.com/feng0801/aggbug/426866.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/feng0801/" target="_blank">ForMeBlog</a> 2015-08-18 11:20 <a href="http://www.tkk7.com/feng0801/archive/2015/08/18/426866.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Java鍩虹涔嬬悊瑙nnotationhttp://www.tkk7.com/feng0801/archive/2015/06/11/425636.htmlForMeBlogForMeBlogThu, 11 Jun 2015 10:06:00 GMThttp://www.tkk7.com/feng0801/archive/2015/06/11/425636.htmlhttp://www.tkk7.com/feng0801/comments/425636.htmlhttp://www.tkk7.com/feng0801/archive/2015/06/11/425636.html#Feedback0http://www.tkk7.com/feng0801/comments/commentRss/425636.htmlhttp://www.tkk7.com/feng0801/services/trackbacks/425636.html

 

銆佹蹇?/strong>

 

 

銆銆 Annontation鏄?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">Java5寮濮嬪紩鍏ョ殑鏂扮壒寰併備腑鏂囧悕縐頒竴鑸彨娉ㄨВ銆傚畠鎻愪緵浜嗕竴縐嶅畨鍏ㄧ殑綾諱技娉ㄩ噴鐨勬満鍒訛紝鐢ㄦ潵灝嗕換浣曠殑淇℃伅鎴栧厓鏁版嵁錛?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">metadata錛変笌紼嬪簭鍏冪礌錛堢被銆佹柟娉曘佹垚鍛樺彉閲忕瓑錛夎繘琛屽叧鑱斻?/p>

 

銆銆鏇撮氫織鐨勬剰鎬濇槸涓虹▼搴忕殑鍏冪礌錛堢被銆佹柟娉曘佹垚鍛樺彉閲忥級鍔犱笂鏇寸洿瑙傛洿鏄庝簡鐨勮鏄庯紝榪欎簺璇存槑淇℃伅鏄笌紼嬪簭鐨勪笟鍔¢昏緫鏃犲叧錛屽茍涓旀槸渚涙寚瀹氱殑宸ュ叿鎴栨鏋朵嬌鐢ㄧ殑銆?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">

 

Annontation鍍忎竴縐嶄慨楗扮涓鏍鳳紝搴旂敤浜庡寘銆佺被鍨嬨佹瀯閫犳柟娉曘佹柟娉曘佹垚鍛樺彉閲忋佸弬鏁板強鏈湴鍙橀噺鐨勫0鏄庤鍙ヤ腑銆?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">

 

浜?/span>銆佸師鐞?/strong>

 

銆銆Annotation鍏跺疄鏄竴縐嶆帴鍙c傞氳繃Java鐨勫弽灝勬満鍒剁浉鍏崇殑API鏉ヨ闂?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">annotation淇℃伅銆傜浉鍏崇被錛堟鏋舵垨宸ュ叿涓殑綾伙級鏍規嵁榪欎簺淇℃伅鏉ュ喅瀹氬浣曚嬌鐢ㄨ紼嬪簭鍏冪礌鎴栨敼鍙樺畠浠殑琛屼負銆?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">

 

銆銆annotation鏄笉浼氬獎鍝嶇▼搴忎唬鐮佺殑鎵ц錛屾棤璁?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">annotation鎬庝箞鍙樺寲錛屼唬鐮侀兘濮嬬粓濡備竴鍦版墽琛屻?/p>

 

銆銆Java璇█瑙i噴鍣ㄥ湪宸ヤ綔鏃朵細蹇界暐榪欎簺annotation錛屽洜姝ゅ湪JVM 涓繖浜?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">annotation鏄?#8220;涓嶈搗浣滅敤”鐨勶紝鍙兘閫氳繃閰嶅鐨勫伐鍏鋒墠鑳藉榪欎簺annontaion綾誨瀷鐨勪俊鎭繘琛岃闂拰澶勭悊銆?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">

 

銆銆Annotation涓?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">interface鐨勫紓鍚?/span>錛?/p>

 

銆銆銆銆1錛夈?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">Annotation綾誨瀷浣跨敤鍏抽敭瀛?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">@interface鑰屼笉鏄?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">interface銆?/p>

 

銆銆榪欎釜鍏抽敭瀛楀0鏄庨殣鍚簡涓涓俊鎭細瀹冩槸緇ф壙浜?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">java.lang.annotation.Annotation鎺ュ彛錛屽茍闈炲0鏄庝簡涓涓?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">interface

 

銆銆銆銆2錛夈?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">Annotation綾誨瀷銆佹柟娉曞畾涔夋槸鐙壒鐨勩佸彈闄愬埗鐨勩?/p>

 

銆銆Annotation 綾誨瀷鐨勬柟娉曞繀欏誨0鏄庝負鏃犲弬鏁般佹棤寮傚父鎶涘嚭鐨勩傝繖浜涙柟娉曞畾涔変簡annotation鐨勬垚鍛橈細鏂規硶鍚嶆垚涓轟簡鎴愬憳鍚嶏紝鑰屾柟娉曡繑鍥炲兼垚涓轟簡鎴愬憳鐨勭被鍨嬨傝屾柟娉曡繑鍥炲肩被鍨嬪繀欏諱負primitive綾誨瀷銆?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">Class綾誨瀷銆佹灇涓劇被鍨嬨?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">annotation綾誨瀷鎴栬呯敱鍓嶉潰綾誨瀷涔嬩竴浣滀負鍏冪礌鐨勪竴緇存暟緇勩傛柟娉曠殑鍚庨潰鍙互浣跨敤 default鍜屼竴涓粯璁ゆ暟鍊兼潵澹版槑鎴愬憳鐨勯粯璁ゅ鹼紝null涓嶈兘浣滀負鎴愬憳榛樿鍊鹼紝榪欎笌鎴戜滑鍦ㄩ潪annotation綾誨瀷涓畾涔夋柟娉曟湁寰堝ぇ涓嶅悓銆?/p>

 

銆銆Annotation綾誨瀷鍜屽畠鐨勬柟娉曚笉鑳戒嬌鐢?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">annotation綾誨瀷鐨勫弬鏁般佹垚鍛樹笉鑳芥槸generic銆傚彧鏈夎繑鍥炲肩被鍨嬫槸Class鐨勬柟娉曞彲浠ュ湪annotation綾誨瀷涓嬌鐢?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">generic錛屽洜涓烘鏂規硶鑳藉鐢ㄧ被杞崲灝嗗悇縐嶇被鍨嬭漿鎹負Class銆?/p>

 

銆銆銆銆3錛夈?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">Annotation綾誨瀷鍙堜笌鎺ュ彛鏈夌潃榪戜技涔嬪銆?/p>

 

銆銆瀹冧滑鍙互瀹氫箟甯擱噺銆侀潤鎬佹垚鍛樼被鍨嬶紙姣斿鏋氫婦綾誨瀷瀹氫箟錛夈?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">Annotation綾誨瀷涔熷彲浠ュ鎺ュ彛涓鑸瀹炵幇鎴栬呯戶鎵褲?/p>

 

 

涓?/span>銆佸簲鐢ㄥ満鍚?/span>

 

銆銆annotation涓鑸綔涓轟竴縐嶈緟鍔╅斿緞錛屽簲鐢ㄥ湪杞歡妗嗘灦鎴栧伐鍏蜂腑錛屽湪榪欎簺宸ュ叿綾諱腑鏍規嵁涓嶅悓鐨?annontation娉ㄨВ淇℃伅閲囧彇涓嶅悓鐨勫鐞嗚繃紼嬫垨鏀瑰彉鐩稿簲紼嬪簭鍏冪礌錛堢被銆佹柟娉曞強鎴愬憳鍙橀噺絳夛級鐨勮涓恒?/p>

 

銆銆渚嬪錛?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">Junit銆?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">Struts銆?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">Spring絳夋祦琛屽伐鍏鋒鏋朵腑鍧囧箍娉涗嬌鐢ㄤ簡annontion銆備嬌浠g爜鐨勭伒媧繪уぇ鎻愰珮銆?/p>

 

 

 鍥?/span>銆佸父瑙佹爣鍑嗙殑Annotation

 

銆銆浠?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">java5鐗堟湰寮濮嬶紝鑷甫浜嗕笁縐嶆爣鍑?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">annontation綾誨瀷,

 

銆銆銆銆錛?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">1錛夈?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">Override

 

銆銆java.lang.Override 鏄竴涓?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">marker annotation綾誨瀷錛屽畠琚敤浣滄爣娉ㄦ柟娉曘傚畠璇存槑浜嗚鏍囨敞鐨勬柟娉曢噸杞戒簡鐖剁被鐨勬柟娉曪紝璧峰埌浜嗘柇璦鐨勪綔鐢ㄣ傚鏋滄垜浠嬌鐢ㄤ簡榪欑annotation鍦ㄤ竴涓病鏈夎鐩栫埗綾繪柟娉曠殑鏂規硶鏃訛紝java緙栬瘧鍣ㄥ皢浠ヤ竴涓紪璇戦敊璇潵璀︾ず銆?/p>

 

銆銆榪欎釜annotaton甯稿父鍦ㄦ垜浠瘯鍥捐鐩栫埗綾繪柟娉曡岀‘鍙堝啓閿欎簡鏂規硶鍚嶆椂鍔犱竴涓繚闅滄х殑鏍¢獙榪囩▼銆?/p>

 

銆銆銆銆錛?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">2錛夈?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">Deprecated

 

銆銆Deprecated涔熸槸涓縐?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">marker annotation銆傚綋涓涓被鍨嬫垨鑰呯被鍨嬫垚鍛樹嬌鐢?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">@Deprecated淇グ鐨勮瘽錛岀紪璇戝櫒灝嗕笉榧撳姳浣跨敤榪欎釜琚爣娉ㄧ殑紼嬪簭鍏冪礌銆傛墍浠ヤ嬌鐢ㄨ繖縐嶄慨楗板叿鏈変竴瀹氱殑 “寤剁畫鎬?#8221;錛氬鏋滄垜浠湪浠g爜涓氳繃緇ф壙鎴栬呰鐩栫殑鏂瑰紡浣跨敤浜嗚繖涓繃鏃剁殑綾誨瀷鎴栬呮垚鍛橈紝铏界劧緇ф壙鎴栬呰鐩栧悗鐨勭被鍨嬫垨鑰呮垚鍛樺茍涓嶆槸琚0鏄庝負 @Deprecated錛屼絾緙栬瘧鍣ㄤ粛鐒惰鎶ヨ銆?/p>

 

銆銆娉ㄦ剰錛?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">@Deprecated榪欎釜annotation綾誨瀷鍜?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">javadoc涓殑 @deprecated榪欎釜tag鏄湁鍖哄埆鐨勶細鍓嶈呮槸java緙栬瘧鍣ㄨ瘑鍒殑錛岃屽悗鑰呮槸琚?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">javadoc宸ュ叿鎵璇嗗埆鐢ㄦ潵鐢熸垚鏂囨。錛堝寘鍚▼搴忔垚鍛樹負浠涔堝凡緇忚繃鏃躲佸畠搴斿綋濡備綍琚姝㈡垨鑰呮浛浠g殑鎻忚堪錛夈?/p>

 

銆銆銆銆錛?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">3錛夈?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">SuppressWarnings

 

銆銆姝ゆ敞瑙h兘鍛婅瘔Java緙栬瘧鍣ㄥ叧闂綾匯佹柟娉曞強鎴愬憳鍙橀噺鐨勮鍛娿?/p>

 

銆銆鏈夋椂緙栬瘧鏃朵細鎻愬嚭涓浜涜鍛婏紝瀵逛簬榪欎簺璀﹀憡鏈夌殑闅愯棌鐫Bug錛屾湁鐨勬槸鏃犳硶閬垮厤鐨勶紝瀵逛簬鏌愪簺涓嶆兂鐪嬪埌鐨勮鍛婁俊鎭紝鍙互閫氳繃榪欎釜娉ㄨВ鏉ュ睆钄姐?/p>

 

銆銆SuppressWarning涓嶆槸涓涓?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">marker annotation銆傚畠鏈変竴涓被鍨嬩負String[]鐨勬垚鍛橈紝榪欎釜鎴愬憳鐨勫間負琚姝㈢殑璀﹀憡鍚嶃傚浜?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">javac緙栬瘧鍣ㄦ潵璁詫紝琚?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">-Xlint閫夐」鏈夋晥鐨勮鍛婂悕涔熷悓鏍峰@SuppressWarings鏈夋晥錛屽悓鏃剁紪璇戝櫒蹇界暐鎺夋棤娉曡瘑鍒殑璀﹀憡鍚嶃?/p>

 

銆銆annotation璇硶鍏佽鍦?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">annotation鍚嶅悗璺熸嫭鍙鳳紝鎷彿涓槸浣跨敤閫楀彿鍒嗗壊鐨?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">name=value瀵圭敤浜庝負annotation鐨勬垚鍛樿祴鍊鹼細

 

浠g爜錛?/p>

 

@SuppressWarnings(value={"unchecked","fallthrough"})

public void lintTrap() { /* sloppy method body omitted */ }

 

 

 

鍦ㄨ繖涓緥瀛愪腑SuppressWarnings annotation綾誨瀷鍙畾涔変簡涓涓崟涓鐨勬垚鍛橈紝鎵浠ュ彧鏈変竴涓畝鍗曠殑value={...}浣滀負name=value瀵廣傚張鐢變簬鎴愬憳鍊兼槸涓涓暟緇勶紝鏁呬嬌鐢ㄥぇ鎷彿鏉ュ0鏄庢暟緇勫箋?/p>

 

 

娉ㄦ剰錛氭垜浠彲浠ュ湪涓嬮潰鐨勬儏鍐典腑緙╁啓annotation錛氬綋annotation鍙湁鍗曚竴鎴愬憳錛屽茍鎴愬憳鍛藉悕涓?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">"value="銆傝繖鏃跺彲浠ョ渷鍘?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">"value="銆傛瘮濡傚皢涓婇潰鐨?span style="font-family: DejaVu Serif, serif" face="DejaVu Serif, serif">SuppressWarnings annotation榪涜緙╁啓錛?/p>

 

浠g爜錛?/p>

 

@SuppressWarnings({"unchecked","fallthrough"})

 

 

 

 

濡傛灉SuppressWarnings鎵澹版槑鐨勮紱佹璀﹀憡涓暟涓轟竴涓椂錛屽彲浠ョ渷鍘誨ぇ鎷彿錛?/p>

 

 

 

@SuppressWarnings("unchecked")

 

 

 

浜?/span>銆佽嚜瀹氫箟annontation紺轟緥

 

  紺轟緥鍏辨秹鍙婂洓涓被錛?/p>

銆銆娓呭崟1:Author.java

澶嶅埗浠g爜
package com.magc.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* 瀹氫箟浣滆呬俊鎭紝name鍜実roup
*
@author magc
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Documented
public @interface Author {

String name();
String group();
}
澶嶅埗浠g爜

銆銆娓呭崟2:Description.java

澶嶅埗浠g爜
/**
*
*/
package com.magc.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
*
@author magc
*
* 瀹氫箟鎻忚堪淇℃伅 value
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented

public @interface Description {
String value();
}
澶嶅埗浠g爜

娓呭崟3:Utility.java

澶嶅埗浠g爜
package com.magc.annotation;

@Description(value
= "榪欐槸涓涓湁鐢ㄧ殑宸ュ叿綾?/span>")
public class Utility {

@Author(name
= "haoran_202",group="com.magc")
public String work()
{
return "work over!";
}



}
澶嶅埗浠g爜

娉細榪欐槸涓櫘閫氱殑Java綾伙紝榪愯浜咢Description鍜孈Author娉ㄨВ銆?/p>

娓呭崟3:AnalysisAnnotation.java

澶嶅埗浠g爜
package com.magc.annotation;

import java.lang.reflect.Method;

public class AnalysisAnnotation {
/**
* 鍦ㄨ繍琛屾椂鍒嗘瀽澶勭悊annotation綾誨瀷鐨勪俊鎭?br /> *
*
*/
public static void main(String[] args) {
try {
//閫氳繃榪愯鏃跺弽灝凙PI鑾峰緱annotation淇℃伅
Class rt_class = Class.forName("com.magc.annotation.Utility");
Method[] methods
= rt_class.getMethods();

boolean flag = rt_class.isAnnotationPresent(Description.class);

if(flag)
{
Description description
= (Description)rt_class.getAnnotation(Description.class);
System.out.println(
"Utility's Description--->"+description.value());
for (Method method : methods) {
if(method.isAnnotationPresent(Author.class))
{
Author author
= (Author)method.getAnnotation(Author.class);
System.out.println(
"Utility's Author--->"+author.name()+" from "+author.group());

}
}
}


}
catch (ClassNotFoundException e) {
e.printStackTrace();
}
}

}
澶嶅埗浠g爜

娉細榪欐槸涓笌鑷畾涔堾Description鍜孈Author閰嶅鐨勫熀紜妗嗘灦鎴栧伐鍏風被錛岄氳繃姝ょ被鏉ヨ幏寰椾笌鏅欽ava綾籙tility.java鍏寵仈鐨勪俊鎭?鍗蟲弿榪板拰浣滆呫?/p>

榪愯AnalysisAnnotation,杈撳嚭緇撴灉涓猴細

Utility's Description--->榪欐槸涓涓湁鐢ㄧ殑宸ュ叿綾?/span>
Utility's Author--->haoran_202 from com.magc



ForMeBlog 2015-06-11 18:06 鍙戣〃璇勮
]]>ORACLE綰ц仈鏌ヨhttp://www.tkk7.com/feng0801/archive/2015/03/12/423398.htmlForMeBlogForMeBlogThu, 12 Mar 2015 04:04:00 GMThttp://www.tkk7.com/feng0801/archive/2015/03/12/423398.htmlhttp://www.tkk7.com/feng0801/comments/423398.htmlhttp://www.tkk7.com/feng0801/archive/2015/03/12/423398.html#Feedback0http://www.tkk7.com/feng0801/comments/commentRss/423398.htmlhttp://www.tkk7.com/feng0801/services/trackbacks/423398.html
鍦∣RACLE 鏁版嵁搴撲腑鏈変竴縐嶆柟娉曞彲浠ュ疄鐜扮駭鑱旀煡璇?br />select *                //瑕佹煡璇㈢殑瀛楁
from table              //鍏鋒湁瀛愭帴鐐笽D涓庣埗鎺ョ偣ID鐨勮〃 
start with selfid=id      //緇欏畾涓涓猻tartid(瀛楁鍚嶄負瀛愭帴鐐笽D錛屽強寮濮嬬殑ID鍙?
connect by prior selfid=parentid       //鑱旀帴鏉′歡涓哄瓙鎺ョ偣絳変簬鐖舵帴鐐癸紝涓嶈兘鍙?br />
榪欎釜SQL涓昏鐢ㄤ簬鑿滃崟鐨勭駭鑱旀煡璇紝緇欎竴涓埗鎺ョ偣鍙互鏌ュ嚭鎵鏈夌殑瀛愭帴鐐廣傚強瀛愭帴鐐圭殑瀛愭帴鐐癸紝涓鏌ュ埌搴曪紝寰堝疄鐢ㄣ備笉榪囧憿榪欎釜紼嬪簭鍙兘鍦╫racle閲岄潰鐢紝鎴戠洰鍓嶈繕涓嶇煡閬撳湪鍏跺畠鏁版嵁搴撻噷鏄庝箞璋冪敤鐨勩傜瓑鎴戞壘鍒頒簡錛屽啀璐村嚭鏉ヤ笌澶у鍒嗕韓銆?/font>
榪欎釜紼嬪簭錛屼及璁″ソ澶氫漢鐪嬩笉鏄庣櫧錛屽叾瀹炴斁浜嗚繖涔堜箙鎴戜篃涓鏃舵病鐪嬫槑鐧斤紝閲嶆柊嫻嬩簡涓涓嬶紝琛ュ厖璇存槑涓涓嬶紝涓嶇劧鎴戜笅嬈″張鐪嬩笉鎳備簡銆?/font>
浠ヤ竴涓獁indows緋葷粺鐨勮彍鍗曚負渚嬨傛垜閭d竴涓繖鏍風殑琛╩enu銆?/font>
璇存槑錛?/font>
mid:鑿滃崟鐨処D鍙?/font>
mname錛氳彍鍗曞悕縐?/font>
mpid錛氳彍鍗曠殑
quickey錛氬揩鎹烽敭
validate:鏉冮檺琛紙瀛樻斁userid,鎴栬呰鑹瞚d錛?/font>
mid mname mpid quickey validate                                                                  
1 鏂囦歡   ctrl+f 1錛?錛?錛?錛?1錛?3錛?5
2 緙栬緫   ctrl+e  
3 鏂板緩 1 alt+w  
4 鏂囦歡澶?/td> 3  

 

濡傛灉鎴戞兂鐭ラ亾鍦?#8220;鏂囦歡”鑿滃崟涓嬫湁閭d簺瀛愯彍鍗曠殑璇濄傛垜灝卞彲浠ヨ繖鏍風敤榪欎釜SQL紼嬪簭錛?/div>
select * from menu
start with mid=1     
connect by prior mid=mpid;
榪欐牱灝卞彲浠ユ妸 “鏂囦歡”閲岀殑瀛愯彍鍗曞叏閮ㄥ垪鍑烘潵浜嗐傚綋鐒跺疄闄呭簲鐢ㄤ笉浼氳繖涔堢畝鍗曪紝濡傞檮鍔犲叾瀹炴潯浠訛紝灝ゅ叾鏄潈闄愮鐞嗭紝榪欐椂鏍規嵁浣犵殑緋葷粺瑕佹眰錛屾槸瀵逛釜涓獙璇侊紝榪樻槸瀵硅鑹查獙璇侊紝鎶婅繖浜涗漢鐨処D鏀懼湪validate榪欎釜瀛楁閲岋紝緇勬垚涓涓瓧絎︿覆錛孨涓狪D鐢ㄩ楀彿闅斿紑錛岋紙娉ㄦ剰錛屽湪寰鏁版嵁搴撲繚瀛樻椂瑕佹敞鎰忓瀛楃涓插鐞嗕竴涓嬶紝鎴彇鎺夋渶鍚庝竴涓楀彿榪欐牱鍙互鑺傜渷寰堝楹葷儲錛?/div>
select * from menu
where validate in(……)
and mid in(
   select mid from menu  //榪欓噷涓嶈兘鐢?鍙蜂簡銆?/div>
   start with mid=1     
   connect by prior mid=mpid;
)
鏈鍚庡啀琛ュ厖涓鐐瑰叧浜庨殢鏈烘煡璇㈢殑浠g爜
select * from user order by sys_guid()


ForMeBlog 2015-03-12 12:04 鍙戣〃璇勮
]]>濡備綍浠ava瀹炵幇緗戦〉鎴浘鎶鏈?/title><link>http://www.tkk7.com/feng0801/archive/2015/01/21/422317.html</link><dc:creator>ForMeBlog</dc:creator><author>ForMeBlog</author><pubDate>Wed, 21 Jan 2015 04:00:00 GMT</pubDate><guid>http://www.tkk7.com/feng0801/archive/2015/01/21/422317.html</guid><wfw:comment>http://www.tkk7.com/feng0801/comments/422317.html</wfw:comment><comments>http://www.tkk7.com/feng0801/archive/2015/01/21/422317.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/feng0801/comments/commentRss/422317.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/feng0801/services/trackbacks/422317.html</trackback:ping><description><![CDATA[<p>浠婂ぉ鐪嬪埌鏌愮綉鍙嬪叧浜?#8220;濡備綍浠ava瀹炵幇緗戦〉鎴浘鎶鏈?#8221;鐨勫挩璇㈠笘錛岀敱浜庡嚭鐜拌鍜ㄨ鐨勫湴鐐歸潪甯鎬笉閫傚悎杈冮暱鍥炲錛屾晠浠ュ崥鏂囧艦寮忓洖絳斻?/p> <p> </p> <p>浜嬪疄涓婏紝濡傛灉鎮ㄦ兂浠ava瀹炵幇緗戦〉鎴浘錛屼篃灝辨槸“杈撳叆涓孌電綉鍧錛屽嚑縐掗挓榪囧悗灝辮兘鎴彇涓寮犵綉欏電緝鐣ュ浘”鐨勬晥鏋溿傞偅涔堬紝鎮ㄨ嚦灝戞湁3縐嶆柟寮忓彲浠ラ夋嫨銆?/p> <p> </p> <p><span style="color: #ff6600">1銆佹渶鐩存帴鐨勬柟寮?#8212;—浣跨敤Robot</span> </p> <p> </p> <p><strong>鏂規硶璇﹁В錛氳鏂規硶鍒╃敤Robat鎻愪緵鐨勫己澶ф闈㈡搷浣滆兘鍔涳紝紜ц皟鐢ㄦ祻瑙堝櫒鎵撳紑鎸囧畾緗戦〉錛屽茍灝嗙綉欏典俊鎭繚瀛樺埌鏈湴銆?/strong> </p> <p> </p> <p>浼樺娍錛氱畝鍗曟槗鐢紝涓嶉渶瑕佷換浣曠涓夋柟鎻掍歡銆?/p> <p> </p> <p>緙虹偣錛氫笉鑳藉悓鏃跺鐞嗗ぇ閲忔暟鎹紝鎶鏈惈閲忚繃浣庯紝灞炰簬搴旀ュ瀷鎶宸с?/p> <p> </p> <p>瀹炵幇鏂規硶錛氫嬌鐢ㄥ涓嬩唬鐮佸嵆鍙?/p><br /> <p> </p> <p> </p> <div id="fhlvfll" class="dp-highlighter bg_java"> <div id="fnhj9pz" class="bar"> <div id="9pbn97v" class="tools"><strong>[java]</strong> <a class="ViewSource" title="view plain" href="#">view plain</a><a class="CopyToClipboard" title="copy" href="http://www.tkk7.com/feng0801/admin/EditPosts.aspx?opt=1#">copy</a><a class="PrintSource" title="print" href="#">print</a><a class="About" title="?" href="http://www.tkk7.com/feng0801/admin/EditPosts.aspx?opt=1#">?</a></div></div> <ol class="dp-j"><li id="hz7bff9" class="alt"><span id="7rlnt7v" class="keyword">public</span><span> </span><span id="7nj9lr9" class="keyword">static</span><span> </span><span id="7v9fh7x" class="keyword">void</span><span> main(String[] args) </span><span id="pjlfhhj" class="keyword">throws</span><span> MalformedURLException,  </span></li><li><span>        IOException, URISyntaxException, AWTException {  </span></li><li id="nnjbfdn" class="alt"><span>    </span><span id="zj99jj9" class="comment">//姝ゆ柟娉曚粎閫傜敤浜嶫dK1.6鍙婁互涓婄増鏈?</span><span>  </span></span></li><li><span>    Desktop.getDesktop().browse(  </span></li><li id="xp7zb9d" class="alt"><span>            </span><span id="fdr7b9v" class="keyword">new</span><span> URL(</span><span id="phjdx79" class="string">"http://google.com/intl/en/"</span><span>).toURI());  </span></span></li><li><span>    Robot robot = </span><span id="1tdf9d9" class="keyword">new</span><span> Robot();  </span></span></li><li id="19tnf99" class="alt"><span>    robot.delay(</span><span id="jt77vlv" class="number">10000</span><span>);  </span></span></li><li><span>    Dimension d = </span><span id="1ddxzzx" class="keyword">new</span><span> Dimension(Toolkit.getDefaultToolkit().getScreenSize());  </span></span></li><li id="7ld9h9r" class="alt"><span>    </span><span id="7phl999" class="keyword">int</span><span> width = (</span><span id="1t9nfdb" class="keyword">int</span><span>) d.getWidth();  </span></span></li><li><span>    </span><span id="z7pj9fr" class="keyword">int</span><span> height = (</span><span id="v799bz9" class="keyword">int</span><span>) d.getHeight();  </span></span></li><li id="x797xdj" class="alt"><span>    </span><span id="fh977lj" class="comment">//鏈澶у寲嫻忚鍣?</span><span>  </span></span></li><li><span>    robot.keyRelease(KeyEvent.VK_F11);  </span></li><li id="hrl7f9n" class="alt"><span>    robot.delay(</span><span id="zbtnpff" class="number">2000</span><span>);  </span></span></li><li><span>    Image image = robot.createScreenCapture(</span><span id="fz7bd9d" class="keyword">new</span><span> Rectangle(</span><span id="prvnz9j" class="number">0</span><span>, </span><span id="vh9x7n7" class="number">0</span><span>, width,  </span></span></li><li id="rr9tx9x" class="alt"><span>            height));  </span></li><li><span>    BufferedImage bi = </span><span id="t7tdxxn" class="keyword">new</span><span> BufferedImage(width, height,  </span></span></li><li id="7h7z9pd" class="alt"><span>            BufferedImage.TYPE_INT_RGB);  </span></li><li><span>    Graphics g = bi.createGraphics();  </span></li><li id="l997hnv" class="alt"><span>    g.drawImage(image, </span><span id="7dp99xd" class="number">0</span><span>, </span><span id="7nj9xnj" class="number">0</span><span>, width, height, </span><span id="rd7nr9h" class="keyword">null</span><span>);  </span></span></li><li><span>    </span><span id="7rlxpn9" class="comment">//淇濆瓨鍥劇墖 </span><span>  </span></span></li><li id="1ldhzxv" class="alt"><span>    ImageIO.write(bi, </span><span id="9ztv9th" class="string">"jpg"</span><span>, </span><span id="tdx7b9b" class="keyword">new</span><span> File(</span><span id="vpzdfd7" class="string">"google.jpg"</span><span>));  </span></span></li><li><span>}  </span></li></ol></div><textarea style="display: none" class="java" rows="15" cols="50" name="code"> public static void main(String[] args) throws MalformedURLException, IOException, URISyntaxException, AWTException { //姝ゆ柟娉曚粎閫傜敤浜嶫dK1.6鍙婁互涓婄増鏈? Desktop.getDesktop().browse( new URL("http://google.com/intl/en/").toURI()); Robot robot = new Robot(); robot.delay(10000); Dimension d = new Dimension(Toolkit.getDefaultToolkit().getScreenSize()); int width = (int) d.getWidth(); int height = (int) d.getHeight(); //鏈澶у寲嫻忚鍣? robot.keyRelease(KeyEvent.VK_F11); robot.delay(2000); Image image = robot.createScreenCapture(new Rectangle(0, 0, width, height)); BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics g = bi.createGraphics(); g.drawImage(image, 0, 0, width, height, null); //淇濆瓨鍥劇墖 ImageIO.write(bi, "jpg", new File("google.jpg")); } </textarea> <p> </p> <p> </p> <p><span style="color: #ff6600">2銆佹渶甯歌鐨勬柟寮?#8212;—鍒╃敤JNI錛岃皟鐢ㄧ涓夋柟C/C++緇勪歡</span> <br /></p> <p><strong>鏂規硶璇﹁В錛氱洰鍓嶆潵璁詫紝Java棰嗗煙瀵逛簬緗戦〉鎴浘緇勪歡鐨勫紑鍙戞槑鏄句笉瓚籌紙鍟嗘満錛燂級錛屽綋鎮ㄩ渶瑕佸畬鎴愭縐嶆搷浣滄椂錛岀畻寰椾笂紕板埌浜咼ava鐨勮蔣鑲嬨備絾鏄紝浼楁墍鍛ㄧ煡Java涔熸嫢鏈夊己澶х殑JNI鑳藉姏錛屽彲浠ヨ交鏄撳皢C/C++寮鍙戠殑鍚岀被緇勪歡寮曚負宸辯敤銆?/strong> </p> <p>浼樺娍錛氬疄鐜扮畝鍗曪紝鍙渶瑕佸皝瑁呭搴旂殑DLL鏂囦歡錛屽氨鍙互璁㎎ava瀹炵幇鍚岀被鍔熻兘銆?/p> <p> </p> <p>鍔e娍錛氬悓鍏朵粬JNI瀹炵幇涓鏍鳳紝鍦ㄨ法騫沖彴鏃跺瓨鍦ㄩ殣鎮o紝鑰屼笖鎮ㄧ殑紼嬪簭灝嗕笉鍐嶅睘浜庣函Java搴旂敤銆?/p> <p> </p> <p>瀹炵幇鏂規硶錛氬彲鍙傝姝ょ敤渚嬶紝鍏蜂綋灝佽浣曠C/C++緇勪歡璇瘋嚜琛岄夋嫨銆?/p> <p> </p> <p>PS錛氱ず渚嬫潵婧愪簬ACA HTML to Image Converter欏圭洰錛?a >http://www.acasystems.com/en/web-thumb-activex/faq-convert-html-to-image-in-java.htm</a> 錛夛紝榪欐槸涓涓敹璐圭殑HTML杞琁mage絎笁鏂圭粍浠訛紝浣嗗皝瑁呮柟寮忓湪Java涓ぇ鍚屽皬寮傘?/p> <p> </p> <p>寮曠敤JNI灝佽錛?/p> <p> </p> <p> </p> <p> </p> <div id="ddh79ff" class="dp-highlighter bg_java"> <div id="7x7997p" class="bar"> <div id="v9v9br9" class="tools"><strong>[java]</strong> <a class="ViewSource" title="view plain" ><u><font color="#0000ff">view plain</font></u></a><a class="CopyToClipboard" title="copy" ><u><font color="#0000ff">copy</font></u></a><a class="PrintSource" title="print" ><u><font color="#0000ff">print</font></u></a><a class="About" title="?" ><u><font color="#0000ff">?</font></u></a></div></div> <ol class="dp-j"><li id="blfb7pf" class="alt"><span id="ph9vpln" class="keyword">import</span><span> sun.awt.*;  </span></li><li><span></span><span id="7x9x9f9" class="keyword">import</span><span> java.awt.*;  </span></span></li><li id="z7ptll9" class="alt"><span></span><span id="1999d99" class="keyword">import</span><span> javax.swing.*;  </span></span></li><li><span></span><span id="1tfpb99" class="keyword">import</span><span> java.awt.event.*;  </span></span></li><li id="vh7zzzj" class="alt"><span></span><span id="vp79nll" class="keyword">import</span><span> java.awt.*;  </span></span></li><li><span></span><span id="1p9z9f7" class="keyword">import</span><span> java.awt.peer.*;  </span></span></li><li id="v979hf9" class="alt"><span></span><span id="j7rln7v" class="keyword">public</span><span> </span><span id="vf7zb9r" class="keyword">class</span><span> Snap  </span></span></li><li><span>{  </span></li><li id="ltjlxnl" class="alt"><span>  </span><span id="n77v99h" class="keyword">static</span><span>  </span></span></li><li><span>  {  </span></li><li id="1hjn9bz" class="alt"><span>    System.loadLibrary(</span><span id="rb79rr9" class="string">"Snap"</span><span>);  </span></span></li><li><span>  }  </span></li><li id="j99tntd" class="alt"><span>  </span><span id="dfbdpfb" class="keyword">public</span><span> </span><span id="1lnf9dr" class="keyword">static</span><span> </span><span id="1rln9tp" class="keyword">void</span><span> main( String[] argv )  </span></span></li><li><span>  {  </span></li><li id="l7jj9zf" class="alt"><span>    Snap t_xSnap = </span><span id="nzz999l" class="keyword">new</span><span> Snap();  </span></span></li><li><span>    t_xSnap.Start(</span><span id="7bvvhnl" class="string">"http://www.google.com"</span><span>, </span><span id="z9zrttr" class="string">"snapshot-google.png"</span><span>);  </span></span></li><li id="pz7vnb9" class="alt"><span>  }  </span></li><li><span>  </span><span id="rbdnzx7" class="keyword">public</span><span> </span><span id="79jdfbz" class="keyword">native</span><span> </span><span id="zr7j9xx" class="keyword">void</span><span> Start(String pi_strURL, String pi_strImageName);  </span></span></li><li id="7f7pjpn" class="alt"><span>}  </span></li></ol></div> <p><textarea style="display: none" class="java" rows="15" cols="50" name="code">import sun.awt.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.awt.peer.*; public class Snap { static { System.loadLibrary("Snap"); } public static void main( String[] argv ) { Snap t_xSnap = new Snap(); t_xSnap.Start("http://www.google.com", "snapshot-google.png"); } public native void Start(String pi_strURL, String pi_strImageName); } </textarea> </p> <p> </p> <p> </p> <p>CPP閮ㄥ垎鐨勫疄鐜幫細</p> <p> </p> <p> </p> <p> </p> <div id="v7ln9l7" class="dp-highlighter bg_java"> <div id="htvpbzx" class="bar"> <div id="rtvpz7d" class="tools"><strong>[java]</strong> <a class="ViewSource" title="view plain" ><u><font color="#0000ff">view plain</font></u></a><a class="CopyToClipboard" title="copy" ><u><font color="#0000ff">copy</font></u></a><a class="PrintSource" title="print" ><u><font color="#0000ff">print</font></u></a><a class="About" title="?" ><u><font color="#0000ff">?</font></u></a></div></div> <ol class="dp-j"><li id="xrt99r9" class="alt"><span>#include <windows.h>  </span></li><li><span>#include <atlbase.h>  </span></li><li id="tlx9lj9" class="alt"><span>#include </span><span id="brl7zvt" class="string">"snap.h"</span><span>  </span></span></li><li><span>#pragma comment(lib,</span><span id="l9p9r9t" class="string">"atl.lib"</span><span>)  </span></span></li><li id="1r9dhfd" class="alt"><span>#</span><span id="t79btrz" class="keyword">import</span><span> </span><span id="dn9ptz9" class="string">"./../../acawebthumb.dll"</span><span> no_namespace  </span></span></li><li><span>JNIEXPORT </span><span id="nfzjttd" class="keyword">void</span><span> JNICALL Java_Snap_Start(JNIEnv *pEnv, jobject, jstring pi_strUrl, jstring pi_strFileName)  </span></span></li><li id="prd9fnd" class="alt"><span>{  </span></li><li><span>  CoInitialize(</span><span id="b7b97z7" class="number">0</span><span>);  </span></span></li><li id="9jv9pn9" class="alt"><span>  _bstr_t t_strUrl = pEnv->GetStringUTFChars(pi_strUrl, </span><span id="t9t9l97" class="number">0</span><span>);  </span></span></li><li><span>  _bstr_t t_strFileName = pEnv->GetStringUTFChars(pi_strFileName, </span><span id="7b9v9l9" class="number">0</span><span>);      </span></span></li><li id="tdplv9j" class="alt"><span>  IThumbMakerPtr HTML_Converter = NULL;  </span></li><li><span>  HRESULT hr = HTML_Converter.CreateInstance(L</span><span id="79p9px9" class="string">"ACAWebThumb.ThumbMaker"</span><span>);      </span></span></li><li id="9l9frp1" class="alt"><span>  </span><span id="hzt7l9n" class="keyword">if</span><span> (SUCCEEDED(hr))  </span></span></li><li><span>  {   </span></li><li id="vfj9pff" class="alt"><span>    HTML_Converter->SetURL(t_strUrl);  </span></li><li><span>    </span><span id="7h9vf99" class="keyword">if</span><span> ( </span><span id="7rntdt9" class="number">0</span><span> == HTML_Converter->StartSnap() )  </span></span></li><li id="t9b7hfj" class="alt"><span>      HTML_Converter->SaveImage(t_strFileName);  </span></li><li><span>  }  </span></li><li id="zbt9fdd" class="alt"><span>  </span><span id="3t1f1d5" class="keyword">if</span><span> (HTML_Converter)  </span></span></li><li><span>    HTML_Converter.Release();  </span></li><li id="5b151x1" class="alt"><span>  CoUninitialize();           </span></li><li><span>}  </span></li></ol></div> <p><textarea style="display: none" class="java" rows="15" cols="50" name="code">#include <windows.h> #include <atlbase.h> #include "snap.h" #pragma comment(lib,"atl.lib") #import "./../../acawebthumb.dll" no_namespace JNIEXPORT void JNICALL Java_Snap_Start(JNIEnv *pEnv, jobject, jstring pi_strUrl, jstring pi_strFileName) { CoInitialize(0); _bstr_t t_strUrl = pEnv->GetStringUTFChars(pi_strUrl, 0); _bstr_t t_strFileName = pEnv->GetStringUTFChars(pi_strFileName, 0); IThumbMakerPtr HTML_Converter = NULL; HRESULT hr = HTML_Converter.CreateInstance(L"ACAWebThumb.ThumbMaker"); if (SUCCEEDED(hr)) { HTML_Converter->SetURL(t_strUrl); if ( 0 == HTML_Converter->StartSnap() ) HTML_Converter->SaveImage(t_strFileName); } if (HTML_Converter) HTML_Converter.Release(); CoUninitialize(); } </textarea> </p> <p> </p> <p> </p> <p>浠ヨ緇勪歡鍥懼儚鍖杫ahoo鐣岄潰鐨勬晥鏋滃浘錛?/p> <p> </p> <p><img alt="00" src="http://image.acasystems.com/html-to-image-converter/ex-www.yahoo.com-200.jpg" width="200" height="216" /> </p> <p><span style="color: #ff6600"><br /></span></p> <p><span style="color: #ff6600">3銆佹渶鎵庡疄鐨勬柟娉?#8212;—鑷瑙f瀽HTML鏍囪錛屽茍灝嗗叾鍥懼儚鍖?/span> </p> <p> </p> <p><strong>鏂規硶璇﹁В錛氫紬鎵鍛ㄧ煡錛孒TML涔嬫墍浠ュ湪嫻忚鍣ㄤ腑浠ュ叿浣撶殑緗戦〉鏍煎紡鍑虹幇錛屽茍闈炴湇鍔″櫒绔紶浜嗕竴鏁翠釜搴旂敤鍒板鎴風錛岃屾槸婧愯嚜浜庢祻瑙堝櫒瀵逛簬瀹㈡埛绔嚜琛岃В鏋愮殑緇撴灉銆傚洜姝わ紝鍙鎴戜滑灝嗗搴旂殑瑙f瀽涓涓瀹炵幇錛岄偅涔堝皢緗戦〉鍥懼艦鍖栵紝灝卞皢涓嶆槸浠涔堥毦浜嬨?/strong> </p> <p><strong><br /></strong></p> <p>浼樺娍錛氱函Java瀹炵幇錛屼竴鍔蟲案閫革紝涓鏃﹀紑鍙戝畬鎴愬垯姘歌繙閫氱敤錛岃屼笖鏈変竴瀹氱殑鍟嗙敤浠峰箋?/p> <p> </p> <p>鍔e娍錛氬紑鍙戣垂鏃訛紝涓旈渶瑕侀拡瀵逛笉鍚岃娉曞仛綺劇‘鍒嗘瀽錛屾墠鑳戒繚璇佽緭鍑虹殑鍩烘湰姝g‘銆傚挨鍏跺湪娑夊強鍒癑avaScript瑙f瀽鏃訛紝闅懼害灝嗗挨鍏跺澶с?/p> <p> </p> <p>瀹炵幇鏂規硶錛氱洰鍓嶅皻鏃犲叿浣撴渚嬪彲渚涘弬鑰冦備絾鏄紝鐢變簬Java鏈塲dic涔嬬被鐨勬祻瑙堝櫒欏圭洰瀛樺湪錛?a >https://jdic.dev.java.net/</a> 錛夛紝鑰孞ava鍥懼艦鐣岄潰鍙堝睘緇樺埗鐢熸垚銆備粠鐞嗚涓婅錛屾垜浠彲浠ュ皢鎵鏈夊叿澶嘒raphics鐨勭粍浠跺浘褰㈠寲淇濆瓨銆?/p> <p> </p> <p>鑰屽鏋滆嚜琛岃В鏋愶紝閭d箞鎮ㄩ渶瑕佸緩绔婬TML瑙f瀽鍣紙鎴栦嬌鐢ㄧ涓夋柟鐨勶紝涓囧垢Java鍦ㄨ繖鏂歸潰鐨勭粍浠跺緢澶氾級錛屼簡瑙ava2D鏈哄埗錛屼簡瑙d綍鏃惰浣跨敤drawString緇樺埗鏂囧瓧錛屼綍鏃跺張璇ヤ嬌鐢╠rawImage鎻掑叆鍥劇墖絳夌瓑銆?/p> <p> </p> <p><span style="color: #000000"><br /></span></p> <p><strong><span style="color: #000000">琛ュ厖錛?/span> </strong></p> <p> </p> <p>榪欐槸涓涓埄鐢ㄥ唴緗祻瑙堝櫒鎴浘鐨勭ず渚嬶紝浣跨敤浜咲JNativeSwing緇勪歡銆?/p> <p> </p> <p>紺轟緥宸ョ▼涓嬭澆鍦板潃錛圗clipse宸ョ▼錛屽惈lib錛夛細<a >http://greenvm.googlecode.com/files/Screenshot.7z</a></p> <p> </p> <p> </p> <p> </p> <p> </p> <div id="jj5l515" class="dp-highlighter bg_java"> <div id="lvftnt1" class="bar"> <div id="3d5f51n" class="tools"><strong>[java]</strong> <a class="ViewSource" title="view plain" ><u><font color="#0000ff">view plain</font></u></a><a class="CopyToClipboard" title="copy" ><u><font color="#0000ff">copy</font></u></a><a class="PrintSource" title="print" ><u><font color="#0000ff">print</font></u></a><a class="About" title="?" ><u><font color="#0000ff">?</font></u></a></div></div> <ol class="dp-j"><li id="bln35zt" class="alt"><span id="3f5vzf5" class="keyword">import</span><span> java.awt.BorderLayout;  </span></li><li><span></span><span id="vn55l51" class="keyword">import</span><span> java.awt.Dimension;  </span></span></li><li id="nf315bd" class="alt"><span></span><span id="n5lj5z1" class="keyword">import</span><span> java.awt.FlowLayout;  </span></span></li><li><span></span><span id="5znlnvn" class="keyword">import</span><span> java.awt.image.BufferedImage;  </span></span></li><li id="hzb3j3v" class="alt"><span></span><span id="ttx5xtv" class="keyword">import</span><span> java.io.File;  </span></span></li><li><span></span><span id="5lzx1vv" class="keyword">import</span><span> java.io.IOException;  </span></span></li><li id="pp5z55j" class="alt"><span></span><span id="351zzx5" class="keyword">import</span><span> javax.imageio.ImageIO;  </span></span></li><li><span></span><span id="3z55551" class="keyword">import</span><span> javax.swing.JFrame;  </span></span></li><li id="jdvldt5" class="alt"><span></span><span id="bdftdbv" class="keyword">import</span><span> javax.swing.JPanel;  </span></span></li><li><span></span><span id="zjv51z5" class="keyword">import</span><span> javax.swing.SwingUtilities;  </span></span></li><li id="3zvjnt3" class="alt"><span></span><span id="n3thl1v" class="keyword">import</span><span> chrriis.dj.nativeswing.swtimpl.NativeComponent;  </span></span></li><li><span></span><span id="3xl5nld" class="keyword">import</span><span> chrriis.dj.nativeswing.swtimpl.NativeInterface;  </span></span></li><li id="jb3nznf" class="alt"><span></span><span id="vvpn5jd" class="keyword">import</span><span> chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;  </span></span></li><li><span></span><span id="pjlvt5t" class="keyword">import</span><span> chrriis.dj.nativeswing.swtimpl.components.WebBrowserAdapter;  </span></span></li><li id="3bxzj55" class="alt"><span></span><span id="355bftj" class="keyword">import</span><span> chrriis.dj.nativeswing.swtimpl.components.WebBrowserEvent;  </span></span></li><li><span></span><span id="vfzt3z5" class="keyword">public</span><span> </span><span id="jtdxj55" class="keyword">class</span><span> Main </span><span id="5fjdfl5" class="keyword">extends</span><span> JPanel {  </span></span></li><li id="35rb51t" class="alt"><span>    </span><span id="3dfrb55" class="comment">/**</span> </span></li><li><span id="dlnzj5d" class="comment">     * </span> </li><li id="nfhl355" class="alt"><span id="35v15dn" class="comment">     */</span><span>  </span></li><li><span>    </span><span id="vnxzbj3" class="keyword">private</span><span> </span><span id="d5r5trt" class="keyword">static</span><span> </span><span id="1df5rpv" class="keyword">final</span><span> </span><span id="dv3555d" class="keyword">long</span><span> serialVersionUID = 1L;  </span></span></li><li id="3t55d5x" class="alt"><span>    </span><span id="xhtdfvl" class="comment">// 琛屽垎闅旂 </span><span>  </span></span></li><li><span>    </span><span id="d5thth5" class="keyword">final</span><span> </span><span id="btnpr3l" class="keyword">static</span><span> </span><span id="z5z5515" class="keyword">public</span><span> String LS = System.getProperty(</span><span id="f3x5vdj" class="string">"line.separator"</span><span>, </span><span id="nphtv3n" class="string">"/n"</span><span>);  </span></span></li><li id="1tv5f5n" class="alt"><span>    </span><span id="5tlp555" class="comment">// 鏂囦歡鍒嗗壊絎?</span><span>  </span></span></li><li><span>    </span><span id="t5xbvbr" class="keyword">final</span><span> </span><span id="3nxjv1l" class="keyword">static</span><span> </span><span id="hrtf3pz" class="keyword">public</span><span> String FS = System.getProperty(</span><span id="fxr3t55" class="string">"file.separator"</span><span>, </span><span id="1dvh1tb" class="string">"http://"</span><span>);  </span></span></li><li id="3vhbl5n" class="alt"><span>    </span><span id="3d51p5x" class="comment">//浠avascript鑴氭湰鑾峰緱緗戦〉鍏ㄥ睆鍚庡ぇ灝?</span><span>  </span></span></li><li><span>    </span><span id="n5drtrh" class="keyword">final</span><span> </span><span id="dl3f515" class="keyword">static</span><span> StringBuffer jsDimension;  </span></span></li><li id="3zjd5z5" class="alt"><span>      </span></li><li><span>    </span><span id="j3p55t1" class="keyword">static</span><span> {  </span></span></li><li id="jvn5x5f" class="alt"><span>        jsDimension = </span><span id="vfpllj5" class="keyword">new</span><span> StringBuffer();  </span></span></li><li><span>        jsDimension.append(</span><span id="rb5n55n" class="string">"var width = 0;"</span><span>).append(LS);  </span></span></li><li id="vf3h5nh" class="alt"><span>        jsDimension.append(</span><span id="jt55fpn" class="string">"var height = 0;"</span><span>).append(LS);  </span></span></li><li><span>        jsDimension.append(</span><span id="rr35thh" class="string">"if(document.documentElement) {"</span><span>).append(LS);  </span></span></li><li id="tl53t55" class="alt"><span>        jsDimension.append(  </span></li><li><span>                        </span><span id="3lhtv5n" class="string">"  width = Math.max(width, document.documentElement.scrollWidth);"</span><span>)  </span></span></li><li id="bbjb355" class="alt"><span>                .append(LS);  </span></li><li><span>        jsDimension.append(  </span></li><li id="x515tt1" class="alt"><span>                        </span><span id="dp5hthx" class="string">"  height = Math.max(height, document.documentElement.scrollHeight);"</span><span>)  </span></span></li><li><span>                .append(LS);  </span></li><li id="5rbvx5h" class="alt"><span>        jsDimension.append(</span><span id="l55b5z5" class="string">"}"</span><span>).append(LS);  </span></span></li><li><span>        jsDimension.append(</span><span id="tdjdftr" class="string">"if(self.innerWidth) {"</span><span>).append(LS);  </span></span></li><li id="35v35jl" class="alt"><span>        jsDimension.append(</span><span id="jlpjljp" class="string">"  width = Math.max(width, self.innerWidth);"</span><span>)  </span></span></li><li><span>                .append(LS);  </span></li><li id="rtvzr31" class="alt"><span>        jsDimension.append(</span><span id="ppztfll" class="string">"  height = Math.max(height, self.innerHeight);"</span><span>)  </span></span></li><li><span>                .append(LS);  </span></li><li id="1r1tv55" class="alt"><span>        jsDimension.append(</span><span id="3z5r5fd" class="string">"}"</span><span>).append(LS);  </span></span></li><li><span>        jsDimension.append(</span><span id="j5jprx5" class="string">"if(document.body.scrollWidth) {"</span><span>).append(LS);  </span></span></li><li id="3fp1x55" class="alt"><span>        jsDimension.append(  </span></li><li><span>                </span><span id="31tpj1b" class="string">"  width = Math.max(width, document.body.scrollWidth);"</span><span>)  </span></span></li><li id="zr3bvdl" class="alt"><span>                .append(LS);  </span></li><li><span>        jsDimension.append(  </span></li><li id="151z1vd" class="alt"><span>                </span><span id="ldxj5f5" class="string">"  height = Math.max(height, document.body.scrollHeight);"</span><span>)  </span></span></li><li><span>                .append(LS);  </span></li><li id="vx3pb5b" class="alt"><span>        jsDimension.append(</span><span id="3hrlnv5" class="string">"}"</span><span>).append(LS);  </span></span></li><li><span>        jsDimension.append(</span><span id="3lf5pvp" class="string">"return width + ':' + height;"</span><span>);  </span></span></li><li id="1555x5h" class="alt"><span>    }  </span></li><li><span>  </span><span id="ddnpbh3" class="comment">//DJNativeSwing緇勪歡璇蜂簬http://djproject.sourceforge.net/main/index.html涓嬭澆 </span><span>  </span></span></li><li id="5t5f5th" class="alt"><span>    </span><span id="nhjtf55" class="keyword">public</span><span> Main(</span><span id="55d5pxp" class="keyword">final</span><span> String url, </span><span id="hzln5tr" class="keyword">final</span><span> </span><span id="bt3vh5p" class="keyword">int</span><span> maxWidth, </span><span id="d5dz5xd" class="keyword">final</span><span> </span><span id="vnrtnv3" class="keyword">int</span><span> maxHeight) {  </span></span></li><li><span>        </span><span id="rtlnhp5" class="keyword">super</span><span>(</span><span id="xpbdfvn" class="keyword">new</span><span> BorderLayout());  </span></span></li><li id="j5h3jpr" class="alt"><span>        JPanel webBrowserPanel = </span><span id="b3zfhfn" class="keyword">new</span><span> JPanel(</span><span id="jdfhj3t" class="keyword">new</span><span> BorderLayout());  </span></span></li><li><span>        </span><span id="5x5hrzf" class="keyword">final</span><span> String fileName = System.currentTimeMillis() + </span><span id="nxh5bj1" class="string">".jpg"</span><span>;  </span></span></li><li id="tnpjbzp" class="alt"><span>        </span><span id="1jdn1jz" class="keyword">final</span><span> JWebBrowser webBrowser = </span><span id="lvf5bh5" class="keyword">new</span><span> JWebBrowser(</span><span id="1pz5l5b" class="keyword">null</span><span>);  </span></span></li><li><span>        webBrowser.setBarsVisible(</span><span id="l3htdtt" class="keyword">false</span><span>);  </span></span></li><li id="pjtn3d5" class="alt"><span>        webBrowser.navigate(url);  </span></li><li><span>        webBrowserPanel.add(webBrowser, BorderLayout.CENTER);  </span></li><li id="fnptvlt" class="alt"><span>        add(webBrowserPanel, BorderLayout.CENTER);  </span></li><li><span>        JPanel panel = </span><span id="pzjn5jp" class="keyword">new</span><span> JPanel(</span><span id="ddxz5xl" class="keyword">new</span><span> FlowLayout(FlowLayout.CENTER, </span><span id="5t5d1rr" class="number">4</span><span>, </span><span id="3rd5n5x" class="number">4</span><span>));  </span></span></li><li id="btnhbzx" class="alt"><span>        webBrowser.addWebBrowserListener(</span><span id="b3b5tbp" class="keyword">new</span><span> WebBrowserAdapter() {  </span></span></li><li><span>            </span><span id="1hbnxv1" class="comment">// 鐩戝惉鍔犺澆榪涘害 </span><span>  </span></span></li><li id="nfhjnjz" class="alt"><span>            </span><span id="tb3fh5r" class="keyword">public</span><span> </span><span id="tb55lrx" class="keyword">void</span><span> loadingProgressChanged(WebBrowserEvent e) {  </span></span></li><li><span>                </span><span id="v35t1rz" class="comment">// 褰撳姞杞藉畬姣曟椂 </span><span>  </span></span></li><li id="rrtnh35" class="alt"><span>                </span><span id="prj5d5n" class="keyword">if</span><span> (e.getWebBrowser().getLoadingProgress() == </span><span id="vv1xzpv" class="number">100</span><span>) {  </span></span></li><li><span>                    String result = (String) webBrowser  </span></li><li id="ldf355r" class="alt"><span>                            .executeJavascriptWithResult(jsDimension.toString());  </span></li><li><span>                    </span><span id="vnp35xl" class="keyword">int</span><span> index = result == </span><span id="355x51x" class="keyword">null</span><span> ? -</span><span id="b5zjt55" class="number">1</span><span> : result.indexOf(</span><span id="5vfpr35" class="string">":"</span><span>);  </span></span></li><li id="55xtnjr" class="alt"><span>                    NativeComponent nativeComponent = webBrowser  </span></li><li><span>                            .getNativeComponent();  </span></li><li id="zjlp3d1" class="alt"><span>                    Dimension originalSize = nativeComponent.getSize();  </span></li><li><span>                    Dimension imageSize = </span><span id="btfrtj3" class="keyword">new</span><span> Dimension(Integer.parseInt(result  </span></span></li><li id="lv35pfx" class="alt"><span>                            .substring(</span><span id="ppjd55f" class="number">0</span><span>, index)), Integer.parseInt(result  </span></span></li><li><span>                            .substring(index + </span><span id="hhj555l" class="number">1</span><span>)));  </span></span></li><li id="3hjfxnd" class="alt"><span>                    imageSize.width = Math.max(originalSize.width,  </span></li><li><span>                            imageSize.width + </span><span id="z1z5rrx" class="number">50</span><span>);  </span></span></li><li id="15r5b55" class="alt"><span>                    imageSize.height = Math.max(originalSize.height,  </span></li><li><span>                            imageSize.height + </span><span id="rjnnzf3" class="number">50</span><span>);  </span></span></li><li id="3ph5bh5" class="alt"><span>                    nativeComponent.setSize(imageSize);  </span></li><li><span>                    BufferedImage image = </span><span id="z55xznd" class="keyword">new</span><span> BufferedImage(imageSize.width,  </span></span></li><li id="bv5355f" class="alt"><span>                            imageSize.height, BufferedImage.TYPE_INT_RGB);  </span></li><li><span>                    nativeComponent.paintComponent(image);  </span></li><li id="lxh55l5" class="alt"><span>                    nativeComponent.setSize(originalSize);  </span></li><li><span>                    </span><span id="35bd5r5" class="comment">// 褰撶綉欏佃秴鍑虹洰鏍囧ぇ灝忔椂 </span><span>  </span></span></li><li id="hz5v51l" class="alt"><span>                    </span><span id="h5555nv" class="keyword">if</span><span> (imageSize.width > maxWidth  </span></span></li><li><span>                            || imageSize.height > maxHeight) {  </span></li><li id="fnptdt5" class="alt"><span>                        </span><span id="3p5jl55" class="comment">//鎴浘閮ㄥ垎鍥懼艦 </span><span>  </span></span></li><li><span>                        image = image.getSubimage(</span><span id="pxt5nl3" class="number">0</span><span>, </span><span id="lvf5t5v" class="number">0</span><span>, maxWidth, maxHeight);  </span></span></li><li id="5rlv55x" class="alt"><span>                        </span><span id="hj3dnlv" class="comment">/*姝ら儴鍒嗕負浣跨敤緙╃暐鍥?/span> </span></li><li><span id="3x5bl5p" class="comment">                        int width = image.getWidth(), height = image</span> </li><li id="ffz5rhr" class="alt"><span id="35ln555" class="comment">                            .getHeight();</span> </li><li><span id="5hbv55x" class="comment">                         AffineTransform tx = new AffineTransform();</span> </li><li id="jjd3pd5" class="alt"><span id="1z5d55r" class="comment">                        tx.scale((double) maxWidth / width, (double) maxHeight</span> </li><li><span id="55zjv5f" class="comment">                                / height);</span> </li><li id="3z55r5r" class="alt"><span id="3z3ldvd" class="comment">                        AffineTransformOp op = new AffineTransformOp(tx,</span> </li><li><span id="fhtl5vj" class="comment">                                AffineTransformOp.TYPE_NEAREST_NEIGHBOR);</span> </li><li id="35nh5bh" class="alt"><span id="vvp5jf5" class="comment">                        //緙╁皬</span> </li><li><span id="t3jd5xv" class="comment">                        image = op.filter(image, null);*/</span><span>  </span></li><li id="fhjl3fx" class="alt"><span>                    }  </span></li><li><span>                    </span><span id="jlnp5rh" class="keyword">try</span><span> {  </span></span></li><li id="jj3l55z" class="alt"><span>                        </span><span id="hpj35xn" class="comment">// 杈撳嚭鍥懼儚 </span><span>  </span></span></li><li><span>                        ImageIO.write(image, </span><span id="v5t5vl3" class="string">"jpg"</span><span>, </span><span id="z3xrfnv" class="keyword">new</span><span> File(fileName));  </span></span></li><li id="35d5xvx" class="alt"><span>                    } </span><span id="x3nzfd5" class="keyword">catch</span><span> (IOException ex) {  </span></span></li><li><span>                        ex.printStackTrace();  </span></li><li id="h5xhn5z" class="alt"><span>                    }  </span></li><li><span>                    </span><span id="355lfnv" class="comment">// 閫鍑烘搷浣?</span><span>  </span></span></li><li id="ptf3555" class="alt"><span>                    System.exit(</span><span id="zrb3pfv" class="number">0</span><span>);  </span></span></li><li><span>                }  </span></li><li id="3fntp5r" class="alt"><span>            }  </span></li><li><span>        }  </span></li><li id="dxpl5zp" class="alt"><span>        );  </span></li><li><span>        add(panel, BorderLayout.SOUTH);  </span></li><li id="1r5lpv1" class="alt"><span>    }  </span></li><li><span>    </span><span id="p5vrf5x" class="keyword">public</span><span> </span><span id="35d1xnt" class="keyword">static</span><span> </span><span id="ffp5jz5" class="keyword">void</span><span> main(String[] args) {  </span></span></li><li id="3d5lf5z" class="alt"><span>        NativeInterface.open();  </span></li><li><span>        SwingUtilities.invokeLater(</span><span id="jbfh3f5" class="keyword">new</span><span> Runnable() {  </span></span></li><li id="3pn515j" class="alt"><span>            </span><span id="5lrt355" class="keyword">public</span><span> </span><span id="blvpd5x" class="keyword">void</span><span> run() {  </span></span></li><li><span>                </span><span id="p5nzvj5" class="comment">// SWT緇勪歡杞琒wing緇勪歡錛屼笉鍒濆鍖栫埗紿椾綋灝嗘棤娉曞惎鍔╳ebBrowser </span><span>  </span></span></li><li id="hbt555b" class="alt"><span>                JFrame frame = </span><span id="l55bfdr" class="keyword">new</span><span> JFrame(</span><span id="zjbnpn3" class="string">"浠J緇勪歡淇濆瓨鎸囧畾緗戦〉鎴浘"</span><span>);  </span></span></li><li><span>                </span><span id="15jt55l" class="comment">// 鍔犺澆鎸囧畾欏甸潰錛屾渶澶т繚瀛樹負640x480鐨勬埅鍥?</span><span>  </span></span></li><li id="dn3hr5t" class="alt"><span>                frame.getContentPane().add(  </span></li><li><span>                        </span><span id="pzldf55" class="keyword">new</span><span> Main(</span><span id="h555dbf" class="string">"http://blog.csdn.net/cping1982"</span><span>, </span><span id="jlnfh5z" class="number">640</span><span>, </span><span id="rbnx5zf" class="number">480</span><span>),  </span></span></li><li id="p3vfjfv" class="alt"><span>                        BorderLayout.CENTER);  </span></li><li><span>                frame.setSize(</span><span id="55xbt5d" class="number">800</span><span>, </span><span id="nn5rb5j" class="number">600</span><span>);  </span></span></li><li id="zzvfhrh" class="alt"><span>                </span><span id="zlvx555" class="comment">// 浠呭垵濮嬪寲錛屼絾涓嶆樉紺?</span><span>  </span></span></li><li><span>                frame.invalidate();  </span></li><li id="hp35tr5" class="alt"><span>                frame.pack();  </span></li><li><span>                frame.setVisible(</span><span id="vdfht5l" class="keyword">false</span><span>);  </span></span></li><li id="ztdf515" class="alt"><span>            }  </span></li><li><span>        });  </span></li><li id="r5x5pf1" class="alt"><span>        NativeInterface.runEventPump();  </span></li><li><span>    }  </span></li><li id="n5t5v5j" class="alt"><span>}  </span></li></ol></div> <p><textarea style="display: none" class="java" rows="15" cols="50" name="code">import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import chrriis.dj.nativeswing.swtimpl.NativeComponent; import chrriis.dj.nativeswing.swtimpl.NativeInterface; import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser; import chrriis.dj.nativeswing.swtimpl.components.WebBrowserAdapter; import chrriis.dj.nativeswing.swtimpl.components.WebBrowserEvent; public class Main extends JPanel { /** * */ private static final long serialVersionUID = 1L; // 琛屽垎闅旂 final static public String LS = System.getProperty("line.separator", "/n"); // 鏂囦歡鍒嗗壊絎? final static public String FS = System.getProperty("file.separator", "http://"); //浠avascript鑴氭湰鑾峰緱緗戦〉鍏ㄥ睆鍚庡ぇ灝? final static StringBuffer jsDimension; static { jsDimension = new StringBuffer(); jsDimension.append("var width = 0;").append(LS); jsDimension.append("var height = 0;").append(LS); jsDimension.append("if(document.documentElement) {").append(LS); jsDimension.append( " width = Math.max(width, document.documentElement.scrollWidth);") .append(LS); jsDimension.append( " height = Math.max(height, document.documentElement.scrollHeight);") .append(LS); jsDimension.append("}").append(LS); jsDimension.append("if(self.innerWidth) {").append(LS); jsDimension.append(" width = Math.max(width, self.innerWidth);") .append(LS); jsDimension.append(" height = Math.max(height, self.innerHeight);") .append(LS); jsDimension.append("}").append(LS); jsDimension.append("if(document.body.scrollWidth) {").append(LS); jsDimension.append( " width = Math.max(width, document.body.scrollWidth);") .append(LS); jsDimension.append( " height = Math.max(height, document.body.scrollHeight);") .append(LS); jsDimension.append("}").append(LS); jsDimension.append("return width + ':' + height;"); } //DJNativeSwing緇勪歡璇蜂簬http://djproject.sourceforge.net/main/index.html涓嬭澆 public Main(final String url, final int maxWidth, final int maxHeight) { super(new BorderLayout()); JPanel webBrowserPanel = new JPanel(new BorderLayout()); final String fileName = System.currentTimeMillis() + ".jpg"; final JWebBrowser webBrowser = new JWebBrowser(null); webBrowser.setBarsVisible(false); webBrowser.navigate(url); webBrowserPanel.add(webBrowser, BorderLayout.CENTER); add(webBrowserPanel, BorderLayout.CENTER); JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 4)); webBrowser.addWebBrowserListener(new WebBrowserAdapter() { // 鐩戝惉鍔犺澆榪涘害 public void loadingProgressChanged(WebBrowserEvent e) { // 褰撳姞杞藉畬姣曟椂 if (e.getWebBrowser().getLoadingProgress() == 100) { String result = (String) webBrowser .executeJavascriptWithResult(jsDimension.toString()); int index = result == null ? -1 : result.indexOf(":"); NativeComponent nativeComponent = webBrowser .getNativeComponent(); Dimension originalSize = nativeComponent.getSize(); Dimension imageSize = new Dimension(Integer.parseInt(result .substring(0, index)), Integer.parseInt(result .substring(index + 1))); imageSize.width = Math.max(originalSize.width, imageSize.width + 50); imageSize.height = Math.max(originalSize.height, imageSize.height + 50); nativeComponent.setSize(imageSize); BufferedImage image = new BufferedImage(imageSize.width, imageSize.height, BufferedImage.TYPE_INT_RGB); nativeComponent.paintComponent(image); nativeComponent.setSize(originalSize); // 褰撶綉欏佃秴鍑虹洰鏍囧ぇ灝忔椂 if (imageSize.width > maxWidth || imageSize.height > maxHeight) { //鎴浘閮ㄥ垎鍥懼艦 image = image.getSubimage(0, 0, maxWidth, maxHeight); /*姝ら儴鍒嗕負浣跨敤緙╃暐鍥? int width = image.getWidth(), height = image .getHeight(); AffineTransform tx = new AffineTransform(); tx.scale((double) maxWidth / width, (double) maxHeight / height); AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); //緙╁皬 image = op.filter(image, null);*/ } try { // 杈撳嚭鍥懼儚 ImageIO.write(image, "jpg", new File(fileName)); } catch (IOException ex) { ex.printStackTrace(); } // 閫鍑烘搷浣? System.exit(0); } } } ); add(panel, BorderLayout.SOUTH); } public static void main(String[] args) { NativeInterface.open(); SwingUtilities.invokeLater(new Runnable() { public void run() { // SWT緇勪歡杞琒wing緇勪歡錛屼笉鍒濆鍖栫埗紿椾綋灝嗘棤娉曞惎鍔╳ebBrowser JFrame frame = new JFrame("浠J緇勪歡淇濆瓨鎸囧畾緗戦〉鎴浘"); // 鍔犺澆鎸囧畾欏甸潰錛屾渶澶т繚瀛樹負640x480鐨勬埅鍥? frame.getContentPane().add( new Main("http://blog.csdn.net/cping1982", 640, 480), BorderLayout.CENTER); frame.setSize(800, 600); // 浠呭垵濮嬪寲錛屼絾涓嶆樉紺? frame.invalidate(); frame.pack(); frame.setVisible(false); } }); NativeInterface.runEventPump(); } } </textarea> </p> <p> </p> <p> </p> <p> </p><img src ="http://www.tkk7.com/feng0801/aggbug/422317.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/feng0801/" target="_blank">ForMeBlog</a> 2015-01-21 12:00 <a href="http://www.tkk7.com/feng0801/archive/2015/01/21/422317.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Java鏂囦歡涓嬭澆 http://www.tkk7.com/feng0801/archive/2015/01/04/422028.htmlForMeBlogForMeBlogSun, 04 Jan 2015 08:32:00 GMThttp://www.tkk7.com/feng0801/archive/2015/01/04/422028.htmlhttp://www.tkk7.com/feng0801/comments/422028.htmlhttp://www.tkk7.com/feng0801/archive/2015/01/04/422028.html#Feedback0http://www.tkk7.com/feng0801/comments/commentRss/422028.htmlhttp://www.tkk7.com/feng0801/services/trackbacks/422028.htmlpublic HttpServletResponse download(String path, HttpServletResponse response) {
        
try {
            
// path鏄寚嬈蹭笅杞界殑鏂囦歡鐨勮礬寰勩?/span>
            File file = new File(path);
            
// 鍙栧緱鏂囦歡鍚嶃?/span>
            String filename = file.getName();
            
// 鍙栧緱鏂囦歡鐨勫悗緙鍚嶃?/span>
            String ext = filename.substring(filename.lastIndexOf("."+ 1).toUpperCase();

            
// 浠ユ祦鐨勫艦寮忎笅杞芥枃浠躲?/span>
            InputStream fis = new BufferedInputStream(new FileInputStream(path));
            
byte[] buffer = new byte[fis.available()];
            fis.read(buffer);
            fis.close();
            
// 娓呯┖response
            response.reset();
            
// 璁劇疆response鐨凥eader
            response.addHeader("Content-Disposition""attachment;filename=" + new String(filename.getBytes()));
            response.addHeader(
"Content-Length""" + file.length());
            OutputStream toClient 
= new BufferedOutputStream(response.getOutputStream());
            response.setContentType(
"application/octet-stream");
            toClient.write(buffer);
            toClient.flush();
            toClient.close();
        } 
catch (IOException ex) {
            ex.printStackTrace();
        }
        
return response;
    }

    
public void downloadLocal(HttpServletResponse response) throws FileNotFoundException {
        
// 涓嬭澆鏈湴鏂囦歡
        String fileName = "Operator.doc".toString(); // 鏂囦歡鐨勯粯璁や繚瀛樺悕
        
// 璇誨埌嫻佷腑
        InputStream inStream = new FileInputStream("c:/Operator.doc");// 鏂囦歡鐨勫瓨鏀捐礬寰?br />        // 璁劇疆杈撳嚭鐨勬牸寮?/span>
        response.reset();
        response.setContentType(
"bin");
        response.addHeader(
"Content-Disposition""attachment; filename=\"" + fileName + "\"");
        
// 寰幆鍙栧嚭嫻佷腑鐨勬暟鎹?/span>
        byte[] b = new byte[100];
        
int len;
        
try {
            
while ((len = inStream.read(b)) > 0)
                response.getOutputStream().write(b, 
0, len);
            inStream.close();
        } 
catch (IOException e) {
            e.printStackTrace();
        }
    }

    
public void downloadNet(HttpServletResponse response) throws MalformedURLException {
        
// 涓嬭澆緗戠粶鏂囦歡
        int bytesum = 0;
        
int byteread = 0;

        URL url 
= new URL("windine.blogdriver.com/logo.gif");

        
try {
            URLConnection conn 
= url.openConnection();
            InputStream inStream 
= conn.getInputStream();
            FileOutputStream fs 
= new FileOutputStream("c:/abc.gif");

            
byte[] buffer = new byte[1204];
            
int length;
            
while ((byteread = inStream.read(buffer)) != -1) {
                bytesum 
+= byteread;
                System.out.println(bytesum);
                fs.write(buffer, 
0, byteread);
            }
        } 
catch (FileNotFoundException e) {
            e.printStackTrace();
        } 
catch (IOException e) {
            e.printStackTrace();
        }
    }
//鏀寔鍦ㄧ嚎鎵撳紑鏂囦歡鐨勪竴縐?
public void downLoad(String filePath, HttpServletResponse response, boolean isOnLine) throws Exception {
        File f 
= new File(filePath);
        
if (!f.exists()) {
            response.sendError(
404"File not found!");
            
return;
        }

        BufferedInputStream br 
= new BufferedInputStream(new FileInputStream(f));
        
byte[] buf = new byte[1024];
        
int len = 0;

        response.reset(); 
// 闈炲父閲嶈
        if (isOnLine) // 鍦ㄧ嚎鎵撳紑鏂瑰紡
            URL u = new URL("file:///" + filePath);
            response.setContentType(u.openConnection().getContentType());
            response.setHeader(
"Content-Disposition""inline; filename=" + f.getName());
            
// 鏂囦歡鍚嶅簲璇ョ紪鐮佹垚UTF-8
        }
 else // 綰笅杞芥柟寮?/span>
            response.setContentType("application/x-msdownload");
            response.setHeader(
"Content-Disposition""attachment; filename=" + f.getName());
        }

        OutputStream out 
= response.getOutputStream();
        
while ((len = br.read(buf)) > 0)
            out.write(buf, 
0, len);
        br.close();
        out.close();
    }
鏂瑰紡



ForMeBlog 2015-01-04 16:32 鍙戣〃璇勮
]]>java淇敼xml鏂囦歡http://www.tkk7.com/feng0801/archive/2014/07/29/401396.htmlForMeBlogForMeBlogTue, 29 Jul 2014 09:05:00 GMThttp://www.tkk7.com/feng0801/archive/2014/07/29/401396.htmlhttp://www.tkk7.com/feng0801/comments/401396.htmlhttp://www.tkk7.com/feng0801/archive/2014/07/29/401396.html#Feedback0http://www.tkk7.com/feng0801/comments/commentRss/401396.htmlhttp://www.tkk7.com/feng0801/services/trackbacks/401396.html鍘熷鐨刴essage.xml
<?xml version="1.0" encoding="UTF-8"?><users>
    
<Messages>
        
<sendName>sendUsers</sendName>
        
<receiveName>snake</receiveName>
        
<date>2007-12-04 12:20:00</date>
        
<status>1</status>
        
<message>this is Content</message>
    
</Messages>
</users>

java紼嬪簭
import java.io.File;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class UpdateXml {
    
public static boolean doc2XmlFile(Document document, String filename) {
        
boolean flag = true;
        
try {
           
            TransformerFactory tFactory 
= TransformerFactory.newInstance();
            Transformer transformer 
= tFactory.newTransformer();
           
            
// transformer.setOutputProperty(OutputKeys.ENCODING, "GB2312");
            DOMSource source = new DOMSource(document);
            StreamResult result 
= new StreamResult(new File(filename));
            transformer.transform(source, result);
        } 
catch (Exception ex) {
            flag 
= false;
            ex.printStackTrace();
        }
        
return flag;
    }

    
public static Document load(String filename) {
        Document document 
= null;
        
try {
            DocumentBuilderFactory factory 
= DocumentBuilderFactory
                    .newInstance();
            DocumentBuilder builder 
= factory.newDocumentBuilder();
            document 
= builder.parse(new File(filename));
            document.normalize();
        } 
catch (Exception ex) {
            ex.printStackTrace();
        }
        
return document;
    }

   
    
public static void xmlUpdateDemo() {
        Document document 
= load("message.xml");
        Node root 
= document.getDocumentElement();
       
        
if (root.hasChildNodes()) {
           
            NodeList ftpnodes 
= root.getChildNodes();
           
            
for (int i = 0; i < ftpnodes.getLength(); i++) {
                NodeList ftplist 
= ftpnodes.item(i).getChildNodes();
                
for (int k = 0; k < ftplist.getLength(); k++) {
                    Node subnode 
= ftplist.item(k);
                   
                    
// if (subnode.getNodeType()==Node.ELEMENT_NODE&&subnode.
                    
// getNodeName()=="ftp-chn")
                    
// {
                    
// ftpnodes.item(i).removeChild(subnode);
                    
// }
                   
                    
if (subnode.getNodeType() == Node.ELEMENT_NODE
                            
&& subnode.getNodeName() == "status") {
                        subnode.getFirstChild().setNodeValue(
"9");
                    }
                }

            }
        }

        doc2XmlFile(document, 
"message.xml");
    }

    
public static void main(String args[]) throws Exception {
        UpdateXml.xmlUpdateDemo();
    }
}

淇敼鍚庣殑message.xml
<?xml version="1.0" encoding="UTF-8"?><users>
    
<Messages>
        
<sendName>sendUsers</sendName>
        
<receiveName>snake</receiveName>
        
<date>2007-12-04 12:20:00</date>
        
<status>9</status>
        
<message>this is Content</message>
    
</Messages>
</users>


ForMeBlog 2014-07-29 17:05 鍙戣〃璇勮
]]>
ant 鍏ラ棬http://www.tkk7.com/feng0801/archive/2014/07/29/401513.htmlForMeBlogForMeBlogTue, 29 Jul 2014 09:01:00 GMThttp://www.tkk7.com/feng0801/archive/2014/07/29/401513.htmlhttp://www.tkk7.com/feng0801/comments/401513.htmlhttp://www.tkk7.com/feng0801/archive/2014/07/29/401513.html#Feedback0http://www.tkk7.com/feng0801/comments/commentRss/401513.htmlhttp://www.tkk7.com/feng0801/services/trackbacks/401513.html闃呰鍏ㄦ枃

ForMeBlog 2014-07-29 17:01 鍙戣〃璇勮
]]>
Ant浣跨敤渚嬪瓙http://www.tkk7.com/feng0801/archive/2014/07/29/416297.htmlForMeBlogForMeBlogTue, 29 Jul 2014 08:49:00 GMThttp://www.tkk7.com/feng0801/archive/2014/07/29/416297.htmlhttp://www.tkk7.com/feng0801/comments/416297.htmlhttp://www.tkk7.com/feng0801/archive/2014/07/29/416297.html#Feedback0http://www.tkk7.com/feng0801/comments/commentRss/416297.htmlhttp://www.tkk7.com/feng0801/services/trackbacks/416297.html闃呰鍏ㄦ枃

ForMeBlog 2014-07-29 16:49 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲成人免费电影| 久久国产精品亚洲一区二区| 亚洲中文字幕无码爆乳app| 日本免费污片中国特一级| 久久精品国产亚洲网站| 国产成人无码区免费网站| 亚洲AV无码专区国产乱码电影| a级毛片无码免费真人久久| 亚洲av之男人的天堂网站| 久草免费福利视频| 91亚洲性爱在线视频| 国内一级一级毛片a免费| 国产精品久久久久久亚洲影视| 全黄a免费一级毛片人人爱| 亚洲精品视频免费观看| 亚洲av无码不卡| 国产va精品免费观看| 国产精品亚洲精品久久精品| 亚洲视频在线一区二区| 午夜精品免费在线观看| 亚洲欧洲日韩极速播放| 亚洲精品网站在线观看不卡无广告 | 亚洲V无码一区二区三区四区观看| 成人免费区一区二区三区| 亚洲国产成人资源在线软件| 成人毛片免费观看| 久久成人18免费网站| 亚洲大尺码专区影院| 国产一级理论免费版| 日韩免费电影网站| 亚洲色大18成人网站WWW在线播放| 亚洲精品网站在线观看不卡无广告| 午夜视频免费在线观看| 亚洲精品亚洲人成在线| 亚洲不卡av不卡一区二区| 无码人妻久久一区二区三区免费丨| 四虎成人精品国产永久免费无码| 亚洲精品免费观看| 国产精品麻豆免费版| 免费日本一区二区| 国产亚洲Av综合人人澡精品|