Интеrestни уеб услуги

Download ИнтеRESTни уеб услуги

If you can't read please download the document

Upload: svilenivanov

Post on 16-Apr-2017

1.736 views

Category:

Technology


1 download

TRANSCRIPT

REST

([email protected])(http://svilen-online.blogspot.com)

2007, 30

Theme created bySakari Koivunen and Henrik OmmaReleased under the LGPL license.

...

:

HTTP

(scalability)

HTTP: URI FTP: login, cd /pub, get file.txtScalability: ? Transactionless design (GET, HEAD) (PUT, DELETE)

?

- ()

?

:

SOAP, WSDL, UDDI, WS-Security, WS-Reliability, WS-ReliableMessaging, WS-Addressing, WS-Transaction

?

:

, :

, , , , RSS/PDF

- , , , EXIF ;

?

(X)HTML CSS:

XML

JSON

HTTP

URI (URL)

GET, POST

: content-type, cookies

XMLHttpRequest

,

25 2007

webtech

URIs

( ) URI

:
http://example.com/svi/posts/latest

25 2007:
http://example.com/svi/posts/2007/06/25

webtechc
http://example.com/svi/tags/webtech

URIs

:

:
http://example.com/svi/webtech-in-varna

:
http://example.com/svi/webtech-in-varna/
comments


http://example.com/svi/webtech-in-varna/
comments/5

PDF:
http://example.com/svi/webtech-in-varna/pdf

HTTP

GET, POST - PUT, DELETE, HEAD, OPTIONS

: HTTP GET

: HTTP POST PUT

: HTTP PUT

: HTTP DELETE

: HEAD

:

:

(post)

:

HTML
http://localhost:3000/svi/posts

HTML:
http://localhost:3000/svi/posts/[id]

:

, ,

HTML

POST:

HTML

:

application/x-www-form-urlencoded

POST /svi/posts HTTP/1.0
Host: localhost:3000
Content-Type: application/x-www-form-urlencoded
Content-Length: 65

title=Breaking%20News&content=Global%20Warming%20is%20not%20Myth

multipart/form-data

POST:

HTTP

Location: URI

HTTP/1.1 201 Created
Date: Wed, 27 Jun 2007 23:26:23 GMT
Location: http://localhost:3000/svi/posts/1

GET:


GET /svi/posts/1 HTTP/1.0

URI

?

URI ( ):
http://localhost:3000/posts/plain-text

(content negotioation)

Accept:text/xml, application/xml, text/html; q=0.9, text/plain; q=0.8, image/png, */*; q=0.5

PUT:

POST

XMLHttpRequest:
var httpRequest = new XMLHttpRequest();
httpRequest.open('PUT', '/svi/posts/1', true);

HTTP

PUT /svi/posts/1 HTTP/1.0
Host: localhost:3000
Content-Type: application/x-www-form-urlencoded
Content-Length: 95

title=Old%20News%20It%20is%20already%20happening%20&content=Global%20Warming%20is%20not%20Myth

PUT vs. POST. Fight!

PUT ?

URI , PUT

URI Location

DELETE:

XMLHttpRequest:
var httpRequest = new XMLHttpRequest();
httpRequest.open('DELETE', '/svi/posts/1', true);

HTTP

DELETE /svi/posts/1 HTTP/1.0

REST

,

URI

(GET/DELETE/PUT ..)

REST

(. GET )

? !

, .

REST

? !

, (cache)

REST

GET/HEAD

, (safety)

PUT/DELETE

, (idempotence)

POST

PUT/DELETE( )

? !

,

REST

5-6 ?

,

(GET - , POST , ..)

(/ )

REST

REST framework

Restlet (Java)

JSR 311: Java API for RESTful Web Services

Ruby On Rails (Ruby)

Django (Python)

Catalyst (Perl)

!, ?

Click to edit the title text format

Click to edit the outline text format

Second Outline Level

Third Outline Level

Fourth Outline Level

Fifth Outline Level

Sixth Outline Level

Seventh Outline Level

Eighth Outline Level

Ninth Outline Level