Browser Teeda.Ajax.Servlet TaskAjaxImpl#add Service / DAO
20
Browser Teeda.Ajax.Servlet TaskAjaxImpl#add Service / DAO
JSON生成
(JSON-Lib) TaskHelper
21
Browser Teeda.Ajax.Servlet TaskAjaxImpl#add Service / DAO
JSONをレスポンス
TaskHelper
22
new Ajax.Request(
Tugboat.AJAX_SERVLET_NAME,
{
method: Tugboat.constant.REQUEST_POST,
parameters:
{
component :'taskAjax
'taskAjax',
action :'add
'add',
Browser Teeda.Ajax.Servlet TaskAjaxImpl#add Service / DAO
activityId :1,
title :'Title',
description:'Description'
},
onComplete: function(transport){
Eval関数を実行し、 eval(transport.responceText);
json = eval(transport.responceText);
}
TaskHelper
Objectを生成 }
);
23
var list =
LI({'id':ID_PREFIX + t.id, 'class':'default'},
LI
DIV({'class':blockStyle.class_name},
DIV
[
function() {
var folderDiv =
(TugboatUI.DragBox.selectedFolderId != 'folder_all')
? DIV
DIV({'class': 'class_icon'})
: DIV
DIV({'class': t.classId == 1 ? 'class_icon today' :
t.classId == 2 ? 'class_icon week' :
t.classId == 4 ? 'class_icon hold' :
t.classId == 5 ? 'class_icon Service / DAO
someday'
Browser Teeda.Ajax.Servlet TaskAjaxImpl#add
: 'class_icon'
});
return folderDiv;
},
DIV({'class':'activity_icon a_'+t.activityColor}),
DIV
DIV({'class': 'status'}),
DIV
MochiKIT (JS-lib) P({'class':'title'}, t.title),
TaskHelper
P({'class':'due'}, t.due == '' ? 'N/A' : t.due),
を使用してDOMを
P({'class':'personInCharge'}, t.isMe ? '[Me]' : t.personInCharge)
生成 ]
)
);
24
<< 結果 >>
<div class=\"task today_todo\">
div
<div class=\"class_icon\"/>
div
<div class=\"activity_icon a_00ff00\"/>
div
<div class=\"status\"/>
div
<p class=\"title\">
p
<span
span>test123</span>
span
<a href=\"javascript:void(0);\">test123</a>
a
Browser Teeda.Ajax.Servlet TaskAjaxImpl#add Service / DAO
</p>
<p class=\"due\">N/A</p>
p
<p class=\"personInCharge\">[Me]</p>
p
</div>
MochiKIT (JS-lib)
TaskHelper
を使用してDOMを
生成
25
Architecture
Tugboat.GTD Web Application Tugboat.GTD RESTful Web Services
Client
View
( Ruby )
Presentation RESTful Web Service
Service Service
(Business Logic) (Business Logic)
DAO DAO
Resource Resource
37
What's REST?
38
Task id = 1
39
Task id = 1
http://tugboat-gtd.sandbox.seasar.org/tasks/1
40
Task id = 1
http://tugboat-gtd.sandbox.seasar.org/tasks/1
GET index.html HTTP/1.1
Host: tugboat-gtd.sandbox.seasar.org
41
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Task id = 1
http://tugboat-gtd.sandbox.seasar.org/tasks/1
GET index.html HTTP/1.1
Host: tugboat-gtd.sandbox.seasar.org
42
:
Action : SQL:HTTP Verb
Action SQL HTTP
Create Insert POST
Read Select GET
Update Update PUT
Delete Delete DELETE
URIで表されるリソースに対して各種HTTPメソッドを発行しCRUDを実行
44
HTTP Verb : Status
成功 失敗
Status Code 内容 Status Code 内容
ATOM | RSS Not found
200 404
GET
作成された Already exits
201 406
POST
リソースのURI Validate error
406
Not found
200 (204) N/A 404
PUT
Validate error
406
Not found
DELETE 200 N/A 404
45
HttpRequest
Incl. X-WSSE
Client RESTful Web Services
Servlet
( Ruby )
HTTP Method [GET
GET]
GET
http://127.0.0.1/tugboatGTD/rest/tasks/1
tasks/1
56
HTTP Method
URI Parse
Client RESTful Web Services
RESTful Web Service
Servlet
( Ruby )
HTTP Method [GET
GET]
GET
http://127.0.0.1/tugboatGTD/rest/tasks/1
tasks/1
Servlet Mapping
57
HTTP Method
URI Parse
Client RESTful Web Services
RESTful Web Service
Servlet
( Ruby )
HTTP Method [GET
GET]
GET
http://127.0.0.1/tugboatGTD/rest/tasks/1
tasks/1
‘ Get task by id == 1’
59
0 comments
Post a comment