锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
涓婃e4鏀懼嚭鐨勫熀浜巜eb鐨処DE灝變嬌鐢╢lash浣滀負浠g爜灞曠ず鍜岀紪杈戠殑緙栬緫鍣紝鐪嬫潵Eclipse紺懼洟涔熸劅瑙夊埌綰殑js鍩烘湰涓婁笉鑳藉畬鎴愪換鍔′簡銆?/p>
Demo涓嬭澆鍦板潃錛?a title="http://www.innoopract.com/fileadmin/user_upload/Bilder/Films/draw2d_640x480.mp4" >http://www.innoopract.com/fileadmin/user_upload/Bilder/Films/draw2d_640x480.mp4
瀹樻柟棣栭〉
Demo鍦板潃
http://www.eclipse.org/rap/demos.php 姝ら〉闈㈡彁渚?涓狣emo錛屽叾涓殑SWT鐨勫畼鏂笵emo鐨凴AP瀹炵幇鍦≧AP鐨勫彂琛屽寘涓紝鑷繁涓嬭澆涓嬫潵錛岃嚜宸盧UN璧鋒潵灝辮兘鐪嬪埌浜嗭紱
RAP寮鍙戦澶村叕鍙?/p>
public class FileUploadDialog extends TitleAreaDialog { private Browser browser;
public FileUploadDialog(Shell parentShell) { super(parentShell); }
/** * Create contents of the dialog * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayout(new FillLayout()); container.setLayoutData(new GridData(GridData.FILL_BOTH));
/** * Return the initial size of the dialog */ @Override protected Point getInitialSize() { return new Point(382, 280); }
protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText("upload file"); }
}
file upload sevlet:
public class FileUploadServlet extends HttpServlet { private static final long serialVersionUID = -7245361228773015964L; private String uploadPath = "/upload/"; // server file repository private String tempPath = "/upload/tmp/"; //temp file folder
// get all uploa file List fileItems = fu.parseRequest(request); Iterator i = fileItems.iterator(); while (i.hasNext()) { FileItem fi = (FileItem) i.next(); // get the upload file name String fileName = fi.getName(); String sep = System.getProperty("file.separator"); int index = fileName.lastIndexOf(sep); if(index >-1){ fileName = fileName.substring(fileName.lastIndexOf(sep)); } fi.write(new File(uploadPath + fileName)); response.getWriter().println(fileName+"upload success"); } } catch (Exception e) { //do something? e.printStackTrace(); } } public void init() throws ServletException { if (!new File(uploadPath).isDirectory()) new File(uploadPath).mkdirs(); if (!new File(tempPath).isDirectory()) new File(tempPath).mkdirs(); } }
registe servlet:
public class HttpServiceTracker extends ServiceTracker {
public HttpServiceTracker(BundleContext context) { super(context, HttpService.class.getName(), null); }
} catch (Exception e) { e.printStackTrace(); } return httpService; }
start servlet:
add these code to the bundle start up method. public void start(BundleContext context) throws Exception { super.start(context); plugin = this; httpServiceTracker = new HttpServiceTracker(context); httpServiceTracker.open(); System.out.println("IM resource servlet started..."); }
榪欎釜瀹炵幇鏄湪RAP涓嬌鐢˙rowser+servlet瀹炵幇鐨勬枃浠朵笂浼犲姛鑳斤紱
鍏跺疄鍦≧AP鐨刢vs涓婂凡緇忔斁鍑轟簡org.eclipse.rwt.widgets.upload錛屼笓鐢ㄤ簬涓婁紶鐨勭粍浠訛紝嫻嬭瘯浜嗕竴涓嬶紝鏁堟灉榪樹笉閿欙紝鏈夎繘搴︽潯鎻愮ず錛涗笉榪囧湪IE6涓嬶紝鏈夌偣闅劇湅浜嗭紝鍦‵F3涓嬩笉鑳戒嬌鐢紱
鍏徃鏈榪戞鍦ㄥ仛璋冩暣錛屾墦綆楀皢鍘熸湁7澶ц蔣浠朵駭鍝侊紝鍦˙/S涓婇噸鏂版墦閫犱竴鐣獈鍓嶆櫙寰堜笉閿欙紝甯傚満浠峰奸潪甯稿ぇ~鎴戜滑鎵鍏沖績鐨勫茍涓嶆槸甯傚満浠峰肩┒绔熸湁澶氬ぇ錛堟湁涓婇潰鐨勫ぇ棰嗗鎾戠潃錛屾垜浠笉鐢ㄦ媴蹇冿級錛屾垜浠叧蹇冪殑鏄紝濡備綍鎵撶牬鍘熸湁鐨凚/S寮鍙戞ā寮忥紝璁╃▼搴忓憳浠兘楂橀熺殑寮鍙戝嚭闇瑕佺郴緇燂紝鑰屼笖榪欎簺緋葷粺鍙堣兘閬靛畧鍏卞悓鐨勭壒鐐癸紝鍘熸湁鐨凚/S寮鍙戞ā寮忓彧鍙兘璁╃▼搴忓憳鍘熸潵瓚婁笉OO浜嗭紝寰堟湁鍙兘闄峰叆JS鐨勯櫡闃變腑銆?/p>
鎴戜滑鎶婄洰鍏夎漿縐誨埌浜咷WT涓婏紝浠栫‘瀹炲彲浠ヨJAVA寮鍙戜漢鍛樺彧涓撴敞鐨勫啓JAVA灝卞彲浠ヤ簡錛屼竴鍒囬兘鏄畠鐨勪簨鎯呬簡~浣嗘槸鏈楹葷儲鐨勪簨鎯咃紝灝辨槸閫熷害闂錛岀紪璇戠殑鏃跺欏緢鎱紝鑰屼笖榪樻彁鍑轟簡妯″潡鐨勬蹇碉紝涓嶅ソ鐞嗚В錛屾斁寮冨畠鐨勫彟涓涓渶閲嶈鐨勫師鍥犳槸瀹冨茍涓嶆槸涓涓鏋訛紝鍙槸涓涓伐鍏烽泦鑰屽凡銆?/p>
鐒跺悗錛屾垜浠彂鐜頒簡RAP-Rich Ajax Platform錛屼粠瀹冪殑棣栭〉涓婂茍鐪嬩笉鍑轟粈涔堢壒鍒紝浣嗘槸娣卞叆Demo錛屾墠鐪熺殑鍙戠幇鍒湁媧炲ぉ鍟妦鍘熸潵涓鍒囨潵鐨勯兘鏄偅涔堢畝鍗晘~~~瀹冨叾瀹炲氨鏄緷鐓т笌Eclipse-RCP鐨勫熀紜榪愯鏃跺仛浜嗕竴濂楄嚜宸辯殑鍩虹榪愯鏃禦AP錛屾崲鍙ヨ瘽璇村氨鏄師鏈紑鍙戝ソ鐨凴CP欏圭洰錛屽彲浠ュ湪浠呭鍔犱竴涓墿灞曠偣鐨勫熀紜涓婏紝騫蟲粦鐨勮繃搴﹀埌RAP涓婏紝绔嬪嵆浠庝竴涓狢/S紼嬪簭鍙樻垚浜嗕竴涓狟/S紼嬪簭~鐪熺殑寰堜護浜洪渿鎯婏紒浠婂ぉ鏃╀笂鍜屽悓浜嬮厤鍚堬紝灝嗘垜浠嚑涓湀鍓嶅仛鐨?涓彃浠訛紝鐢ㄤ簡涓鏃╀笂鐨勬椂闂磋縼縐誨埌RAP涓婏紝鍑犱箮鍘熸湁鍔熻兘瀹屽叏淇濈暀錛?/p>
濡傛灉浣犱篃鏄敤RCP鍋氬紑鍙戠殑璇濓紝寤鴻浣犲彲浠ヨ瘯璇昍AP錛屽畠浼氱粰浣犱竴鎯充笉鍒扮殑浣撻獙錛?/p>
闇瑕佹敞鎰忕殑鏄紝RAP鏄幓騫?0鏈堜喚鎵嶆寮忓彂甯冪殑1.0鐗堟湰錛屾墍浠ヨ繕鏄湁寰堝涓滆タ鏄病鏈夛紝榪樻槸闇瑕佷竴孌墊椂闂寸殑絳夊緟錛岀壒鍒槸鍦?.1鍙戝竷鍚庯紝鍑犱箮鏀寔鎵鏈塖WT鐨勭壒鎬т簡~
涓轟簡娣卞叆鐨勮璁篟AP錛屾垜宸茬粡寮鏀句簡Eclipse-RAP鍒嗙被錛屾參鎱細鏈夋洿澶氱殑鍏充簬RAP鐨勬枃绔犲嚭鐜幫紝鍔姏涓板瘜涓涓婻AP鐨勪腑鏂囨枃妗o紒