GoogleAppEngineOil 0.1安定板 0.2アップデート

ようやくベータが外れ、GoogleAppEngineOil(GAEO)のバージョン0.1の安定板リリースされています。

更に進行中の0.2には次のような機能が追加されています。

1. respond_toサポート

ルーティングルールに r.connect(‘:controller/:action/:id.:format’)と書くことで、次のようにrespond_toメソッドを利用できます。

[code]
self.respond_to(
html=lambda: self.render('<h1>Hello World</h1>'),
js=lambda: self.render(script='alert("hello, world")')
)
[/code]

http://www.example.com/foo/bar.htmlの場合は<h1>Hello World</h1>の行をhttp://example.com/foo/bar.jsの場合はjavascriptの行を実行させることができます。

2. XHRリクエスト判別

GAEOはX-Requested-WithをつかってXMLHttpRequestオブジェクトによってリクエストされたか調べます。

self._is_xhrでTRUE/FALSEを判別できます。

3. renderメソッドにscriptタイプ追加

self.render(script=”alert(‘!’”)のようにして、text/javascriptデータを送信できます。

4. RESTメソッド

self._request_methodを使用して’get’, ‘put’, ‘head’などのリクエストメソッドを判別できます。

Railsにできるだけ近づこうとしているのでしょうか。今後ともGAEO楽しみです。

This entry was posted in Article (記事) and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>