http protocol response-request clients not limited to web browsers. anything that can access code...

7
http protocol • Response-request Clients not limited to web browsers. Anything that can access code implementing the protocol works: Standalone programs in • Java • Perl • C, C++ • Javascript • PHP • Lisp •…

Upload: lenard-carpenter

Post on 04-Jan-2016

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Http protocol Response-request Clients not limited to web browsers. Anything that can access code implementing the protocol works: –Standalone programs

http protocol

• Response-request• Clients not limited to web browsers. Anything that

can access code implementing the protocol works:– Standalone programs in

• Java• Perl• C, C++• Javascript• PHP• Lisp• …

Page 2: Http protocol Response-request Clients not limited to web browsers. Anything that can access code implementing the protocol works: –Standalone programs

http protocol

• Requests:– GET– POST– HEAD

• GET originally designed for request to provide a resource (the part after the http://<hostname>/

• Extended with CGI query syntax

Page 3: Http protocol Response-request Clients not limited to web browsers. Anything that can access code implementing the protocol works: –Standalone programs

GET vs Post: CGI Query Sytax

• GET– uses CGI http://…../db?arg1=val1&arg2=val2&…– Issues:

• data is exposed• only good for small data

• POST– Arbitrary data can be sent to server including

• plain text• serialized objects• …

Page 4: Http protocol Response-request Clients not limited to web browsers. Anything that can access code implementing the protocol works: –Standalone programs

http Responses

• Headers can include data about– Content Format

• MIME Content types

• text/html

• text/xml

• application/msword

• application/jpeg

• application/gif

• application/mpeg

• …

Page 5: Http protocol Response-request Clients not limited to web browsers. Anything that can access code implementing the protocol works: –Standalone programs

http Responses

• Headers can include data about– Content Format – Cache control (e.g. how long cache will be

valid)– Length of message– Last Modification Date

Page 6: Http protocol Response-request Clients not limited to web browsers. Anything that can access code implementing the protocol works: –Standalone programs

Server side programming

• In the old days (circa 1993-1998) most server side programming was perl using the cgi interface libraries, processing GET

• Generalizations in Java:– Servlets. Classes wrap most of the protocol. servlet

implements doGet and doPut– JSP (client side) builds servlets on-the-fly.– Need to be embedded in a web container implementing

the servlet API, e.g. Apache jakarta tomcat, JServ (somewhat obsolete), and commercial products

Page 7: Http protocol Response-request Clients not limited to web browsers. Anything that can access code implementing the protocol works: –Standalone programs

Tomcat

• Web container• Embeddable in web servers such as Apache• Can run standalone (which is what we'll

do). In other words, it also can do http protocols.

• In fact when embedded in a webserver, the server forwards the http requests and responses. (Part of web container spec?)