Internet Protocols and Applications I - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Internet Protocols and Applications I

Description:

HTTP Header : Used for transmitting any kinds of information between client and ... Client : Using Accept Header, Clients can define their preferred media type ... – PowerPoint PPT presentation

Number of Views:28
Avg rating:3.0/5.0
Slides: 19
Provided by: philipp76
Category:

less

Transcript and Presenter's Notes

Title: Internet Protocols and Applications I


1
Internet Protocols and Applications I
2
Some Protocols
  • HTTP Communication
  • Connectionless Communication
  • Stateless Communication

(1) TCP Connection Request
(2) HTTP Request
Server
Client
(3) HTTP Response
(4) TCP Connection Close
3
Some Protocols
  • HTTP Message
  • Start Line Client Request Information /
    Response Status Information
  • Message Header Additional Information for HTTP
    Message such as Date, Program Name, Version,
    Cookie, User Authentication, Cache
  • Message Body Contents for Request or Response.
    In case of POST, Input data consists of data
    stream encoded in request message.

4
Some Protocols
  • Client Request Message in HTTP
  • Request HTTP Command, URI, and HTTP Version,
    Header NameHeader Value, Request Message Body
  • HTTP Command GET, HEAD, POST/ OPTIONS, PUT,
    DELETE, LINK, UNLINK, TRACE
  • Server Response Message in HTTP
  • Response Message HTTP Version, Status Code,
    Code Description, Response Header, Response
    Message Body
  • Response Status Code (Reference 100-199),
    (Success 200-299), (Redirection 300-399),
    (Incomplete 400-499), (Server Error 500-599)

5
Some Protocols
  • HTTP Message Header
  • HTTP Header Used for transmitting any kinds of
    information between client and server, Header
    Name Blank Header-value
  • General Header Client Request, Server Response,
    Cache setup, Connection, Date, etc
  • Client Request Header Client information and
    preferred data type, Accept Character set,
    encoding type, and authorization
  • Response Header Server Information, Message
    processing methods for response message. Web
    server information, Cookie setup, authenticate
    information.
  • Entity Header HTTP message body information,
    encoding method of message, contents length, MD5
    information, encoding method of contents
    transmission, MIME type

6
Some Protocols
  • MIME Type
  • As HTTP transmission deal with multimedia
    documents, pre-defined method to deal with that
    data by client should be described.
  • MIME(Multipurpose Internet Mail Extension) Type
  • Client Using Accept Header, Clients can define
    their preferred media type
  • Server Describe MIME Type in Content-Type
    Header
  • MIME Type form Type/Subtype (ex
    application/x-javascript)
  • Standard MIME Type
  • Text, Multipart, Message, Application, Image,
    Audio, Video

7
CGI Communication
  • CGI(Common Gateway Interface)
  • Transmit Messages by GET/POST Method
  • Characteristics
  • Extend Web Server, Dynamic Response, Only Install
    in Server Side
  • Overhead, Security, Interactive pages, Cannot
    keep the connection Problems

Process 1
Process 1
Process 1
Web Server
CGI Program
Processes
8
Extended CGI
  • ASP (Active Server Page) of Microsoft
  • Combine HTML, Server side Script, and Server side
    Component
  • Written in Jscript, VBScript, and run on IIS
    Server
  • Can use COM Component
  • Java Servlet and JSP
  • Platform Independent, Safe and Effective Thread
    Service, Object Oriented Paradigm
  • Easy to interoperate with Legacy Application
  • JSP is similar to ASP, and provide HTML script
    language and JavaBeans Component
  • Object Web
  • CORBA (Common Object Request Broker Architecture)
  • EJB (Enterprise JavaBeans)
  • DCOM (Distributed Common Object Model)

9
Motivations of Servlet and JSP
Slide 9-18, Used the Material by Philippe Rochat
  • Faster than CGI (no process creation overhead)
  • Java is Internet oriented
  • Servlet API
  • Security
  • Session support
  • Code reuse and portability
  • JDBC support
  • Next step Enterprise Java Beans (EJB)

10
How-to
  • Very Similar to applet
  • Must inherits
  • HttpServlet
  • Must implements one of
  • doGet
  • doPost
  • doPut
  • Receives
  • HttpServletRequest
  • HttpServletResponse

11
Life-Cycle
  • Instanciation
  • Init()
  • Service()
  • Done()

12
Session
  • public void doGet(HttpServletRequest request,
    HttpServletResponse response)
  • HttpSession session request.getSession(true)
  • session.setAttribute(dataName, dataValue)
  • Enumeration e session.getAttributeNames()

13
Example
  • http//lbdpc15.epfl.ch8080/examples/servlets/sess
    ions.html

14
Cookies
  • public void doGet(HttpServletRequest request,
    HttpServletResponse response)
  • Cookie cookies request.getCookies()
  • response.addCookie(c)

15
Example
  • http//lbdpc15.epfl.ch8080/examples/servlets/cook
    ies.html

16
Pros and Cons
  • Cons
  • HTML embedded in Java source file
  • Pros
  • Power of Java Platform
  • Speed
  • Portability across servers and DBs

17
More
  • At sun
  • http//java.sun.com/products/servlet/index.html
  • Apache
  • http//jakarta.apache.org/tomcat/
  • Lbdpc15
  • TomCat documentation

18
JSP
  • Allows HTML embedded tags
  • lthtmlgt
  • ltjspuseBean id"cart" scope"session"
    class"sessions.DummyCart" /gt
  • ltjspsetProperty name"cart" property"" /gt
  • lt
  • cart.processRequest(request)
  • gt
  • ltFONT size 5 COLOR"CC0000"gt
  • ltbrgt You have the following items in your cart
  • ltolgt
  • lt
  • String items cart.getItems()
  • for (int i0 iltitems.length i)
  • gt
  • ltligt lt itemsi gt
  • lt
  • gt
  • lt/olgt
Write a Comment
User Comments (0)
About PowerShow.com