In recent years, a large amount of software development activity has migrated from

Figure 5-1. Web Transaction Model

tải về 2.32 Mb.
Chế độ xem pdf
Chuyển đổi dữ liệu20.09.2022
Kích2.32 Mb.
1   ...   5   6   7   8   9   10   11   12   ...   16
Core JSP
Figure 5-1. Web Transaction Model 

This chapter focuses on the input to the JSP page, known as the HTTP request or 
simply the request. The next chapter focuses on the HTTP response, or simply the 
response. By creating a custom response based on the request, the resulting Web page 
is considered dynamic. The next logical step is to group these dynamic Web pages 
together for a specific Web client. This grouping is known as a session. A session is a 
system by which information about a specific client can be stored between each 
request/response pair. Sessions are covered in
Chapter 7
. By maintaining a session, 
Web pages are considered to be interactive. These two characteristics, dynamic 
content and interactivity, are what distinguish a Web application from a simple Web 
5.1 The Request 
An HTTP request is a simple data structure. It is composed of a block of text that is 
separated by newline characters. The first line is the request itself. The request line is 
made up of three sets of data. The first section is the HTTP request type, of which two 
common types are GET and POST. Next is part of the URL of the document 
requested, and finally the version of HTTP. An example request line might be: 
GET /index.html HTTP/1.0 
The next sets of lines are called headers. Headers consist of name/value pairs 
separated by a colon. Example headers might be 
followed by the type of 
server, or 
followed by the different MIME types the client will accept. 
Following the request line and header lines of an HTTP request the client can 
optionally send a blank line followed by content or "body" data. This is dependent on 
the type of HTTP request. For example, GET request does not have any body data 
after the headers section, but can include specific data within the URL. A POST 
request can include the same data after a blank line in the HTTP request. 
It is important to understand that all of the information about a client comes from the 
HTTP request. This means information about a client—such as browser type or IP 
address, as well as any data submitted via a form—is included within the HTTP 
request either in the request line, a header, or content data. 

HTTP requests are an intrinsic part of JSP pages. To find out more about HTTP see 
Core Web Programming by Marty Hall (Prentice Hall PTR, 1998). 

tải về 2.32 Mb.

Chia sẻ với bạn bè của bạn:
1   ...   5   6   7   8   9   10   11   12   ...   16

Cơ sở dữ liệu được bảo vệ bởi bản quyền © 2022
được sử dụng cho việc quản lý

    Quê hương