More Related Content
PDF
PPT
PPT
PPS
PPT
PPT
PPS
I N D I G N A N T E N O H A Y J U S T I C I A PDF
IBS International Builders Show 2009, Las Vegas, NV Viewers also liked
PPT
PPT
B O D Y B O A R D F R I E N D S S H O W PDF
Fluffy Puffy Cloud Pets App Engine Meetup PPT
PDF
Mobile Marketing Platform v.4 KEY
PPT
PPT
PDF
Some tips for your presentation PPT
ZIP
The Chronicles of Web Standard III: The Voyage of the HTML5 PPT
PPT
PPT
12 ways to use an i pad at an open house PDF
PPT
PDF
Het open source paradigma ontleed PPT
PPT
Limits At Infinity 12.14.07 PPT
Similar to Cubby 2008-09-06
PPT
PPT
PPT
OSC2008 Tokyo/Spring REST勉強夜会 PDF
PPT
PDF
20080327 ku-librarians勉強会 #98:データベースからデータだけをいただく方法(web api入門) PDF
PPTX
PDF
PDF
Example of exiting legacy system PPT
PDF
リソースモデリングパターンの提案 #sendagayarb PDF
PDF
CloudSpiral 2014年度 Webアプリ講義(1日目) PDF
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails (増補日本語版) PDF
Cassandraのトランザクションサポート化 & web2pyによるcms用プラグイン開発 KEY
PPTX
Glassfish勉強会(JavaEE6について) PDF
PDF
Cubby 2008-09-06
- 1.
- 2.
自己紹介 縣俊貴 (id:agt)株式会社ヌーラボ SI - アジャイル開発のヌーラボ Web サービス プロジェクト管理ツール Backlog Seasar S2Pager/S2XML-RPC/ Cubby WEB+DB PRESS 連載:良いコードへの道 Seasar Conference 2008 Autumn - 3.
アジェンダ 私が Cubbyを作った理由 Cubby の RESTful サポート アプリ作成のデモ 今後のロードマップ Seasar Conference 2008 Autumn - 4.
- 5.
- 6.
Web フレームワーク 戦国時代Struts WebWork2 S2JSF Teeda Ruby on Rails etc… Seasar Conference 2008 Autumn - 7.
- 8.
- 9.
ぴったりなもの JSP 嫌われ者だけど、そんなにみんな嫌いなの?HTML テンプレートって、意外とつらくない? JSP2.0 JSTL/ ファンクション / シンプルタグ / タグファイル / クール URI 直感的に楽に使いたい 自由度は最大限に 設定ファイルレス ただし、わかりにくくなってはだめ Seasar Conference 2008 Autumn - 10.
- 11.
- 12.
- 13.
Seasar Conference 2008Autumn 今ではいろいろと おもしろいサービスに 使われはじめています。 http://tophatenar.com/ http://www.choistudy.jp/ http://hatenarmaps.com/ - 14.
- 15.
- 16.
2 種類の RESTAPI としての REST システム外部公開用の API GET/POST/PUT/DELETE による操作 AtomPP/XML/Json/XHTML などによるデータ構造 RESTful な Web アプリケーション Cool URI GET/POST HTML/XHTML によるデータ構造 Seasar Conference 2008 Autumn - 17.
- 18.
RESTful な Webアプリケーションの嬉しさ 将来的にバックエンドのシステムが変わっても、 URI が変更されない 拡張子なし URI がリソースごとに階層化されていて整理されているので、気持ちいい。 /{ ユーザ名 }/{ タグ } パッケージ名などと同じ Seasar Conference 2008 Autumn - 19.
Cubby 以前 #httpd.confRewriteRule ^\/users\/([0-9]+)? /user.do?userId=$1 mod_rewrite URLRewriteFilter <rule> <from>users/(.*)$</from> <to type="forward">user.do?useId=$1</to> </rule> Seasar Conference 2008 Autumn - 20.
Cubby 以前 URLRewriteFilterStruts など http://example.com/users/agt ・設定ファイルが2つの FW に分散 ・論理的な URI が2つあると、大変 Seasar Conference 2008 Autumn /user.do?userId=agt - 21.
Cubby では? Cubbyhttp://example.com/users/agt ・設定はアクションクラスに一元化 ・処理の近くに設定があるのでわかりやすい @Path(“/users/{userId}”) Seasar Conference 2008 Autumn - 22.
@Path @Path(“todo”) // TodoAction の場合省略可 public class TodoAction extends Action { // /todo/new public ActionResult new() { … } // /todo/save @Path(”save") public ActionResult post() { … } } Seasar Conference 2008 Autumn - 23.
@Path (パステンプレート) @Path(“todo”) // TodoAction の場合省略可 public class TodoAction extends Action { public String id ; // /todo/{id} @Path(”{id}") public ActionResult index() { System.out.println(id); } } Seasar Conference 2008 Autumn - 24.
Cubby でエコ URI貴重な URI をエコに利用する仕組み 正規表現 優先度 リクエストメソッド Submit されたボタンによる振り分け Seasar Conference 2008 Autumn - 25.
正規表現を使った 柔軟な URI指定 @Path(”/todo/ {id} ”) -> [a-z][A-Z][0-9]+ 「 /todo/0fabd3f 」にマッチ @Path(”/todo/ {id,[0-9]+} ”) 「 /todo/10001 」にマッチ Path(”/icon/ {width,[0-9]+} x {height, [0-9]+} . {ext,png|jpg} ”) 「 /icon/100x200.png 」にマッチ Seasar Conference 2008 Autumn JSR-311 の仕様も だいたい同じ! - 26.
優先度 @Path(”/todo/ {id}”) ( デフォルト値: priority=Integer.MAX_VALUE) @Path(value=”/todo/ list ”, priority=0) /todo/ list のほうが優先される Seasar Conference 2008 Autumn - 27.
リクエストメソッド import staticorg.seasar.cubby.action.RequestMethod.*; @Accept(GET) public ActionResult index() { … } @Accept(POST) public ActionResult add() { … } @Accept(PUT) public ActionResult update() { … } @Accept(DELETE) public ActionResult delete() { … } Seasar Conference 2008 Autumn - 28.
URI マッピングの確認 コンソールログ管理サーブレット アクションメソッドを登録します [regex=^/todo/$,method=public org.seasar.cubby.action.ActionResult org.seasar.cubby.examples.todo.action.TodoListAction.index(),uriParameterNames=[],requestMethod=GET,onSubmit=null,priority=2147483647,auto=true] … Seasar Conference 2008 Autumn - 29.
Path to EntityRESTful の場合、パステンプレートの変数とエンティティの変換だらけ /agata/entries/123 name=‘agata’ の Account id=123 の Entry Conveter リクエストパラメータの変換機構 Seasar Conference 2008 Autumn - 30.
Converter の作成 SeasarConference 2008 Autumn public AccountConverter extends AbstractConverter { public AccountDao accountDao; public Class<?> getObjectType() { return Account.class; } public Object convertToObject(Object value, Class<?> objectType, ConvertionHelper helper) { if (value == null) { return null; } String name = String.class.cast(value); return accountDao.findByName(name); } public String convertToString(Object value, ConvertionHelper helper) { Account account = Account.class.cast(value); return account.getName(); } } 文字列 (agata) ↓ 変換処理 Entiy(Account) Entiy(Account) ↓ 変換処理 文字列 (agata) - 31.
Converter を使用した Action/agata/entries/123 Seasar Conference 2008 Autumn public EntryAction extends Action { @RequestParameter public Entry entry ; @RequestParameter public Account account ; @Path(“/ {account} /entries/ {entry} ”) public ActionResult index(){ … } } Converter で 自動変換! - 32.
その他 Cubby の特徴設定ファイルレス Maven2 による雛形作成 直感的なカスタムタグ プログラムで書く Validation 続きはドキュメントで! Seasar Conference 2008 Autumn - 33.
- 34.
- 35.
- 36.
1. プロジェクトの作成 SeasarConference 2008 Autumn mvn archetype:generate -DarchetypeCatalog=http://cubby.seasar.org cd wiki mvn eclipse:eclipse - 37.
2. 各種設定 SeasarConference 2008 Autumn ・ WTP Server 登録 ・ jdbc.dicon ・ s2jdbc.dicon - 38.
- 39.
今後のロードマップ 2008 年2 月 Ver1.0 基本機能提供 2008 年 8 月 Ver1.1 実践的機能の充実 2009 年 Ver2.0 他のコンテナ (Spring, Guice) 対応 Archetype の機能追加 プロジェクトの立ち上げをもっと便利に Scaffold Extenstion 今風アプリ作成のサポート Flash による進捗バー付きのファイルアップロードダイアログなど Seasar Conference 2008 Autumn - 40.
まとめ Cubby はRESTful な Web アプリケーション開発を助けるシンプルなフレームワークです。 クールな Web サービスから業務アプリまで。 まずは触ってみてください。 チュートリアルやサンプルから。 要望・フィードバックは ML まで。 Seasar Conference 2008 Autumn - 41.