Web Architecture and Technologies
Ambient intelligence: technology and design
Fulvio Corno Politecnico di Torino, 2013/2014
and Technologies Ambient intelligence: technology and design Fulvio - - PowerPoint PPT Presentation
Web Architecture and Technologies Ambient intelligence: technology and design Fulvio Corno Politecnico di Torino, 2013/2014 Goal Understanding Web technologies Adopted for User Interfaces Adopted for Distributed Application
Ambient intelligence: technology and design
Fulvio Corno Politecnico di Torino, 2013/2014
2013/2014 Ambient intelligence: technology and design 2
2013/2014 Ambient intelligence: technology and design 3
2013/2014 Ambient intelligence: technology and design 4
http://www.evolutionoftheweb.com
2013/2014 Ambient intelligence: technology and design 5
Browser Internet infrastructure Web Server Application Server Database Server
3rd party services Client
2013/2014 Ambient intelligence: technology and design 6
browser
application
2013/2014 Ambient intelligence: technology and design 7
2013/2014 Ambient intelligence: technology and design 8
2013/2014 Ambient intelligence: technology and design 9
2013/2014 Ambient intelligence: technology and design 10
URL
HTML
2013/2014 Ambient intelligence: technology and design 11
2013/2014 Ambient intelligence: technology and design 12
130.192.5.26
Contact server
HTML file contents
Scheme Scheme Scheme Scheme Hostname Hostname Hostname Hostname Query Query Query Port Fragment Userinfo
2013/2014 Ambient intelligence: technology and design 13
2013/2014 Ambient intelligence: technology and design 14
GET /~corno/index.html HTTP/1.0 Accept: text/html Accept: image/gif User-Agent: Firefox/Windows Browser 18.3 HTTP/1.0 200 OK Date: Monday, 01-Jan-2001 00:00:00 GMT Server: Apache 1.3.0 MIME-Version: 1.0 Last-Modified: 31-Dec-2000 Content-type: text/html Content-length: 3021 <HTML> . . .
2013/2014 Ambient intelligence: technology and design 15
2013/2014 Ambient intelligence: technology and design 16
2013/2014 Ambient intelligence: technology and design 17
2013/2014 Ambient intelligence: technology and design 18
i n t e r n e t Web application (PHP, JSP, …) Browser Display Mouse/ Keyboard Web server (Apache, IIS) HTML file Image file Layout engine
IMG IMG HTM HTM
2013/2014 Ambient intelligence: technology and design 19
Source: http://news.netcraft.com/
http://news.netcraft.com/archives/2014/03/03/march-2014-web-server-survey.html
2013/2014 Ambient intelligence: technology and design 20
2013/2014 Ambient intelligence: technology and design 21
URL & data
HTML
2013/2014 Ambient intelligence: technology and design 22
2013/2014 Ambient intelligence: technology and design 23
HTML
2013/2014 Ambient intelligence: technology and design 24
2013/2014 Ambient intelligence: technology and design 25
2013/2014 Ambient intelligence: technology and design 26
URL & data
HTML
data
2013/2014 Ambient intelligence: technology and design 27
2013/2014 Ambient intelligence: technology and design 28
2013/2014 Ambient intelligence: technology and design 29
2013/2014 Ambient intelligence: technology and design 30
2013/2014 Ambient intelligence: technology and design 31
i n t e r n e t Web application (ASP, PHP, JSP, …) Browser Display Mouse/ Keyboard Web server (Apache, IIS) HTML file Image file Layout engine
IMG IMG HTM HTM
Data base Database Server DBMS
SQL
2013/2014 Ambient intelligence: technology and design 32
i n t e r n e t Web application (ASP, PHP, JSP, …) Browser Display Mouse/ Keyboard Web server (Apache, IIS) HTML file Image file Layout engine
IMG IMG HTM HTM
Data base Database Server DBMS
SQL
Javascript engine
JS CSS HTM
DOM
CSS stylesheets Javascript
JS CSS
2013/2014 Ambient intelligence: technology and design 33
2013/2014 Ambient intelligence: technology and design 34
URL
HTML
data
2013/2014 Ambient intelligence: technology and design 35
2013/2014 Ambient intelligence: technology and design 36
2013/2014 Ambient intelligence: technology and design 37
i n t e r n e t Web application (ASP, PHP, JSP, …) Browser Display Mouse/ Keyboard Web server (Apache, IIS) HTML file Image file Layout engine
IMG IMG HTM HTM
Data base Database Server DBMS
SQL
Javascript engine
JS CSS HTM
DOM
CSS stylesheets Javascript
JS CSS
Data
XML, JSON
2013/2014 Ambient intelligence: technology and design 38
2013/2014 Ambient intelligence: technology and design 39
2013/2014 Ambient intelligence: technology and design 40
2013/2014 Ambient intelligence: technology and design 41
i n t e r n e t Server application Client Application Web server Data base Database Server DBMS
SQL
Data
XML JSON XML JSON
i n t e r n e t Web server Environ ment
2013/2014 Ambient intelligence: technology and design 42
2013/2014 Ambient intelligence: technology and design 43
http://www.ietf.org/rfc/rfc2616.txt
2013/2014 Ambient intelligence: technology and design 44
2013/2014 Ambient intelligence: technology and design 45
Initial line header1: value1 header2: value2 header3: value3 message body...
HEAD /index.html HTTP/1.1 Host: www.example.com HTTP/1.1 200 OK Date: Mon, 23 May 2005 22:38:34 GMT Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux) Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT Etag: "3f80f-1b6-3e1cb03b" Accept-Ranges: bytes Content-Length: 438 Connection: close Content-Type: text/html; charset=UTF-8
Request Response
2013/2014 Ambient intelligence: technology and design 46
HTTP (Request, Response) Header Body
URI Method Status Code http://www.sadev.co.za GET 200 text Content Type text/plain
2013/2014 Ambient intelligence: technology and design 47
2013/2014 Ambient intelligence: technology and design 48
2013/2014 Ambient intelligence: technology and design 49
2013/2014 Ambient intelligence: technology and design 50
2013/2014 Ambient intelligence: technology and design 51
2013/2014 Ambient intelligence: technology and design 52
2013/2014 Ambient intelligence: technology and design 53
2013/2014 Ambient intelligence: technology and design 54
2013/2014 Ambient intelligence: technology and design 55
2013/2014 Ambient intelligence: technology and design 56
2013/2014 Ambient intelligence: technology and design 57
2013/2014 Ambient intelligence: technology and design 58
2013/2014 Ambient intelligence: technology and design 59
2013/2014 Ambient intelligence: technology and design 60
Content-Type File text/plain Plain text text/xml XML text/html HTML image/png PNG image audio/basic Wave audio audio/mpeg MPEG audio (MP3) video/quicktime Quicktime Video application/pdf Adobe PDF document application/javascript JavaScript application/vnd.ms-powerpoint PowerPoint file application/x-rar-compressed RAR file
2013/2014 Ambient intelligence: technology and design 61
2013/2014 Ambient intelligence: technology and design 62
2013/2014 Ambient intelligence: technology and design 63
2013/2014 Ambient intelligence: technology and design 64
2013/2014 Ambient intelligence: technology and design 65
2013/2014 Ambient intelligence: technology and design 66
2013/2014 Ambient intelligence: technology and design 67
2013/2014 Ambient intelligence: technology and design 68
2013/2014 Ambient intelligence: technology and design 69
2013/2014 Ambient intelligence: technology and design 71
2013/2014 Ambient intelligence: technology and design 72
2013/2014 Ambient intelligence: technology and design 73
2013/2014 Ambient intelligence: technology and design 74
2013/2014 Ambient intelligence: technology and design 75
2013/2014 Ambient intelligence: technology and design 76
2013/2014 Ambient intelligence: technology and design 77
2013/2014 Ambient intelligence: technology and design 78
2013/2014 Ambient intelligence: technology and design 79
2013/2014 Ambient intelligence: technology and design 80
2013/2014 Ambient intelligence: technology and design 81 {"developerMessage" : "Verbose, plain language description of the problem for the app developer with hints about how to fix it.", "userMessage":"Pass this message on to the app user if needed.", "errorCode" : 12345, "more info": "http://dev.teachdogrest.com/errors/12345"}
2013/2014 Ambient intelligence: technology and design 83
2013/2014 Ambient intelligence: technology and design 84
URL Design
Plural nouns for collections
/dogs
ID for entity
/dogs/1234
Associations
/owners/5678/dogs
4 HTTP Methods
POST GET PUT DELETE
Bias toward concrete names
/dogs (not animals)
Multiple formats in URL
/dogs.json /dogs.xml
Paginate with limit and offset
?limit=10&offset=0
Query params
?color=red&state=running
Partial selection
?fields=name,state
Use medial capitalization
"createdAt": 1320296464 myObject.createdAt;
Use verbs for non-resource requests
/convert?from=EUR&to=CNY&amoun t=100
Search
/search?q=happy%2Blabrador
DNS
api.foo.com developers.foo.com
Errors
8 Status Codes
200 201 304 400 401 403 404 500
Verbose messages
{"msg": "verbose, plain language hints"}
Versioning
Include version in URL
/v1/dogs
Keep one previous version long enough for developers to migrate
/v1/dogs /v2/dogs
Client Considerations
Client does not support HTTP status codes
?suppress_response_codes=true
Client does not support HTTP methods
GET /dogs?method=post GET /dogs GET /dogs?method=put GET /dogs?method=delete
Complement API with SDK and code libraries
2013/2014 Ambient intelligence: technology and design 86
2013/2014 Ambient intelligence: technology and design 87
2013/2014 Ambient intelligence: technology and design 88
Name/Value Pairs Number data type String Array Child properties
2013/2014 Ambient intelligence: technology and design 89
2013/2014 Ambient intelligence: technology and design 90
2013/2014 Ambient intelligence: technology and design 91
2013/2014 Ambient intelligence: technology and design 92
– Share — copy and redistribute the material in any medium or format – Adapt — remix, transform, and build upon the material – The licensor cannot revoke these freedoms as long as you follow the license terms.
– Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. – NonCommercial — You may not use the material for commercial purposes. – ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. – No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
2013/2014 Ambient intelligence: technology and design 93