JSP & Servlet

来源:互联网 发布:mac怎么玩qq游戏 编辑:程序博客网 时间:2024/06/07 15:21

What’s the difference between
Web page
Web site
Web application
Web site is a collection of web page, application is something has logic determine what you get.

Web Application Architecture
Web Server
Manages requests and responses//It’s are about pages
Application Server
Application logic / data processing
Database Server
Data storage and manipulation

Client – Web App Interaction
1

2

the security we usually do on database server.

Server Side Technologies
Common Gateway Interface (CGI)
Very flexible
Application can be written in any language
Doesn’t scale well
PHP(&python)
Hypertext pre-processor
Embedded in HTML documents
Server plug-in
Scales well

write application in web page. every time request come in, it has run over.

Ruby on Rails
Pattern focussed reuse
MVC, JSON, XML
Doesn’t scale well

Rails is a framework of ruby.

Java
Servlets & JSP
Sophisticated
Java and servlet tools and frameworks
Portable
Runs in a servlet container on server
All web servers support technology
Scales well

seemly to php(php stolen), selrvlet can do a lot.

.NET
Very similar to servlets & JSP (ASP.NET)
Best support on IIS

should run on Microsoft server
JavaScript
AngularJS, Ember.js, …

3

jsp is complicate but useful.
php is simplify, easy to use, release server, effective for application.

Uniform Resource Locators

URL/URI
Uniform Resource Locator / Identifier

Uniform Resource Locator / Identifier
scheme:[//[user:password@]host[:port]][/]path[?query][#fragment]

HTTP Request Headers
Accept
Indicates MIME types browser can handle
Can send different content to different clients. For example, PNG files have good compression but are not widely supported in browsers. Could check to see if PNG is supported, sending
<IMG SRC="picture.png" ...> if it is supported, and <IMG SRC="picture.gif" ...> if not.
Warning: IE incorrectly sets this header when you hit the Refresh button. It sets it correctly on original request.
Accept-Encoding
Indicates encodings (e.g. gzip or compress) browser can handle.

Connection
In HTTP 1.0, keep-alive means browser can handle persistent connection. In HTTP 1.1, persistent connection is default. Persistent connections mean that the server can reuse the same socket for requests very close together from the same client (e.g. images associated with a page, or cells within a framed page).
Servlets can’t do this unilaterally
Give server enough info to permit persistent connections
Set Content-Length with setContentLength
using ByteArrayOutputStream to determine length of output
Cookie
Gives cookies previously sent to client.

原创粉丝点击