Google App Engineä¸ã§Rubyã¢ããªãåããæé
åç½®ã
Google App Engine(以ä¸GAE)ã§ã¯ãå ¬å¼ã«ã¯ç¾å¨ã®ã¨ããPythonã¨Javaãããµãã¼ãããã¦ãã¾ããããJRubyã¨ããç´ æ´ããããããã¯ãã®ãããã§Java VMä¸ã§Rubyã¹ã¯ãªãããå®è¡ã§ãããããèãããã«ãã£ã¦ã¯Rubyãæ¢ã«ãµãã¼ã対象ã«ãªã£ã¦ããã¨è¨ããªããããã¾ããã
å®éã«ググってみてもæ¢ã«çµæ§ãªéã®æ å ±ãåå¨ããã®ã§ãããã©ããJRuby on Railsã対象ã¨ããæ å ±ãå¤ããç´ ã®Rubyã¢ããªã±ã¼ã·ã§ã³ãåããããã®æ å ±ããã¾ãç¡ãããã«æãã¾ããã
Railsããã¡ããåªãããã¬ã¼ã ã¯ã¼ã¯ãªã®ã§ãããã¡ãã£ã¨ããã¢ããªã±ã¼ã·ã§ã³ãä½ãã®ã«ã¯å°ã ééãã¾ãããâ¦ã
ã¨ãããã¨ã§ãéRailsãªããã£ã¨ã·ã³ãã«ãªRubyã¢ããªãGAEä¸ã§åããããã®æé ã調ã¹ã¦ã¿ã¾ããã
ãã¤ã³ã
ä»åã¯ä»¥ä¸ã®åæã§ä½æ¥ãé²ãã¦ããã¾ãã
- Railsãªã©ã®Webã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ã¯ä½¿ç¨ããªãã
- Eclipseã使ããã«CUIã§ä½æ¥ããã
ç°å¢ã¯ãæå ã«ãã¾ãã¾ã¤ã³ã¹ãã¼ã«ããã¦ã®ãã®ããã£ãã¨ããçç±ã§ãCentOS 5.3ãé¸æãã¾ããã
Google App Engine for Javaç°å¢ã®æ§ç¯
GAEä¸ã§JRubyãåããã«ã¯ãå½ç¶ãªããGAEä¸ã§Javaã¢ããªãåä½ããç°å¢(Google App Engine for Javaã以ä¸GAEJ)ãå¿ è¦ã§ãã®ã§ãã¾ãã¯ä»¥ä¸ã®ãã¼ã¸ãåèã«ãGoogle App Engine SDK for Java(å¾è¿°)ã«ä»ãã¦ããJavaã®ãã¢ã¢ããªãåãããç°å¢ãä½ãã¾ãã
GAEä¸ã§åãJavaã¢ããªãéçºããããã«æä½éå¿ è¦ãªãã®ã¯ä»¥ä¸ã®äºã¤ã§ãã
- Java SE Development Kit (JDK)
- Google App Engine SDK for Java
JDKã®ã¤ã³ã¹ãã¼ã«
以ä¸ã®ãã¼ã¸ãããææ°çã®Linuxç¨JDK(jdk-6u14-linux-i586-rpm.bin)ããã¦ã³ãã¼ãããã¤ã³ã¹ãã¼ã«ãã¾ãã
ãã¦ã³ãã¼ããããã¡ã¤ã«ã¯ã·ã§ã«ã¹ã¯ãªããã«ãªã£ã¦ãã¾ãã®ã§ã
$ sudo sh jdk-6u14-linux-i586-rpm.bin
ã¨ããããã«å®è¡ãã¾ããå©ç¨è¨±è«¾ã«yesã¨çãã¦ãã°ããå¾ ã£ã¦ããã¨ã¤ã³ã¹ãã¼ã«ãå®äºãã¾ãã
ã¤ã³ã¹ãã¼ã«ãçµãã£ããã以ä¸ã®ç°å¢å¤æ°ãè¨å®ãã¦ããã¾ããBashã使ã£ã¦ããã®ã§ããã°.bashrcãããã«è¿½å ãã¦ããã¨è¯ãã§ãã
export JAVA_HOME=/usr/java/default export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
軽ããã¼ã¸ã§ã³ã®ç¢ºèªããã¦ããã¾ãã
$ java -version java version "1.6.0_14" Java(TM) SE Runtime Environment (build 1.6.0_14-b08) Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing)
$ javac -version javac 1.6.0_14
åé¡ç¡ãããã§ãã
Google App Engine SDK for Javaã®ãã¦ã³ãã¼ã
以ä¸ã®ãã¼ã¸ããGoogle App Engine SDK for Javaããã¦ã³ãã¼ãããé©å½ãªå ´æã«å±éãã¦ããã¾ãã*1
$ wget http://googleappengine.googlecode.com/files/appengine-java-sdk-1.2.1.zip $ unzip appengine-java-sdk-1.2.1.zip
ãã®æç¹ã§ãæ¢ã«ãã¼ã«ã«ã§GAEJã¢ããªã±ã¼ã·ã§ã³ãåä½ãããç°å¢ã¯æ´ãã¾ããã試ãã«ä»å±éããSDKå梱ã®ãã¢ã¢ããªãåããã¦ã¿ã¾ãã
$ appengine-java-sdk-1.2.1/bin/dev_appserver.sh --address=0.0.0.0 appengine-java-sdk-1.2.1/demos/guestbook/war The server is running at http://localhost:8080/
8080ãã¼ãã§ã¢ã¯ã»ã¹ãã¦ãguestbookã¢ããªã®ç»é¢ã表示ãããã°OKã§ãã*2
JRuby on GAEJç°å¢ã®æºå
ç¡äºGAEJç°å¢ãåºæ¥ã¾ããã®ã§ã次ã¯ãã®ä¸ã§JRubyãåä½ãããããã«å¿ è¦ãªãã®ãæºåãã¦ããã¾ãã
GAEJä¸ã§JRubyãåããã®ã«å¿ è¦ãªãã®ã¯ä»¥ä¸ã®äºã¤ã§ãã
jruby-complete.jarã®ä½æ
jruby-complete.jarã¯JRubyã®åä½ã®ããã«å¿ è¦ãªæ©è½ãå ¨ã¦è©°ãè¾¼ã¾ããã©ã¤ãã©ãªã§ããæ®éã«ããã±ã¼ã¸ããJRubyãã¤ã³ã¹ãã¼ã«ããå ´åã¯ä»ãã¦ãã¾ããã®ã§ãã½ã¼ã¹ããèªåã§ã³ã³ãã¤ã«ããå¿ è¦ãããã¾ãã
JRubyãã½ã¼ã¹ããã³ã³ãã¤ã«ããããã«gitã¨antãå¿ è¦ã«ãªãã¾ãã®ã§ãã¾ãã¯ããããç¨æãã¾ãã
gitã®ã¤ã³ã¹ãã¼ã«
以ä¸ã®ãã¼ã¸ãåèã«ãyumããããã±ã¼ã¸ã¤ã³ã¹ãã¼ã«ãã¾ãã
ãªãã¸ããªãäºã¤è¿½å ãã¾ãã
$ sudo vim /etc/yum.repos.d/git.repo
[git] name=Base git repository baseurl=http://www.kernel.org/pub/software/scm/git/RPMS/$basearch enabled=1 gpgcheck=0
$ sudo vim /etc/yum.repos.d/rpmforge.repo
[rpmforge] name = Red Hat Enterprise $releasever - RPMforge.net - dag mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge enabled = 0 gpgcheck = 0
以ä¸ã®ã³ãã³ãã§ã¤ã³ã¹ãã¼ã«ã§ãã¾ããææ°çã ã¨ä¾åæ§ã®ã¨ã©ã¼ãåºã¾ãã®ã§ããã¼ã¸ã§ã³ãæå®ãã¦ãã¾ãã
$ sudo yum install git-1.5.6.1-1 --enablerepo=rpmforge
antã®ãã¦ã³ãã¼ã
JRuby1.1以ä¸ã§ã¯Ant1.7以ä¸ãè¦æ±ããããããyumããããã±ã¼ã¸ã¤ã³ã¹ãã¼ã«ãããã®ã¯ä½¿ãã¾ããããªã®ã§ã公式サイトãããã¦ã³ãã¼ããããã®ã使ãã¾ãã
é©å½ãªå ´æã«å±éãã¦ããã°OKã§ããç¹ã«ã¤ã³ã¹ãã¼ã«ä½æ¥ãªã©ã¯å¿ è¦ããã¾ããã
$ wget http://ftp.riken.jp/net/apache/ant/binaries/apache-ant-1.7.1-bin.tar.gz $ tar xvzf apache-ant-1.7.1-bin.tar.gz
JRubyã½ã¼ã¹ã®åå¾ã¨ã³ã³ãã¤ã«
ã§ã¯JRubyã®ã½ã¼ã¹ãã³ã³ãã¤ã«ããjruby-complete.jarãä½æãã¾ãã
以ä¸ã®ããã«ã³ãã³ããå®è¡ãã¾ããå°ã æéããããããããã¾ããã
$ git clone git://kenai.com/jruby~main jruby $ cd jruby $ ../apache-ant-1.7.1/bin/ant jar-complete
ããã§jruby/libãã£ã¬ã¯ããªå
ã«jruby-complete.jarãã§ãã¾ãã*3
JRuby-Rackã®ãã¦ã³ãã¼ã
次ã«JRuby-Rackããã¦ã³ãã¼ããã¾ããããã®åã«ãJRuby-Rackãã©ããªç©ãã説æãã¦ããã¾ãã
GAEJã§ã¯Java サーブレット標準ã¨ããä»çµã¿ãå©ç¨ãã¦Webã¢ããªã±ã¼ã·ã§ã³ãä½æãã¾ããGAEJä¸ã§JRubyãåãããã¨æã£ãå ´åããµã¼ãã¬ããã¨JRubyã®æ©æ¸¡ããããé¨åã®Javaããã°ã©ã ãèªä½ããªãã¦ã¯ããã¾ããã
ããããããããããã¨ã«JRuby-Rackããã®é¢åãªé¨åãå ¨ã¦è«ãè² ã£ã¦ããã¾ãã
JRuby-Rackã¨ããã®ã¯ãRubyç¨ã«å ã åå¨ãã¦ããRackã¨ããã½ããã¦ã§ã¢ã®æ¡å¼µçã§ããRackã«é¢ãã説æã¯ä»¥ä¸ã®ãã¼ã¸ãåèã«ãªãã¾ãã
ä¸è¨ã§èª¬æããã¨ãWebãµã¼ãã¨Webã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ã®éã«æã¾ã£ã¦ãåã ã®éäºææ§ãå¸åãã¦ãããããã«ã¦ã§ã¢ã§ãã
JRuby-Rackã¯ãRackããµãã¼ããã¦ããWebãµã¼ãã«å ãã¦Javaãµã¼ãã¬ããããµãã¼ããã¦ããããããããå©ç¨ãããã¨ã§ããµã¼ãã¬ãããæèãããã¨ãªã楽ã«Webã¢ããªã±ã¼ã·ã§ã³ãæ¸ããããã«ãªãâ¦ã¨ããããã§ãã
ä»åã¯Webã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ã使ãã¾ããã®ã§ãã¢ããªã±ã¼ã·ã§ã³ããç´æ¥Rackã触ããã¨ã«ãªãã¾ããå°ã çãããã¾ãããè¦ãããã¨èªä½ã¯å°ãªãã§ãã®ã§ãå ã»ã©ã®ãã¼ã¸ã以ä¸ã®ãã¼ã¸ã«ãã£ã¨ç®ãéãã¦æè¦ãæ´ãã§ããã¨è¯ãããããã¾ããã
- ウノウラボ Unoh Labs: RackでWebアプリのWebサーバー依存を無くす
- 満足せる豚。眠たげなポチ。:CGI から Mongrel まで、Rack で Web アプリを Web サーバから抽象化する
- Greenbear Laboratory - Rack日本語リファレンス
ã§ã¯JRuby-Rackããã¦ã³ãã¼ããã¾ããç¹ã«ã¤ã³ã¹ãã¼ã«ä½æ¥ãªã©ãããå¿ è¦ã¯ãªããé©å½ãªå ´æã«ç½®ãã¦ããã°OKã§ãã
$ wget http://kenai.com/projects/jruby-rack/downloads/download/jruby-rack-0.9.4.jar
ãµã³ãã«ã¢ããªã±ã¼ã·ã§ã³ã®ä½æ
ãã¦ãããã¾ã§ã§JRuby on GAEJã¢ããªã«å¿ è¦ãªææã¯å ¨ã¦æãã¾ãããã¨ãããããç°¡åãªHello worldã¢ããªãä½æãã¦ã¿ã¾ãã
ã¾ãã¯ã¢ããªã±ã¼ã·ã§ã³ã®ãã¡ã¤ã«ãæ ¼ç´ãããã£ã¬ã¯ããªãä½ãã¾ããGAEJã§ã¯ãJavaãµã¼ãã¬ããè¦æ ¼ã§å®ããããéãã®é ç½®ã§ãã¡ã¤ã«ãåå¨ãã¦ããå¿ è¦ãããã¾ãã
$ mkdir sample-jruby-on-gaej $ cd sample-jruby-on-gaej $ mkdir -p WEB-INF/lib
ã¢ããªã±ã¼ã·ã§ã³ã®ããããã£ã¬ã¯ããªã«WEB-INFã¨ããååã®ãã£ã¬ã¯ããªãåå¨ãããã®ä¸ã«ã¢ããªã±ã¼ã·ã§ã³ã«å¿ è¦ãªãã¡ã¤ã«ãå ¨ã¦åã¾ã£ã¦ããªããã°ããã¾ããã
ä»ä½ã£ãlibãã£ã¬ã¯ããªã«ã¯ãããã¾ã§éãã¦ããJRuby on GAEJã®åä½ã«å¿ è¦ãª3ã¤ã®ãã¡ã¤ã«ãæ ¼ç´ãã¾ãã
$ cp ../appengine-java-sdk-1.2.1/lib/user/appengine-api-1.0-sdk-1.2.1.jar WEB-INF/lib $ cp ../jruby/lib/jruby-complete.jar WEB-INF/lib $ cp ../jruby-rack-0.9.4.jar WEB-INF/lib
ã¢ããªã±ã¼ã·ã§ã³æ¬ä½ã¯ã以ä¸ã®ãã¼ã¸ãåèã«ã"Hello world!"ã¨ãããã¬ã¼ã³ããã¹ããåºåããã ãã®ã·ã³ãã«ãªãã®ãæ¸ãã¾ããé ç½®å ´æã¯WEB-INFãã£ã¬ã¯ããªç´ä¸ã§ãã
$ vim WEB-INF/hello.rb
require 'rubygems' require 'rack' class HelloWorld def call(env) [ 200, { 'Content-Type' => 'text/plain' }, [ 'Hello world!' ] ] end end
è¨å®ãã¡ã¤ã«ã®ä½æ
æ´ã«ãGAEJã®åä½ã«ã¯äºã¤ã®è¨å®ãã¡ã¤ã«ãå¿ é ã¨ãªãã¾ãã以ä¸ã®ãã¼ã¸ãåèã«ãæä½éå¿ è¦ãªè¨å®ãæ¸ãã¦ããã¾ãã
- プロジェクトの作成 - Google App Engine - Google Code
- JRuby-Rack: Wiki: Home ― Project Kenai
- GettingStarted - appengine-jruby - Getting Started with JRuby on Google App Engine - Google Code
$ vim WEB-INF/appengine-web.xml
<?xml version="1.0" encoding="utf-8"?> <appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <application>sample-jruby-on-gaej</application> <version>1</version> <system-properties> <property name="jruby.management.enabled" value="false" /> <property name="os.arch" value="" /> </system-properties> </appengine-web-app>
$ vim WEB-INF/web.xml
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5"> <context-param> <param-name>public.root</param-name> <param-value>/</param-value> </context-param> <context-param> <param-name>rackup</param-name> <param-value> require 'hello.rb' run HelloWorld.new </param-value> </context-param> <filter> <filter-name>RackFilter</filter-name> <filter-class>org.jruby.rack.RackFilter</filter-class> </filter> <filter-mapping> <filter-name>RackFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.jruby.rack.RackServletContextListener</listener-class> </listener> </web-app>
ãµã³ãã«ã¢ããªã±ã¼ã·ã§ã³ã®åä½ç¢ºèª
ããã¾ã§ã§ã¢ããªã±ã¼ã·ã§ã³ã®åä½ã«å¿ è¦ãªãã¡ã¤ã«ã¯ä¸éãæãã¾ããã
試ãã«ãã¼ã«ã«ã§èµ·åãã¦ããã¡ãã¨åããã¨ã確ããã¦ã¿ã¾ãã
$ ../appengine-java-sdk-1.2.1/bin/dev_appserver.sh --address=0.0.0.0 . The server is running at http://localhost:8080/
dev_appserver.shã®æå¾ã®å¼æ°ã«ã¯ã¢ããªã±ã¼ã·ã§ã³ã®ããããã£ã¬ã¯ããª(WEB-INFã®è¦ªãã£ã¬ã¯ããª)ãæå®ãã¾ãã
8080çªãã¼ãã§ã¢ã¯ã»ã¹ãã¦"Hello world!"ã表示ããããæåã§ãã
ã¤ãã§ã§ãã®ã§ãå
ã»ã©ã®hello.rbãè²ã
æ¸ãæãã¦ã¿ã¦ã確ãã«Rubyã¹ã¯ãªãããåãã¦ããã®ã ã¨ãããã¨ã確èªãã¦ã¿ã¾ãã*4
require 'rubygems' require 'rack' class HelloWorld include Rack::Utils # Rack::Utils.escape_htmlãç°¡åã«ä½¿ããã def call(env) req = Rack::Request.new(env) res = Rack::Response.new res.write '<html><head><title>Sample of JRuby on GAEJ</title></head><body>' # ããã¤ãåºæ¬çãªæ å ±ã表示 res.write '<h2>Ruby version</h2>' res.write "<p>#{RUBY_VERSION}</p>" res.write '<h2>Platform</h2>' res.write "<p>#{RUBY_PLATFORM}</p>" res.write '<h2>Load paths</h2>' res.write '<ul>' res.write $:.map { |path| "<li>#{escape_html(path)}</li>" }.join res.write '</ul>' # POSTãã©ã¡ã¼ã¿ã®ä¸è¦§ã表示 res.write '<h2>Posted parameters</h2>' res.write '<dl>' req.params.each_pair do |key, value| res.write "<dt>#{escape_html(key)}</dt><dd>#{escape_html(value)}</dd>" end res.write '</dl>' # ç°å¢å¤æ°ã®ä¸è¦§ã表示 res.write '<h2>Environment variables</h2>' res.write '<dl>' req.env.each_pair do |key, value| res.write "<dt>#{escape_html(key)}</dt><dd>#{escape_html(value)}</dd>" end res.write '</dl>' res.write '</body></html>' res.finish end end
ä»ã®ã¨ããRubyã¹ã¯ãªãããæ¸ãæããããµã¼ããåèµ·åããå¿ è¦ãããï¼ããã§ãã®ã§ãå ã»ã©ç«ã¡ä¸ããdev_appserver.shãCtrl+Cã§ä¸æ¦çµäºããå度å®è¡ãã¾ãã
åãããã«ãã¼ã«ã«ã®8080çªã«ã¢ã¯ã»ã¹ãã¦ã¿ãã¨ãè²ã ã¨æ å ±ãåæãããã¯ãã§ãã
ã¢ããªã±ã¼ã·ã§ã³ã®ã¢ãããã¼ã
ãã¨ã¯ãã®ã¾ã¾ãã®ã¢ããªã±ã¼ã·ã§ã³ãGAEä¸ã«ã¢ãããã¼ãããã°ãä¸çä¸ããã¢ã¯ã»ã¹å¯è½ãªWebã¢ããªã®å®æã§ãã
å½ç¶GAEã®ã¢ã«ã¦ã³ããåå¾ãã¦ããã¤GAEJã使ç¨å¯è½ãªç¶æ ã«ãªã£ã¦ããªããã°ãªãã¾ããã*5
ã¢ãããã¼ãã¯ä»¥ä¸ã®ã³ãã³ããå®è¡ããã ãã§ãã*6éä¸ã§Googleã¢ã«ã¦ã³ãã¨ãã¹ã¯ã¼ããèããã¦ãã¾ãã®ã§å ¥åãã¾ãã
$ ../appengine-java-sdk-1.2.1/bin/appcfg.sh --enable_jar_splitting update .
æå¾ã®å¼æ°ã«ã¯å ã»ã©ã¨åæ§ã«ã¢ããªã±ã¼ã·ã§ã³ã®ããããã£ã¬ã¯ããªãæå®ãã¾ãã
GAEのダッシュボードã§æ£ããã¢ãããã¼ãããã¦ãããã¨ã確èªãã表示ããã¦ããURLã«ã¢ã¯ã»ã¹ãã¦ã¿ã¾ããå ã»ã©ã®ãã¼ã«ã«ã§ã®ãã¹ãã¨æ¯è¼ãã¦ã$LOAD_PATHãªã©ã®å¤ãç°ãªã£ã¦ãããã¨ãè¦ã¦ã¨ããã¨æãã¾ãã
JRuby on GAEJã¢ããªã®ãã³ãã¬ã¼ã
ããã¾ã§ã§JRuby on GAEJã¢ããªã®ä½ãæ¹ã¯ä¸éãå®äºã§ããæã£ããããä½æ¥éãå¤ãã¦ç²ãã¦ãã¾ãã¾ããâ¦ã
ããããããããæé ãè¦è¿ãã¦ã¿ãã¨ã大å¤ã ã£ãã®ã¯ä¸»ã«å¿ è¦ãªã©ã¤ãã©ãªã®æºåã§ããããã¾ãã¢ããªã±ã¼ã·ã§ã³èªä½ãæ¬ä½ã®ãã¡ã¤ã«(ä»åã®å ´åã¯"hello.rb")以å¤ã¯ã»ã¼å®åã§ããããã®ã¾ã¾ä½¿ãã¾ãããã¨ãã§ãããã§ãã
ã¨ãããã¨ã§ãJRuby on GAEJã¢ããªã®éå½¢ã¨ãã¦ä½¿ããããã±ã¼ã¸ãä½æãã¾ããã
ã¨ãã£ã¦ããä¸ã®Hello worldã¢ããªãtarãã¼ã«ã«ããã ãã§ããJRubyãJRuby-Rackã¯å梱ããã¦ãã¾ãã®ã§æ¹ãã¦æºåããå¿ è¦ã¯ããã¾ããããJDKã¨Google App Engine SDK for Javaã¯å¥éã¤ã³ã¹ãã¼ã«ãã¦ããã¦ãã ããã
ã¾ããå°æ¥çã«GAEãSDKã®ã¢ãããã¼ãã«ãã£ã¦ä½¿ããªããªãå¯è½æ§ãããã¾ãã®ã§ããã®ç¹ããäºæ¿ä¸ããã
使ãæ¹ã¨ãã¦ã¯ã
- å±éãã¦
- WEB-INF/hello.rbã好ããªããã«æ¸ãæãã¦
- WEB-INF/appengine-web.xmlã®applicationã¿ã°ã¨versionã¿ã°ã®å¤ãé©åã«è¨å®ãã¦
- GAEã¸ã¢ãããã¼ã(ã¾ãã¯ãã¼ã«ã«ã§ãã¹ãèµ·å)
ããã ãã§ãã
ããç°¡åãªWebã¢ããªãªããããã§ã¨ããããã¯æ¸ããããï¼
ããå°ãæ¬æ ¼çãªã¢ããªã±ã¼ã·ã§ã³ã®ä½æ
ã¨ã¯è¨ããç¾ç¶ã®ã¾ã¾ã§ã¯ã§ãããã¨ã貧弱ã§ãã
JRuby on GAEJã¢ããªã¯ãGAEã®ãµã³ãããã¯ã¹å ã§åä½ããé¢ä¿ä¸ãæ§ã ãªæ©è½çå¶éãããããã¦ãã¾ãã
ä¾ãã°ãã¡ã¤ã«ã¸ã®ã¢ã¯ã»ã¹ãç¦æ¢ããã¦ãã¾ãããnet/httpã使ãã¾ããã®ã§HTTPçµç±ã§ä»ã®ãªã½ã¼ã¹ãåå¾ãããã¨ãã¾ã¾ãªãã¾ããã
ãããããããã®å¶éãããæ©è½ãè£ãããã«ãGAEç¬èªã®ã¤ã³ã¿ã¼ãã§ã¼ã¹ãç¨æããã¦ãã¾ãã®ã§ãããã使ããã¨ã§ãã¯ãã«ãªWebã¢ããªã±ã¼ã·ã§ã³ãä½æãããã¨ãå¯è½ã§ãã
GAEJã§æä¾ããã¦ããã®ã¯å½ç¶Javaã¸ã®ã¤ã³ã¿ã¼ãã§ã¼ã¹ã¨ãªãã¾ãããJRubyãããããã使ããããã«ãã¦ãããã©ããã¼ã©ã¤ãã©ãªãããã¤ãä½æããã¦ãã¾ãã
以ä¸ã®ãã¼ã¸ã«ããã¨ãDBã¸ã®ã¢ã¯ã»ã¹ãã¢ã«ã¦ã³ãæ å ±ã®åå¾ãç»åå¦çãã¡ã¼ã«ãµã¼ãã¹ã®å©ç¨ãURLãã§ãããªã©ããã¼ããæ©è½ã¯ä¸éãJRubyãããå©ç¨ã§ããããã§ãã
次å*7ã¯ããããã®ã©ã¤ãã©ãªãå©ç¨ãã¦ãJRuby on GAEJä¸ã§åä½ããç°¡åãªTwitter BOTä½ãã«ææ¦ãã¦ã¿ããã¨æãã¾ãã*8
*1:è±èªçã®ã»ãããã¼ã¸ã§ã³ãæ°ããå ´åãããã¾ãã®ã§ãä¸åº¦è±èªçã®ãã¼ã¸ããã§ãã¯ããã»ããæéãããããªãã¦æ¸ã¿ã¾ãã
*2:端æ«ã¨éçºç°å¢ãåä¸çä½ã®å ´åã¯"--address=0.0.0.0"ãªãã·ã§ã³ã¯ä¸è¦ã§ãã
*3:å°ãå¤ãè³æã§ã¯ããã®ãã¨æ´ã«ã©ã¤ãã©ãªãåå²ããæé ã説æããã¦ãã¾ãããç¾å¨ã®GAEã§ã¯ãã®ä½æ¥ã¯å¿ è¦ããã¾ããã
*4:Rack::Response#finishã¯æ¬æ¥ãããã¯ã使ã£ãæ¸ãæ¹ãã§ããã®ã§ãããä½æ ãæå ã®ç°å¢ã§ã¯ãããã¯ã渡ãã¦ä½¿ãã¨æ£ããæ¬æãã¼ã¿ãè¿ãã¦ãããªãã®ã§ãä»æ¹ãªãå°ã æ ¼å¥½æªãæ¸ãæ¹ããã¦ãã¾ãã
*5:ãã®è¾ºã¯ã°ã£ããçç¥ãã¾ãã
*6:ãã®--enable_jar_splittingãªãã·ã§ã³ã®ãããã§ãjruby-complete.jarãã¡ã¤ã«ã®åå²ãä¸è¦ã«ãªã£ã¦ããããã§ãã
*7:ãããã¯è¿ãæªæ¥â¦ãããã¯é ãæªæ¥
*8:Webã¢ããªãããªãï¼ãã¾ãããããï¼ç¥ï¼