Download - We used J2SE until now For web application development, we ...

Transcript
Page 1: We used J2SE until now For web application development, we ...

7/14/2009

1

Asher ImtiazForman Christian College

Umair JavedLUMS

Web Application Development

� We used J2SE until now

� For web application development, we need J2EE (Servlets API, JSP API, JSF API etc)

Page 2: We used J2SE until now For web application development, we ...

7/14/2009

2

Page 3: We used J2SE until now For web application development, we ...

7/14/2009

3

A communications model

• Client, often but not always a web browser,

sends a request for a resource to a server.

•The server returns a response or an error message.

• Stateless

• No immediate feedback

• No details on how request is made

Page 4: We used J2SE until now For web application development, we ...

7/14/2009

4

Different clients like

•Web browsers

•FTP clients (e.g., interarchy on MacOS X)

•Software registration programs

•telnet

Web Server?

Software that provides services to access the Internet, or an

intranet.

A web server hosts web sites Provides support for HTTP and

other protocols Executes server-side programs (such as CGI

scripts or servlets) that perform certain functions.

Page 5: We used J2SE until now For web application development, we ...

7/14/2009

5

Web Application Development

� HTTP is a request-response oriented protocol.

� Parts of an HTTP request

� Request Method

� URI

� Header Fields

� Body

� HTTP response contains

� Result Code

� Header Fields

� Body

Page 6: We used J2SE until now For web application development, we ...

7/14/2009

6

� Protocol used by ALL Web communications

� HTTP Methods

� GET - Fetch a document

� POST - Execute the document, using the data in

body

� HEAD - Fetch just the header of the document

� PUT - Store a new document on the server

� DELETE - Remove a document from the server

*Taken from Programming the World Wide Web book

Request parameters etc

Page 7: We used J2SE until now For web application development, we ...

7/14/2009

7

� Request can also contain additional info in the form of parameters

� In the URL itself as a query stringhttp://www.gmail.com/register?name=ali&state=punjab

� As part of the request body

▪ Shown earlier in the diagram

Page 8: We used J2SE until now For web application development, we ...

7/14/2009

8

� Codes fall into five general categories

� 100-199

▪ Codes in the 100s are informational, indicating that the client should respond with some other action.

� 200-299

▪ Values in the 200s signify that the request was successful.

� 300-399

▪ Values in the 300s are used for files that have moved and usually include a Location header indicating the new address.

� 400-499

▪ Values in the 400s indicate an error by the client.

� 500-599

▪ Codes in the 500s signify an error by the server.

� 200: means every thing is fine.

� 404: Indicates that the requested resource is not available

� 401: Indicates that the request requires HTTP authentication

� 403: Indicates that access to the requested resource has been denied

� 503: Indicates that the HTTP server is temporarily overloaded and unable to handle the request

Page 9: We used J2SE until now For web application development, we ...

7/14/2009

9

2 - Retrieve file

3 - Send file

1 - Request file

Page 10: We used J2SE until now For web application development, we ...

7/14/2009

10

Do Computation

Generate HTML

page with results

of computation

Return dynamically

generated HTML file

1 - Request service

Page 11: We used J2SE until now For web application development, we ...

7/14/2009

11

� The Web page is based on data submitted by the user

� E.g. results page from search engines and order confirmation pages at on line stores

� The Web page is derived from data that changes frequently

� E.g. a weather report or news headlines page

� The Web page uses information from databases or other server-side resources

� E.g. an e-commerce site could use a servlet to build a Web page that lists the current price and availability of each item that is for sale

� Course Registration System

Page 12: We used J2SE until now For web application development, we ...

7/14/2009

12

� Technologies for developing web pages that include dynamic content.

� Can produce web pages that contain information that is connection- or time-dependent.

Page 13: We used J2SE until now For web application development, we ...

7/14/2009

13

CGI(in C)

Template

(ASP,

PHP,CFML)

Servlet(Java)

CGI(java, C++)

JSP

Speed, Securitycomplexity

Figure shows a simplified view of one application and its layers.

Page 14: We used J2SE until now For web application development, we ...

7/14/2009

14

Web Application Development

Page 15: We used J2SE until now For web application development, we ...

7/14/2009

15

http://en.wikipedia.org/wiki/Web_server

� Jakarta is an Apache project� Tomcat is one of its subprojects

� Tomcat is the official reference implementation for the Java servlet and JavaServer pages technologies (according to Sun’s specifications)

� Tomcat is developed in an open and participatory environment and released under the Apache software license

Page 16: We used J2SE until now For web application development, we ...

7/14/2009

16

� Details in Handout