J2EE读书笔记,概念摘要1 servlet basic

来源:互联网 发布:php专家系统 编辑:程序博客网 时间:2024/04/30 10:14

 -JAR and WAR

-Use Ant
:It helps you to shutdown, complie and restart tomcat. Configured by build.xml

-Servlet Life Cycle
: Initialization(load resources, once) -> Service(accept requests and produce response, multi-threaded) -> Destruction(unload resources, once)

-HTTP requests
: Three parts(the type of action/method, the recourse to access,the version of HTTP protocol)

-HTTP headers

-Get VS Post (HTTP v1.0)
: Get can provide only simple "query string"(?...=...&...); Post sends an unlimited amount of information, it do hot have to be idempotent(幂等,意为执行任何次数都不改变它的状态),so it have a way of updating data(if an application needs to modify data, or add new data).

-In HTTP v1.1 there are seven methods. Among them only two (get&post) are commonly used

-HTTP Responce Codes
: a responce line contains Http version, a responce code(digit numbers divided into groups), and a reason phrase

-Deploying a servlet
: URL mapping in web.xml and something else

-Web Application Deployment Descriptor(web.xml) Structure
:Defination in xml has an order. If two servlets are deployed, both of the "servlet" elements, for example, must be listed before any of the "servlet-mapping" elements.

-Initial Servlet Configuration
:Param<init-param><para-name> in web.xml provides initial parameters for servlet. (it is a limited method)

-HttpServletResponse
: getWriter() & getOutputStream() (usually used for non-text-related binary information such as images); print() & println() & write()

-Response Headers
: send back with response content, which are helpful for informing a client of information such as the type of content,how much content and what type of server is sending the content. Among response headers "Content-Type" is the most important header to worry about

-Status 200
: everything is O.K. status can be sent by using setStatus() method

-Response Redirection
: Status code 302 means "resourse temporarily moved", it needs redirection by sending back a new URL in "Location" header in HTTP response

*mainly from book :Falkner & Jones, Servlet and Java Server Pages,

原创粉丝点击