gwt-ext 프로젝트 돌입!!!
항상 보면서 부러워만 했던 ext-js가 gwt로 라이브러리화 되어 나왔습니다.
이제 슬슬 만지작 만지작 해봐야 할 것 같네요 캬캭~
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
항상 보면서 부러워만 했던 ext-js가 gwt로 라이브러리화 되어 나왔습니다.
이제 슬슬 만지작 만지작 해봐야 할 것 같네요 캬캭~
private String realizePermutation(TreeLogger logger, Property[] currentProps, String[] currentValues, int permNumber) throws UnableToCompleteException { String msg = "Analyzing permutation #" + permNumber; logger = logger.branch(TreeLogger.TRACE, msg, null); logProperties(logger, currentProps, currentValues); // Create a rebind oracle that will record decisions so that we can // cache // them and avoid future computations. // CompilationRebindOracle rebindOracle = new CompilationRebindOracle(); // Tell the property provider above about the current property values. // Note that the rebindOracle is actually sensitive to these values // because // in its ctor is uses propOracle as its property oracle. // propOracle.setPropertyValues(currentProps, currentValues); // Check to see if we already have this compilation. // This will have the effect of filling the rebind oracle's cache. // String[] entryPts = module.getEntryPointTypeNames(); Compilation cached = compilations.find(logger, rebindOracle, entryPts); if (cached != null) { msg = "Matches existing compilation " + cached.getStrongName(); logger.log(TreeLogger.TRACE, msg, null); return cached.getStrongName(); } // Now attach a compilation into which we can record the particular // inputs // and outputs used by this compile process. // Compilation compilation = new Compilation(); rebindOracle.recordInto(compilation); // Create JavaScript. // String js = jjs.compile(logger, rebindOracle); // Create a wrapper and an unambiguous name for the file. // String strongName = writeHtmlAndJsWithStrongName(logger, js); // Write out a cache control file that correlates to this script. // compilation.setStrongName(strongName); writeCacheFile(logger, compilation); // Add this compilation to the list of known compilations. // compilations.add(compilation); return compilation.getStrongName(); }
private String realizePermutation(TreeLogger logger, Property[] currentProps, String[] currentValues, int permNumber) throws UnableToCompleteException { String msg = "Analyzing permutation #" + permNumber; logger = logger.branch(TreeLogger.TRACE, msg, null); logProperties(logger, currentProps, currentValues); // Create a rebind oracle that will record decisions so that we can // cache // them and avoid future computations. // CompilationRebindOracle rebindOracle = new CompilationRebindOracle(); // Tell the property provider above about the current property values. // Note that the rebindOracle is actually sensitive to these values // because // in its ctor is uses propOracle as its property oracle. // propOracle.setPropertyValues(currentProps, currentValues); // Check to see if we already have this compilation. // This will have the effect of filling the rebind oracle's cache. // String[] entryPts = module.getEntryPointTypeNames(); Compilation cached = compilations.find(logger, rebindOracle, entryPts); if (cached != null) { msg = "Matches existing compilation " + cached.getStrongName(); logger.log(TreeLogger.TRACE, msg, null); return cached.getStrongName(); } // Now attach a compilation into which we can record the particular // inputs // and outputs used by this compile process. // Compilation compilation = new Compilation(); rebindOracle.recordInto(compilation); // Create JavaScript. // String js = jjs.compile(logger, rebindOracle); String entryPointName = entryPts[0].substring(entryPts[0] .lastIndexOf(".") + 1); String name = entryPointName + "_" + currentValues[2] + "_" + currentValues[3]; String strongName = writeHtmlAndJsWithStrongName(logger, js, name); compilation.setStrongName(strongName); writeCacheFile(logger, compilation); // Add this compilation to the list of known compilations. // compilations.add(compilation); return compilation.getStrongName(); } private String writeHtmlAndJsWithStrongName(TreeLogger logger, String js, String strongName) throws UnableToCompleteException { try { byte[] scriptBytes = js.getBytes("UTF-8"); { byte[] prefix = getHtmlPrefix().getBytes("UTF-8"); byte[] suffix = getHtmlSuffix().getBytes("UTF-8"); File outFile = new File(outDir, strongName + ".cache.html"); Util.writeBytesToFile(logger, outFile, new byte[][] { prefix, scriptBytes, suffix }); String msg = "Compilation written to " + outFile.getAbsolutePath(); logger.log(TreeLogger.TRACE, msg, null); } { byte[] prefix = getJsPrefix().getBytes("UTF-8"); byte[] suffix = getJsSuffix().getBytes("UTF-8"); File outFile = new File(outDir, strongName + ".cache.js"); Util.writeBytesToFile(logger, outFile, new byte[][] { prefix, scriptBytes, suffix }); String msg = "Compilation written to " + outFile.getAbsolutePath(); logger.log(TreeLogger.TRACE, msg, null); } return strongName; } catch (UnsupportedEncodingException e) { logger.log(TreeLogger.ERROR, "Unable to encode compiled script as UTF-8", e); throw new UnableToCompleteException(); } }
LocalServer Module
출처: http://code.google.com/apis/gears/api_localserver.html
네트워크 연결이 끊긴 상태에서도 웹 어플리케이션의 HTTP 리소스들을 로컬에 저장하고 제공해주는 역할을 한다.
Resource Stores
- ResourceStore : 자바스크립트를 이용하여 임시의 URL들을 캡쳐링
- ManagedResourceStore : manifest 파일에 선언된 URL들을 캡쳐링
Updating of cached resources
- ManagedResourceStore는 manifest 파일의 버전이 변경될 경우 자동적으로 업데이트를 한다.
(checkForUpdate() 메소드를 이용)
- ResourceStore는 웹 어플리케이션에 의해 변경된다. (자동 업데이트 X)
Local serving of cached resources
- LocalServer는 HTTP/HTTPS 요청을 캐싱된 데이터를 이용하여 상황에 맞게 제공해준다.
- 네트워크 상태와는 상관없이 요청된 URL이 캐싱된 경우에는 캐싱된 리소스들로 처리한다.
LocalServer Class
로컬서버는 Gears Factory를 통하여 생성된다.
{ // version of the manifest file format "betaManifestVersion": 1, // version of the set of resources described in this manifest file "version": "my_version_string", // optional // If the store specifies a requiredCookie, when a request would hit // an entry contained in the manifest except the requiredCookie is // not present, the local server responds with a redirect to this URL. "redirectUrl": "login.html", // URLs to be cached (URLs are given relative to the manifest URL) "entries": [ { "url": "main.html", "src": "main_offline.html" }, { "url": ".", "redirect": "main.html" }, { "url": "main.js" } { "url": "formHandler.html", "ignoreQuery": true }, ] }