REST & Caching: Web Services, Accelerated JAOO 2009 Stefan Tilkov, innoQ Tuesday, October 6, 2009
innoQ Deutschland GmbH innoQ Schweiz GmbH Halskestraße 17 Gewerbestrasse 11 D-40880 Ratingen CH-6330 Cham Phone +49 2102 77162-100 Phone +41 41 743 0111 info@innoq.com · www.innoq.com stefan.tilkov@innoq.com http://www.innoq.com/blog/st/ @stilkov http://rest-http.info http://soa-expertenwissen.de Tuesday, October 6, 2009
The REST Uniform Interface identification resource hypermedia as self-descriptive of resources manipulation the engine of messages through application representations state Tuesday, October 6, 2009
The REST Uniform Interface identification identification resource resource hypermedia as hypermedia as self-descriptive self-descriptive of resources of resources manipulation manipulation the engine of the engine of messages messages through through application application representations representations state state http://example.com/orders?year=2008 http://example.com/customers/1234 http://example.com/orders/2007/10/776654 http://example.com/products/4554 http://example.com/processes/sal-increase-234 Tuesday, October 6, 2009
The REST Uniform Interface identification resource hypermedia as self-descriptive of resources manipulation the engine of messages through application representations state GET /customers/1234 Host: example.com Accept: application/vnd.mycompany.customer+xml <customer>...</customer> GET /customers/1234 Host: example.com Accept: text/x-vcard begin:vcard ... end:vcard Tuesday, October 6, 2009
The REST Uniform Interface identification resource hypermedia as self-descriptive of resources manipulation the engine of messages through application representations state <order self='http://example.com/orders/3321'> <amount>23</amount> <product ref='http://example.com/products/4554' /> <customer ref='http://example.com/customers/1234' /> <link rel='edit’ ref='http://example.com/order-edit/ACDB' /> </order> Tuesday, October 6, 2009
The REST Uniform Interface identification resource hypermedia as self-descriptive of resources manipulation the engine of messages through application representations state GET /service/customers/1234 HTTP 1.1 Standard Host: www.example.com User-Agent: XYZ 1.1 Method Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Keep-Alive: 300 Connection: keep-alive If-Modified-Since: Fri, 02 Oct 2009 16:47:31 GMT Visibility If-None-Match: "600028c-59fb-474f6852c9dab" Cache-Control: max-age=60 HTTP/1.1 200 OK Date: Sun, 04 Oct 2009 19:36:25 GMT Media Type Server: Apache/2.2.11 (Debian) Control Data Last-Modified: Fri, 02 Oct 2009 16:47:31 GMT Etag: "600028c-59fb-474f6852c9dab" Cache-Control: max-age=300 Accept-Ranges: bytes Vary: Accept-Encoding Content-Encoding: gzip Content-Length: 7160 Data Keep-Alive: timeout=15, max=91 Connection: Keep-Alive Content-Type: application/xml <?xml version=‘1.0’ encoding=‘utf-8’ ?> ... Tuesday, October 6, 2009
getOrderDetails() submitApplicationData() updateQuote() findMatchingBid() initiateProcess() cancelSubscription() listAuctions() getUsers() Tuesday, October 6, 2009
initiateProcess() getOrderDetails() submitApplicationData() findMatchingBid() GET POST listAuctions() getUsers() PUT DELETE updateQuote() cancelSubscription() Tuesday, October 6, 2009
generic interface Resource { Any HTTP client Resource(URI u) (Firefox, IE, curl, wget) Response get() Response post(Request r) Any HTTP server Response put(Request r) Response delete() Caches } Proxies Google, Yahoo!, MSN Anything that knows class CustomerCollection : Resource { ... your app Response post(Request r) { id = createCustomer(r) return new Response(201, r) } ... } specific Tuesday, October 6, 2009
Caching Models Note: Thanks to Ryan Tomayko for letting me steal base some work on his diagrams from http://tomayko.com/writings/things-caches-do Tuesday, October 6, 2009
!"#$%& !'()$ *'(+$%, -./012$"(34$ -./012$"(34$ (3,$0&305$%,06'(+ 78$""3093:",70)$:$ ;<<0=> 8$""3093:", ;<<0=> 8$""3093:", !"#$%& !'()$ *'(+$%, Tuesday, October 6, 2009
Expiration Tuesday, October 6, 2009
!"#$%& !'()$ *'(+$%, -./012$"(34$ -./012$"(34$ 56$""30738",5 9('(:"'&#%;04'<0&3"$8'="$0';$> ?@@0AB !'()$C!3%&83"D04'<C';$EF@@ 6$""30738",G ?@@0AB !'()$C!3%&83"D04'<C';$EF@@ 6$""30738",G !"#$%& !'()$ *'(+$%, Tuesday, October 6, 2009
!"# $%&'( !%&)(*+ ,-./01(2&"3( .'45/+"(5/*"6/'%77(*/888 888/#(&%95(/6'(/&%&'(/45/:;(5'< =>>/?@ AB(C/D> $%&'(E$"*6;"2C/3%FE%B(GH>> I(22"/J";2+< !"# $%&'( !%&)(*+ Tuesday, October 6, 2009
Validation Tuesday, October 6, 2009
!"#$% &'$(% )'$*%+, -./012%"$34% -./012%"$34% 5%+%6'7%08'"#,'7369: ;<%""30=36",; >??0@A B'97CD3,#E#%,F0/G%H0>I0@$7JJJ ./'5F0'K%LMM'E, <%""30=36", >??0@A B'97CD3,#E#%,F0/G%H0>I0@$7JJJ ./'5F0'K%LMM'E, <%""30=36", !"#$% &'$(% )'$*%+, Tuesday, October 6, 2009
!"# $%&'( !%&)(*+ ,-./01(2&"3( ,-./01(2&"3( 4567"+858(+698*&(:/.;(</=>/?&@AAA 456B"*(67%@&':/%C(DEE%5+ F(*(G%@(/H%28+%@"GIJ K?/B?./F(*(G%@(/G(IL"*I( CMD/B"@/7"+858(+ =MM/?N O%I@67"+858(+:/.;(</=>/?&@AAA -.%F:/%C(DEE%5+ P(22"/Q"G2+ !"# $%&'( !%&)(*+ Tuesday, October 6, 2009
Combination Tuesday, October 6, 2009
!"#$% &'$(% )'$*%+, -./012%"$34% -./012%"$34% 5%+%6'7%08'"#,'7369: ;<%""30=36",; >??0@A &'$(%B&3+763"C04'DB'5%EF? G'97BH3,#I#%,C0/J%K0>L0@$7MMM <%""30=36", >??0@A &'$(%B&3+763"C04'DB'5%EF? G'97BH3,#I#%,C0/J%K0>L0@$7MMM <%""30=36", !"#$% &'$(% )'$*%+, Tuesday, October 6, 2009
!"# $%&'( !%&)(*+ ,-./01(2&"3( .'45/+"(5/*"6/'%77(*/888 888/#(&%95(/6'(/&%&'(/45/:;(5'< =>>/?@ $%&'(A$"*6;"2B/3%CA%D(EF> GD(B/H> I%56AJ"+4:4(+B/.9(K/=L/?&6888 M(22"/N";2+ !"# $%&'( !%&)(*+ Tuesday, October 6, 2009
!"#$% !"&'( )"&*(+, -./012(%&$3( -./012(%&$3( 4567$,858(,698+&(:0/;(<0=>0?&@AAA B(+(#"@(0C"%8,"@$#DE F?0G?/0B(+(#"@(0#(DH$+D( IJK0G$@07$,858(, !"&'(6!$+@#$%:03"L6"B(MNJ =JJ0?O !"&'(6!$+@#$%:03"L6"B(MNJ P"D@67$,858(,:0/;(<0=>0?&@AAA Q(%%$0R$#%, !"#$% !"&'( )"&*(+, Tuesday, October 6, 2009
Implementation Tuesday, October 6, 2009
!"#$%& !'()$ *$+,-$./$. 0#"$,-12&$3 4'(5,6%7 *.#&$,0#"$ 869,:;$"(<3$ 869,:;$"(<3$ =$'7,0#"$ =$&>.%,0#"$,!<%&$%&2 =$&>.%,=$2?<%2$ ,@,!'()#%A,)$'7$.2 =$&>.%,=$2?<%2$ !"#$%& !'()$ *$+,-$./$. 0#"$,-12&$3 4'(5,6%7 Tuesday, October 6, 2009
Apache FileETag FileETag INode MTime Size date and time the file was last modified number of bytes in the file file's i-node number Tuesday, October 6, 2009
ETag Depth Tuesday, October 6, 2009
!"#$%& !'()$ *$%$+#(,-.'/,*$%$+'&0+ 1'(2,-%3 *-.,45$"(06$ *-.,45$"(06$ *-.,45$"(06$ 7$&8+%,7$9:0%9$ !06:8&$,-.'/ 7$&8+%,7$9:0%9$ ,;,-.'/ 7$&8+%,7$9:0%9$ !"#$%& !'()$ *$%$+#(,-.'/,*$%$+'&0+ 1'(2,-%3 Tuesday, October 6, 2009
!"#$%& !'()$ *+',&-.'(/-0%1 203-45$"(6+$ 203-45$"(6+$ 7$&8,%-7$9:6%9$ -;-03'< 7$&8,%-7$9:6%9$ !"#$%& !'()$ *+',&-.'(/-0%1 Tuesday, October 6, 2009
!"#$%& !'()$ *+',&-.'(/-0%1 203-45$"(6+$ 203-45$"(6+$ 7$&8,%-7$9:6%9$ -;-03'<=->'?$@AA'B1> 203-45$"(6+$ 203-45$"(6+$ CBDE6%$DF'&()=-'?$@AA'B1 !)$(/-'%1-(6+:8&$-03'< ?G@-E6&-F61#B#$1 7$&8,%-7$9:6%9$ !"#$%& !'()$ *+',&-.'(/-0%1 Tuesday, October 6, 2009
Edge Side Includes (ESI) Tuesday, October 6, 2009
<esi:include src="http://example.com/1.html" alt="http://bak.example.com/2.html" onerror="continue"/> <esi:include src="http://example.com/search?query=$(QUERY_STRING{query})"/> Tuesday, October 6, 2009
!"#$% &$' !"()* &"(+,-./ 0-1,23& 0-1,23& 4*56#.,4*78$.7* 4*56#.,4*78$.7* 0-1,23! 0-1,23! 4*56#.,4*78$.7* 4*56#.,4*78$.7* !"#$% &$' !"()* &"(+,-./ Tuesday, October 6, 2009
!"# $%&'( !%&)*+,- .+/*01! .+/*01 2(345,*2(67",6( +/%89*:%;(<==%>-: +?@*AB,&C4-(*0D .+/*0! 1885(8%3(*1*E*! 2(345,*2(67",6( !"# $%&'( !%&)*+,- Tuesday, October 6, 2009
Recommend
More recommend