XULRunner with Java: JavaXPCOM Tutorial 4
7. ÓÃJavaXPCOMÀ´×Ô¶¯ä¯ÀÀÍøÒ³
ÔÚÕâÒ»½ÚÀïÎÒÃǽ«½â¾öһЩ×Ô¶¯ä¯ÀÀÍøÒ³ÖеÄһЩÎÊÌ⣬³¢ÊÔ°ÑÒ»ÏÂͨÓõÄÈÎÎñ³éÏó³ÉÈËÀà¿É¶ÁµÄ·½·¨£¬Òò´ËÄã¿ÉÒÔÇáÒ×µÄÔĶÁ
´úÂë²¢ÖªµÀËüµÄ¹¦ÄÜ¡£ÎÒÃǽ«¹¹½¨Ò»¸öWeb BrowserÀ´¼ÓÔØÍøÒ³£¬µã»÷°´Å¥»òÕß³¬Á´½Ó£¬Ê¹ÓÃXPathÀ´³éÈ¡Ò»ÏÂÓÐÓõÄÐÅÏ¢¡£ÔÚÿһ¸ö
С½ÚÀïÃ棬ÎÒÃǶ¼½«ÔÚÎÒÃǵÄä¯ÀÀÆ÷ÀïÔö¼ÓÐµĹ¦ÄÜ£¬Òò´ËÔÚ×îºó£¬ÎÒÃǽ«ÓÐÒ»¸öWeb Browser£¬ËüÄܹ»ÊµÏÖÍøÒ³µÄ×Ô¶¯
ä¯ÀÀ¡£
7.1 ʹÓÃÎÒÃǵÄä¯ÀÀÆ÷À´¼ÓÔØÍøÒ³
ÔÚÀý×Ó SimpleBrowserÀÎÒÃÇʹÓ÷½·¨ public boolean setUrl(String url) À´ÈÃä¯ÀÀÆ÷¼ÓÔØÒ»¸öurl¡£Õâ¸ö·½·¨µÄÎÊÌâÊÇËü
¿ÉÒÔÈÃä¯ÀÀÆ÷¿ªÊ¼¼ÓÔØÒ»¸öÒ³Ã棬µ«ÊDz»»áµÈ´ýä¯ÀÀÆ÷¼ÓÔØÒ³ÃæÍê³É¡£ÎÒÃÇдÁËÒ»¸ö·½·¨½Ð×ögoÀ´ÊµÏÖÕâ¸ö¹¦ÄÜ£¬Òò´ËºóÃæÎÒÃǽ«Ê¹
ÓÃÕâÖÖ·½·¨À´°²È«µÄ¼ÓÔØÒ»¸öÒ³Ã棬×èÈûסִÐÐÁ÷³ÌÖ±µ½Ò³Ãæ¼ÓÔسɹ¦»òÕß³¬Ê±¡£
×¢£ºÊµÏֵķ½·¨ÊÇÔÚsetUrlµÄʱºò¶¨ÒåÒ»¸öCountDownLatch£¬È»ºó¼àÌýbrowser.addProgressListener£¬µÈÒ³ÃæÍê³Éºó°ÑÕâ¸ö
CountDownLatch countDownһϡ£µ÷ÓÃsetUrlºóʹÓÃCountDownLatchµÄawait·½·¨µÈ´ý¼ÓÔØÍê³É»òÕß³¬Ê±¡£×¢Òâµ÷ÓÃsetUrlʱҪÆô¶¯
Ò»¸öSWTÏß³Ì
display.syncExec(new Runnable() {
public void run() {
browser.setUrl(url);
}
});
ÁíÍ⣬ÎÒÃÇ¿ÉÄÜ»¹Ïë»ñµÃ¼ÓÔغóµÄÒ³ÃæÄÚÈÝ£¬ËùÓÐÒëÕßÔö¼ÓÁËÒ»¸ö±äÁ¿content¡£Ôö¼ÓµÄ´úÂëÈçÏÂ
browser.addProgressListener(new ProgressListener() {
public void changed(ProgressEvent event) {
}
Ïà¹ØÎĵµ£º
Èç¹ûÄãÔø¾ÓùýPerl»òÈκÎÆäËûÄÚ½¨ÕýÔò±í´ïʽ֧³ÖµÄÓïÑÔ£¬ÄãÒ»¶¨ÖªµÀÓÃÕýÔò±í´ïʽ´¦ÀíÎı¾ºÍÆ¥ÅäģʽÊǶàô¼òµ¥¡£Èç¹ûÄã²»ÊìϤÕâ¸öÊõÓÄÇô“ÕýÔò±í´ïʽ”£¨Regular Expression£©¾ÍÊÇÒ»¸ö×Ö·û¹¹³ÉµÄ´®£¬Ëü¶¨ÒåÁËÒ»¸öÓÃÀ´ËÑË÷Æ¥Åä×Ö·û´®µÄģʽ¡£
Ðí¶àÓïÑÔ£¬°üÀ¨Perl¡¢PHP¡¢Python¡¢JavaScriptºÍJScript£¬¶¼Ö§ ......
Ò»¡¢Axis°²×° 1¡¢»·¾³ J2SE SDK 1.5 or 1.6: ÎÒʹÓà 1.6 Servlet Container: ÎÒʹÓõÄTomcat 6.0
2¡¢µ½ http://ws.apache.org/Axis/ÍøÕ¾ÏÂÔØAxis°²×°°ü
3¡¢ÏÈÔÚeclipseÏÂн¨web projectΪWebServiceDemo.ÔÚTomcatµÄÅäÖÃxmlÅäÖÃÉÏ£º<Context path="/webservice" docBase="D:\workspace\WebServiceDemo\WebRoot"/>. ......
Part 2£ºWeb²ã¹¦ÄÜÔöÇ¿
ÔÚJavaEE6ÖУ¬Web²ãÓÐÏÔÖøµÄ¹¦ÄÜÔöÇ¿¡£ÈçÉÏÎÄËùÊö£¬JavaaEE6ƽ̨µÄÄ¿±êÖ®Ò»¾ÍÊÇÔöÇ¿Æä¿ÉÀ©Õ¹ÐÔ£¬¶øÓë¿ÉÀ©Õ¹ÐÔÏà¹ØµÄÁ½¸ö¹Ø¼ü¼¼Êõ±ãÊÇ£ºWebƬ¶Ï£¨web fragments£©¡¢¹²Ïí¿ò¼Ü¿É²å°ÎÄÜÁ¦£¨shared framework pluggability£©£¬¶øÕâÁ½¸öÐÂÌØÐÔÊÇÓÉservlet3.0¼¼Êõ×é¼þÌṩµÄ¡£Servlet 3.0, JSR 315
ÊÇserv ......
Ò»¡¢java.util.Formatter
java.util.Formatter ÊÇJDK1.5ÐÂÔöµÄÀà¿â£¬¹¦ÄܺÜÇ¿´ó£¬µ«ÊDz»ºÃÕÆÎÕ£¬¾ÍÏñÏÂÆåÒ»Ñù£¬ÖªµÀÈçºÎ×ßÆå×Ó£¬ºÍÊìÁ·Ó¦ÓÃÍêÈ«ÊÇÁ½ÂëÊ¡£
¸ñʽ»¯Ö÷ÒªÓÃÔÚÎı¾Êä³ö·½Ã棬±ÈÈ磬Êý×Ö¡¢ÈÕÆÚ¡¢½ð¶îµÈ£¬»¹ÓÐÀàËƳ¬ÊеĹºÎﵥСƱµÈµÈ£¬¶¼»áÓõ½¸ñʽ»¯Êä³öµÄ¹¤¾ß¡£ÔÚ´ËÀàû³öÏÖ֮ǰ£¬Ö»ÄÜͨ¹ý¿ ......
4 ÔÚjava´úÂëÀïǶÈëFirefox3
ÏÖÔÚ¿ÉÒÔÈ¥ÓÃÒ»ÏÂÓÐÓõÄÀý×ÓÁË¡£Ê×ÏÈÎÒÃÇÔÚÒ»¸öjava³ÌÐòÀïʹÓÃSWTÀ´Ç¶ÈëÒ»¸öMozillaä¯ÀÀÆ÷¡£ÏÖÔÚ£¬ÎÒÃÇ¿ÉÒÔʹÓÃ
org.eclipse.swt.browser.BrowserÀàÀ´ÊµÀý»¯£ºbrowser = new Browser(shell, SWT.MOZILLA); ÔÚÕâ֮ǰ£¬ÎÒÃÇÐèҪʹÓÃATFÏîÄ¿
£¬ÒÔ¼°Ò»ÏÂATF²å¼þ¡£·Ç³£ÐÒÔË£¬ÏÖÔÚÎÒÃDz»ÐèÒ ......