REST in Enterprise 박찬욱 1-1-
MISSING PIECE OF ENTERPRISE Table of Contents 1. 2. REST 3. REST 4. REST 5. 2-2 -
Wise chanwook.tistory.com / cwpark@itwise.co.kr / chanwook.god@gmail.com ARM WOA S&C AP ENI 3 KSUG - 3 -
MISSING PIECE OF ENTERPRISE Table of Contents 1. 2. REST 3. REST 4. REST 5. 4-4 -
MVC to REST Model View MVC (Dispatcher / Front Controller ) Controller View Model View (JSP) (HTML) 5 MVC +DTO - 5 -
MVC to REST ID a136 6-6 -
MVC to REST ID a136 http://.../product/view.web?productid=a136 MVC 7-7 -
MVC to REST ID a136??? http://.../product/view.web?productid=a136 MVC? 8-8 -
MVC to REST ID a136? http://.../product/view.web?productid=a136 MVC http://../product/ Resource REST OOP = Object ER Model = Entity 9 REST - 9 -
MVC to REST ID a136 http://.../product/view.web?productid=a136 MVC? http://../product/a136? REST 10-10 -
MVC to REST ID a136?? http://.../product/view.web?productid=a136 MVC [GET] http://../product/a136? HTTP Method GET/POST/PUT/DELETE 11 REST - 11 -
MVC Runtime View Client Server http://.../product/view.web?productid=a136 <html> <body> </body> </html> V C M 12-12 -
MVC Client/Server Architecture 13-13 -
REST MVC Runtime View Client Server [GET] http:// /product/a136 <product> <id>a136</id> <name>..</name> </product> C V R 14-14 -
REST Client/Server Architecture 15-15 -
REST MVC Runtime View Client Server V C HTTP Message C R R 16-16 -
MVC to REST ID a136?? http://.../product/view.web?productid=a136 MVC [GET, application/xml] http://../product/a136? REST Message (Representation) Resource 17 (HTTP Media Type) Resource HTTP Header(Content-Type, Accept), HTTP Parameter, URL Extension - 17 -
MVC to REST ID a136 http://.../product/view.web?productid=a136 MVC [GET, application/xml] http://../product/a136 REST 18-18 -
REST Trio HTTP URI REST Resource REST HTTP METHOD Service (Action) Resource Message (Representation) / 19 (XML / JSON) - 19 -
HTTP REST HTTP (REST Resource ) HTTP Method GET POST PUT DELETE Resource URI http://.../product/a136 http://.../sales/ Message Type application/xml application/json text/xml application/rss+xml 20-20 -
HTTP REST? Resource? UI? HTTP? REST? 21 Message? - 21 -
REST KSUG URI HTML, Javascript Ajax? 22-22 -
Client/Server, (MVC è REST) / 서비스공급, Server=Provider 서비스요청, Client=Consumer Client : Server = N : 1( ) Client : Server = N : N ( ) WEB Consumer Provider.NET Java HTTP Service Mobile 23 OPEN API - 23 -
HTTP? (,, ) ( / ) HTTP HTTP (ROI) ( ) 24-24 -
REST REST URI URL... REST Resource HTTP Web URI (UI) URI == Resource 25-25 -
REST Leonard Richardson s Maturity Model (QCon) REST Hypermedia HTTP 26 URI - 26 -
Level 0 RCP, WebService HTTP RCP 1 URI - 1 HTTP Method(POST) RPC, SOAP-based payl Hypermedia HTTP URI Client POST /appointmentservice <openslotrequest date = "2010-01-04" doctor = "mjones"/> HTTP/1.1 200 OK <openslotlist> <slot start =.." end =.."> <doctor id = "mjones"/> </slot> </openslotlist> POST /appointmentservice <appointmentrequest> <slot doctor = "mjones" start = "1400" end = "1450"/> <patient id = jsmith /> </appointmentrequest> HTTP/1.1 200 OK < > /appointmentservice 27-27 -
Level 1 - Resource Resource * URI - 1 HTTP Method * Resource Hypermedia HTTP URI POST /doctors/mjones <openslotrequest date = "2010-01-04" doctor = "mjones /> /doctors/{doctorid} HTTP/1.1 200 OK <openslotlist> <slot id = "1234" doctor = "mjones" start =.." end =.."/> </openslotlist> Client POST /slots/1234 <appointmentrequest> <slot doctor = "mjones" start = "1400" end = "1450"/> <patient id = jsmith /> </appointmentrequest> /slots/{slotid} 28 HTTP/1.1 200 OK < > - 28 -
Resource (Resource identified) Resource Representation (Message) Loosely Coupled (Client - Resource) Self-Descriptive Message Contents-Negotitation http://rest.com/product/abc12cd ID: abc12cd Name: TV Sales: $500 XML <product> <id>abc12cd</id> <name>tv</name> <sales>$500</sales> </product> 29-29 -
Level 2 HTTP Verb * URI - * HTTP Method HTTP Resource HTTP Method(Verb) Hypermedia HTTP URI GET /doctors/mjones/slots?date=20100104&status=open <openslotrequest date = "2010-01-04" doctor = "mjones /> /doctors/{doctorid}/slots 200 OK <openslotlist> <slot id = "1234" doctor = "mjones" start =.." end =.."/> </openslotlist> Client POST /slots/1234 <appointmentrequest> <patient id = jsmith /> </appointmentrequest> 201 CREATED Location: slots/1234/appointment <appointment> </appointment> /slots/{slotid} 30-30 -
Representation Caching (Cacheability) Resource caching(x) Representation caching(0) HTTP etag Request #1 ETag: 686897696a7c876b7e Request #2 If-None-Match: "686897696a7c876b7e" response code: 304 NOT MODIFIED ETag: 686897696a1c877e2a if(response hash == If-Non-Match header){ }else{ Result => Hash Result => Hash 31 } - 31 -
Level 3 Hypermedia HATEOS == Hypertext As The Engine Of Application State Resource (link) ATOM Hypermedia HTTP URI GET /doctors/mjones/slots?date=20100104&status=open 200 OK <openslotlist> <slot id = "1234" doctor = "mjones" start =.." end =.. > <link rel = "/linkrels/slot/book" uri = "/slots/1234"/> </slot> </openslotlist> /doctors/{doctorid}/slots Client POST /slots/1234 <appointmentrequest> <patient id = jsmith /> </appointmentrequest> 201 CREATED Location: slots/1234/appointment <appointment> <link rel = "/ /cancel" uri = "/slots/1234/appointment"/> <link rel = "/linkrels/help" uri = "/help/appointment"/> </appointment> /slots/{slotid} 32-32 -
MISSING PIECE OF ENTERPRISE Table of Contents 1. 2. REST 3. REST 4. REST 5. 33-33 -
Java REST HTTP URI API JAX-RS JEE6 (JSR-311) Jersey, RESTEasy, CXF, Wink 등 구현체제공 현재 1.1 closed, 2.0 준비중 Spring Spring MVC 기반 REST 매핑지원 (Spring 3.0 ) Spring Mobile, Spring Android/IPhone Spring 34-34 -
JAX-RS REST Apache CXF JAX- RS @Service("goodsSalesEndpoint") @Path("/report") public class GoodsSalesEndpoint { @GET @Path("/{goodsName}") @Produces("application/json") public MonthlySalesReport getmonthlyreportofsinglegoods( @PathParam("goodsName") String goodsname, @QueryParam("year") String year) { return service.getmonthlyreport(year, goodsname); 35 } } - 35 -
Spring REST Spring MVC @Controller("goodsSalesEndpoint") @RequestMapping("/report") public class GoodsSalesEndpoint { @RequestMapping(value="/{goodsName}, method=requetmethod.get) public MonthlySalesReport getmonthlyreportofsinglegoods( @PathVariable("goodsName") String goodsname, @RequestParam("year") String year) { } return service.getmonthlyreport(year, goodsname); 36 } - 36 -
Web Mobile Web Mobile App 37-37 -
REST (Mobile) Web Client / Server HTML : Ajax XML < JSON MVC MVC: View(Link) => Controller => Model => View REST: View(Link) => View(=>Controller=>Model) 38-38 -
REST (Mobile) Web, HTTP ==> Resource ( ) (, ) / / ( ) Representation 39-39 -
REST (Mobile) Web HTTP REST Core Chain HTML 5 ( ) Metadata 정의기반 HTML 5 / jquery Ajax GWT UI Smart GWT REST 40-40 -
REST (Mobile) Web HTML 5 강화된 HTTP 지원 Web Storage /, (SQL ) API ( ) (5~10MB) ( 아직 ) 표준재정이마무리되지않은문제 http://www.infoq.com/news/2010/10/html5-is-not-production-ready cross-browser incompatibilities 41-41 -
REST Mobile APP UI One Service, Multi Device API Android 아파치 HttpClient 기본내장 IPhone HTTP RESTful 3rd API Windows Phone 7 WCF 42-42 -
REST, HTTP, Rich > UI Resource UI, (,.NET) HTTP API, Message Mapping API 43-43 -
REST WebService SOAP => REST Amazon WADL, SOAP 1.2 REST WS-* REST? (HTTP) REST?? < REST (,?) 44-44 -
MISSING PIECE OF ENTERPRISE Table of Contents 1. 2. REST 3. REST 4. REST 5. 45-45 -
HTTP / GET, POST, PUT, DELETE 4? HTTP Method URI PUT?POST? :? select è insert è update è select è delete è...??!! è POST : Resource (operation) 46-46 -
Resource / Resource, DB Modeling, Object Modeling Resource Representation Representation (Message) Resource DTO è Resource Resource Resource 47 : http://www.infoq.com/articles/designing-restful-http-apps-roth - 47 -
,, ( ),, HTTP Digest, OAuth 등의인증서비스를통해구현가능 HTTPS, ACL ID/PW (Security Key) ( : Server => Client) 48-48 -
MISSING PIECE OF ENTERPRISE Table of Contents 1. 2. REST 3. REST 4. REST 5. 49-49 -
REST REST REST (RMM) REST : Rich Client > Mobile > Web 50-50 -
Vision REST HTTP PII (Platform Independent Interface) 51-51 -
Rest in Practice http://restinpractice.com/ REST Wikipedia http://en.wikipedia.org/wiki/representational_state_transfer Architectural Styles and the Design of Network-based Software Architectures, Roy Fielding http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm REST A Little REST and Relaxation, Roy Fielding http://roy.gbiv.com/talks/200711_rest_apachecon.pdf Architectural Style REST Wiki http://rest.blueoxen.net/cgi-bin/wiki.pl 52 IBM DeveloperWorks REST tag InfoQ REST tag - 52 -
MISSING PIECE OF ENTERPRISE. ASEM Tower 30 th Fl. #3030, 159-1 Samsung-dong, Gangnam-gu, Seoul 135-798, Korea Tel : 82-02-6001-3046, Fax : 82-02-6001-3049