22
Introduction To Web Application Alex

Indroduction to Web Application

  • Upload
    torny10

  • View
    149

  • Download
    1

Embed Size (px)

DESCRIPTION

indroduction to web application from history to principle forcus on what it is and how it works

Citation preview

Page 1: Indroduction to Web Application

Introduction To Web Application

Alex

Page 2: Indroduction to Web Application

Topic

No programming detail Not for some specific programming

language Focus on what it is Focus on how it works

Page 3: Indroduction to Web Application

Outline

Client Server Communication HTTP Static Web Web Server Client Side Script Dynamic Web Application Server Beyond This

Page 4: Indroduction to Web Application

Client Server Communication

Server listen Client send a request Server send a response back OSI Stack

– Application Layer

– Transport Layer

– Network Layer

– Data Link Layer

– Physical Layer

Page 5: Indroduction to Web Application

HTTP

Application Layer Protocol URL As Address Address Stack

– HTTP: URL (domain + path)

– TCP: ip + port

– IP: ip

– 802.11x: mac address

– Hardware: broadcast

Page 6: Indroduction to Web Application

HTTP

HTTP Request– Header (Key-Value Text)

• Address (Host, Get or Post)

• Describe Body

• Describe Client

• Other Stuff

– Body • Post Parameters (key=value)

• Files

• Carry whatever you want

Page 7: Indroduction to Web Application

HTTP

HTTP Response– Header (Text Key Value Pairs)

• Response Status (2xx 3xx 4xx 5xx)

• Describe Body

• Other Stuff

– Body• Browser case : HTML js css

• Download case : anything you downloaded

Page 8: Indroduction to Web Application

Static Web

Document Sharing Connection between Documents – Hyper

Link Document is text and more than text Hyper Text = text + hyper link HTML = Hyper Text + style Hyper Text Markup Language

Page 9: Indroduction to Web Application

Web Server

Manage static document files Give client what it ask for Apache Lighttpd Nginx etc How it works

– Listen on a port (default 80)

– Accept a http request

– Locate the document client wants

– Send that back to client as a http response

Page 10: Indroduction to Web Application

Client Side Script

More than display and link– Animation

– Response user action immediately

– Some logic can run on client Browser can run

– Javascript

– Flash

– Sliver light

– VB Script, Java Applet, ActiveX, Extensions

Page 11: Indroduction to Web Application

Dynamic Web

Think about a forum– User generate content

– Topics changes all the time You can not do this static way

– We need more then static files

– We need to run a program when we accept a http request to generate response

How?

Page 12: Indroduction to Web Application

Dynamic Web

New Way– Listen to a port (default 80)

– Accept a http request

– Processing request• If static content, return that stupid file

• If dynamic run a program return that result

– Send result back as a http response

Page 13: Indroduction to Web Application

Application Server

More then web server– An URL can map to a static file

– An URL can map to a processing logic Ancient Way

– CGI just run a executable program and return the standard output

– Fast CGI : thread based

Page 14: Indroduction to Web Application

Application Server

Now it works, functionally People finally got Web Application But it sucks

– If we write an address which we should not write, Crash!

– Print each line of html

– Heavy work just for a forum

Page 15: Indroduction to Web Application

Application Server

Most Web Applications do not need memory manipulate

Output html in html way Solution

– Interpret server side script in a html template when processing a request

– Php is short for Php Home Page

– Asp jsp rhtml

Page 16: Indroduction to Web Application

Application Server

PHP

Page 17: Indroduction to Web Application

Application Server

How it works– Listen to a port (default 80)

– Accept a http request

– Processing request• If static content, return that stupid file

• If dynamic – Run the interpreter such as php interpreter– The interpreter interpret user program(php file)– Interpreter return the interpret result

– Send result back as a http response

Page 18: Indroduction to Web Application

Application Server

PHP style language limitation– Each interpreter instance for a request

– No server global context

– Low performance nature JAVA style (JAVA .NET)

– Virtual machine execution (keep programmer from low level memory ops)

– Compile instead interpret (greatly improve performance)

– Web app and server all run in One VM

Page 19: Indroduction to Web Application

Application Server

How it works (JAVA style) – JVM start a JAVA program (that's server)

– Listen to a port (default 80)(run in VM)

– Accept a http request (run in VM)

– Processing request (run in VM)• If static content, return that stupid file

• If dynamic– Parse the http request– Call the user define method which should

process this request,

– Send result back as a http response(run in VM)

Page 20: Indroduction to Web Application

Application Server

JAVA program server should be– Tomcat (widely used)

– Jetty (we use in current project)

– Websphere (widely used in commercial) The user define method should be

– doGet(request, response)

– doPost(request, response)

Page 21: Indroduction to Web Application

Beyond This

Web Service Web Socket High Performance Web High Availability Distribute Web

Page 22: Indroduction to Web Application

Q & AThank!