『Webを支える技術』学習メモ
Part1 Web概論
Ch01 what's Web
- Webの作用
- 非線形なhyper media @Web
- distributed system @Web
- simple protocol
Ch02 Web history
- Web以前のhyper media
- hyper media: hyper textの拡張
- 必要最小のリンク機能のみ持つWeb
- RPC, CORBA, DCOM
- Web以前のdistributed systemの問題
- Webの起源
- simpleな単方向リンク
- client-server間のIF.simple protocolとしてのHTTP
- IETF→W3Cでのstandardize
- especially HTML, CSS
- Webのstandardize
- RESTの起源,意味
- HTTPはresourceのstateの表現を転送している
- REpresentational State Transfer
- Hyper Media Format: HTML, RSS, Atom, microformat, JSON
- RESTの起源,意味
- Web API
- SOAP @RPC/distributed object
- WS-*
- mashupのためのREST
- SOAP @RPC/distributed object
- REST, Ajax, CometによるWebの進化
Ch03 REST: Web architecture style
概要
- architecture style: architecture pattern
- e.g. MVC, Pipe&Filter, Event System
- architecture style > micro architecture pattern(design pattern) @粒度
- architecture styleをもとに,architectureを決定する
内容
- REST: network systemのarchitecture style
- Web: client/server style
- REST: client/server + 制約
抽象度 | Webでの例 |
---|---|
architecture style | REST |
architecture | browser, server, proxy, HTTP, URI, HTML |
implement | Apache, Firefix, IE |
詳細
- resource: Web上の名前を持ったあらゆる情報
- resource name, identifier: URI
- addressability
- URIによってresourceが表す情報にアクセス
- client-server間でやり取りするdata: resourceの表現
- 1つのresourceは複数表現を持てる
- e.g. html, pdf
- 1つのresourceは複数表現を持てる
- addressability
- RESTの構成
- RESTは複数のarchitecture styleを組み合わせて構築した複合architecture
- a.client-server
- Web: httpでclient-serverが通信するというarchitecture style
- merit: client-serverを分離できる
- multi platform @client + serverの冗長化で可用性UP
- b.stateless server
- clientのapplicationのstateは管理しない
- c.cache
- resourceをclient側で再利用
- d.統一IF
- 統一IFにより,client-server間の独立性を高める
- GET, POSTなど限定的なmethodのみを持つ
- 統一IFにより,client-server間の独立性を高める
- e.階層化system
- 統一IFにより,load balancerやproxyを使用したsystemの階層化が容易になる
- f.code ondemand
- a-fを組み合わせたarchitecture styleがREST
- REST以外のarchitecture style: P2P
- RESTの2つの側面
- RESTとHypermedia
- resourceをリンクで接続することで1つのapplicationを構成する
- 接続性: RESTの基幹をなす
- RESTとdistributed system
- linkをたどってapplication stateを遷移することで性能劣化を抑える.
- 統一IFにより互換の問題が起こらない.
作用
- RESTというdistributed network systemのための理論により,Webが機能する
- RESTの制約に従っていること: RESTful
Part2 URI
Ch04 URIの仕様
目的
- URI: Uniform Resource Identifier
- resourceを統一的に識別するID
概要
詳細
まとめ
Ch05 URI design
目的
概要
詳細
- Cool URI
- usability高まる
- URIの変更のためのredirect
- 拡張子でresourceの表現を特定
- 言語を指定する拡張子
- → Content Negotiationのためのbrowserの設定不要
影響
Part3 HTTP
Ch06 HTTPの基本
目的
- TCP/IPの基礎とHTTPの歴史を見る
- HTTPは以下のRESTの重要な特徴を実現する,Webの基盤となるprotocol
- 統一IF
- stateless server
- cache
概要
- TCP/IPの観点
- 階層型protocol → 層ごとに抽象化して実装
- application layer
- transport layer
- internet layer
- IPでpacket単位でdataをやり取り.IPに相当.
- 自分のnetwork IFでのdata送信の保証
- network IF層
- 物理的な部分
- 階層型protocol → 層ごとに抽象化して実装
詳細
- HTTP history
- client-serverのarchitecture style
- client ≒ user agent
- request-response型のprotocol
- @client, @server
- HTTP message: request-response message
- request messageの構成
- request line
- method, request URI, protocol version
- header
- body
- request line
- response messageの構成
- status line
- header
- body
- request messageの構成
- stateless HTTP
- application state = session state
- statefulの欠点
- client増 → scaleout difficult
- statefulの欠点
- stateless の利点
- 自己記述的messageでscaleout easy
- statelessの欠点
- performance down
- data量,冗長(認証など)
- 通信エラー
- performance down
- application state = session state
作用
- simple HTTPにより,Web ServiceとWeb APIが同じprotocolで表現
Ch07 HTTP methods
目的
- 8 methodsのうち,主要な6つのmethodsの使い方を見る
- and, HTTPの設計上の工夫を見る
- method数が少ないからこそHTTPやWebは成功
概要
- HTTP methodsの観点
詳細
- methodの使用の観点
- POSTでPUT/DELETEを代用
- _method parameter
- X-HTTP-method-override header
- 条件付きrequest
- 冪等性(idempotence)と安全性
- idempotence: PUT, DELETE
- idempotence and safe: GET, HEAD
- どちらでもない: POST
- methodのproper use
- 他methodでできることにPOSTを使わない
- PUTの冪等なuse
- DELETEの冪等なuse
- POSTでPUT/DELETEを代用
作用
- 数少ないmethodによりprotocolをsimpleに保つ
- RESTの統一IFの実現
Ch08 status code
- 観点
- status line
- status codeの分類による意味
- client-server間を疎結合に
- 先頭の数字でclientが解釈
- よく使われるcode
- status codeとerror handling
- {protocol, Accept header}に従ったformatのerror
- status codeの設計
Ch09 HTTP header
目的
- HTTPの構成要素
- method
- status code
- header
- meta dataをstandardize
- 認証やcacheを実現
- history
- headerの成り立ち
- mailと共通の部分
- mailと異なり双方向
- headerの成り立ち
概要
- 観点
- GMTでのdate
- MIME: Multipurpose Internet Mail Extensions
- Content-Type
- charset → textのときの文字化け
- Content-Language: resource表現の自然言語
- Content Negotiation: client がrequest
- Accept
- Content Length
- chunk transfer @画像などを分割
- 認証: realmの値: URI空間
- cache
- cache用headerでcontrol
- 条件付きGET
- 持続的接続 @HTTP1.1でdefault
- pipeline化
- closeで切断
- その他のHTTP header
作用
- various 技術標準の組み合わせでheaderを構成する.十分な調査によりHTTP headerを扱える.
- authenticationやcacheなどのHTTPの重要な機能を実現
Part4 HyperMediaFormat
Ch10 HTML
- HyperMediaFormatとしてのHTMLを見る
Ch11 microformats
目的
- microformatsによりlinkの細かい意味やevent informationを表現
問題
- semantics(意味論)
- program semantics
- program languageのもつ意味を確定させる理論
- Web semantics「semantics Web」
- resourceの持つ意味を確定させる理論
- program semantics
- RDFの問題とmicroformatsでの解決
概要
- microformatsのstandardize
- 分類
- elemental
- compound
- 分類
作用
- microformatsで解決できない部分
- RDFa(RDF-in-attributes)での解決
- 可能性
- microformatsによりWeb pageをそのままWeb APIとして提供
- Web page/APIの機能差少ない
- 保守・開発コスト小さい
Ch12 Atom
目的
概要
- resource model
詳細
- entryの構成
- feedの構成
- Atomの拡張
- Feedの分割
- archived feed
- Open Search
作用
- Atom: title, author, update timeなどの基本的なmeta dataを持ったresource表現のためのformat
Ch13 Atom Publishing Protocol
- Atom Publishing Protocol
- Atom Publishing Protocolのresource model
- 1つのresourceがmulti 表現
- member resourceの操作
- service document
- Atom Publishing Protocolに向いている/いないWeb API
Ch14 JSON
- JSON: hashや配列などのdata構造の記述
Part5 Web Serviceの設計
Ch15 Read Only Web Serviceの設計
目的
- resource designの観点
概要
- resource指向のarchitectureのapproachの観点
- RESTfulなWeb Serviceの性質
- addressability
- stateless
- 接続性
- 統一IF
詳細
- 各手順の観点
作用
- resource design skillの習得でよい設計
Ch16 writable Web Service
目的
- ROのServiceより観点多い
概要
- 観点
- resource create/update/delete
- batch処理
- transaction
- 排他
詳細
- create
- factory resource
- PUT作成
- 〇 作成と更新の区別不要
- × clientにURI構造流出
- update with PUT
- bulk update
- partial update → 通信料cut
- update error
- delete
- 子resource
- batch: POSTでURIを非指定
- response
- transaction
- transaction resource
- (or batchのtransaction化)
- 上位resourceへの操作
- 排他
- pessimistic lock
- LOCK/UNLOCK @WebDAV
- 独自Lock resource
- optimistic lock
- conflictを解消
- Condition PUT/DELETE
- conflictを解消
- pessimistic lock
作用
- 以下の観点でバランス
- なるべくsimple
- 別resourceで解決
- 必要ならPOST
Ch17 resource design
目的
- dataの特定とdataのresource分割のための方法を見る
内容
- 関係モデルからの導出
- data model with math的基盤
- 中心tableの1行を1 resource
- 自己記述のため非正規 → network負荷減
- resourceに必要な項目をすべて入れる
- 階層 difficult
- linkのためのER図
- Object Oriented modelからの導出
- 主要entityからresource
- 階層関係 → URI構造
- link by object reference
- top levelは別に作る
- information architectureからの導出
- information分類の観点: information architecture
- resource oriented architectureと相互補完
- information architectureがinformationを分類し,resource oriented architectureにつながる
作用
- 既存の3つの手法を,serviceとAPIを分けずに用いることで,resourceを導出できる