Java Script Shibuya js Technical Talk 2 takesakonamazu
サーバサイド Java. Script の 歴史と未来 Shibuya. js Technical Talk #2 竹迫 良範 <takesako@namazu. org> 2006/06/30
サーバサイドJava. Scriptの有名どころ n Microsoft IIS n ASP (Active Server Page) いろいろ n. VBScript / Perl. Script / Jscript … n Live. Wire Java. Script から発展 n Netscape Enterprise Server n i. Planet n Sun Java System Web server n Broad. Vision n One-To-One Enterprise 2006/06/30 #02 9
2006/06/30 #02 10
Dream. Arts ひびき®シリーズ http: //hibiki. dreamarts. co. jp/index. html 2006/06/30 #02 11
Dream. Arts ひびき®シリーズ n サンプルプログラム function service(request, response) { var hibikidb = Hibiki. get. Database. Session(); var isdb = Hibiki. get. Database. Session('isdb'); if (hibikidb == null || isdb == null) { log. fatal("Failed to check my DB server!"); return send. Error(response); } var f = new java. io. File(Hibiki. get. Data. Directory() + "/health-check. dat"); if (!f. exists()) { log. fatal("Failed to check my file server!"); return send. Error(response); } return "/success. vm"; } 2006/06/30 #02 /* * ロードバランサから監視する場合のヘルスチェックリスナーサンプル * 正常に稼働している場合には、/success. vm の内容が送信される。 * データベースおよびファイルのどちらかに異常がある場合には、 * HTTPステータスコード500を返して終了する。- send. Error() */ 14
INSUITE®セキュリティアダプタ 2006/06/30 #02 http: //www. insuite. jp/merit/security. html 15
INSUITE®セキュリティアダプタ n サンプルプログラム n SSL以外でリクエストされた場合に SSLにリダイレクトする $ cat redirect_to_https. js Apache. translate. Name = function { if (request. uri. match("^/images/(. *)")) decline(); if (request. uri. match("^/i/(. *)") || request. uri. match("^/_/(. *)")) decline(); redirect("https: //" + request. hostname + request. uri); } 2006/06/30 #02 17
#02 http: //www. ipa. go. jp/about/jigyoseika/04 fy-pro/mito/2004 -861 a. pdf 2006/06/30 19
2006/06/30 #02 20
2006/06/30 #02 21
Mayaa – Java. Server Templates 2006/06/30 #02 22
Mayaa の位置づけ a 2006/06/30 #02 23
Sarugau JS(さるごーJS) 2006/06/30 #02 26
firecat – Java. Script Web. Server n 処理系 n W 3 C Jigsaw (HTTP) + FESI (ECMAScript) n ライセンス n LGPL nhttp: //betaworks. netbeans. jp/Wiki. jsp? page=Firecat 2006/06/30 #02 27
firecat – Java. Script Web. Server n サンプルプログラム <%@page content_type="text/html; charset=Shift-JIS"%> <% var msg = "あなたのIPアドレスは"; var remote_ip = request. get. Remote. Addr(); msg = msg + remote_ip; %> <%=msg%> 2006/06/30 #02 28
その他 n mod_gcj / Rhinola n Rhino + GCJ 4. 0 + Apache mod_gcj nhttp: //mod-gcj. sourceforge. net/rhinola. html n Helma - Javascript Web Application Framework n Rhino + Jetty n Helma License version 2. 0 nhttp: //www. helma. org/ 2006/06/30 #02 29
2006/06/30 #02 31
Oku Kazuho @ Cybozu Labs n サーバサイドで Java. Script の単体テスト n JSAN の Test. Simple を Windows Scripting Host (WSH) に移植 n. Test-Simple-WSH. patch nruntests. js n Windows のコマンドプロンプトで Java. Script ライブラリのテストが動く > cscript. exe runtests. js testsrc. js 2006/06/30 #02 32
Oku Kazuho @ Cybozu Labs n JSAN-ASP. patch n ASP で JSAN を使うパッチ (2006/3/24) <script language="Java. Script" src="JSAN. js" runat="server"></script> <script language="Java. Script" runat="server"> JSAN. use("Digest. MD 5", ": all"); Response. write(md 5 Hex("hello")); </script> 2006/06/30 #02 33
サンプルプログラム n hello. asp <%@ Language=Java. Script %> <% var hello = "Hello world"; %> <html> <head> <title><%= hello %></title> </head> <body> <h 1><%= hello %></h 1> </body> </html> 2006/06/30 #02 38
実行処理系のベンチマーク CPU: Pentium 4 3 GHz OS: RHEL 4 Update 3 (Linux 2. 6. 9 -34) JS は Spider. Monkey を DEBUG モードでビルド JS(OPT=1)は Spider. Monkey を BUILD_OPT=1 でビルド 2006/06/30 #02 39
プロジェクト AJAJA(仮称) Java. Script/ASP デモ 2006/06/30
[ソース] 2006/06/30 #02 41
デモ製作:haltさん n Java. Script/ASP demo – Simple BBS 2006/06/30 #02 42
Yet Another Demo 2006/06/30 #02 43
2006/06/30 #02 46
2006/06/30 #02 47
function BF(str){ this. code = []; this. output = []; this. input = []; this. data = []; this. pc = this. sp = 0; this. debug = 0; this. step = function(){ var op = bf. code[this. pc]; if (bf. debug){ document. writeln([op, bf. sp, bf. pc]. join(", ")); } switch (op) { case '<' : bf. sp--; break; case '>' : bf. sp++; break; case '+' : if(!bf. data[bf. sp]) bf. data[bf. sp] = 0; bf. data[bf. sp]++ ; break; case '-' : if(!bf. data[bf. sp]) bf. data[bf. sp] = 0; bf. data[bf. sp]--; break; case '. ' : bf. output. push(bf. data[bf. sp]) ; break; case ', ' : bf. data[bf. sp] = bf. input. shift() ; break; case '[' : if (bf. data[bf. sp]) break; nest = 1; while(nest){ bf. pc++; nest += bf. code[bf. pc] == '[' ? +1 : bf. code[bf. pc] == ']' ? -1 : 0; } break; case ']' : nest = 1; while(nest){ bf. pc--; nest -= bf. code[bf. pc] == '[' ? +1 : bf. code[bf. pc] == ']' ? -1 : 0; }; #02 bf. pc--; 2006/06/30 48
Brainf*ck への応用 n. /Brainfuck. js n function BF(str)の定義 n. /demo. asp n クライアントサイド n<script src=“Brainfuck. js”></script> n サーバサイド n<% use(‘Brainfuck’) %> 2006/06/30 #02 49
To. Do やりたい事 2006/06/30
近日公開予定 http: //ajaja. alphageek. jp 2006/06/30 #02 53
- Slides: 55