Charpter 1 The Servlet Technology Model 1.1 Servlet Http Method L GET: Getting Resources N Click Hyper Link N In the browser address bar type address l POST: Update Resource n HTML
The tag method property value is POST L HEAD: Responding to the N browser with the requested HEAD information to keep synchronous offline L PUT: Save the message as a resource indicated by the URI L Option: list Options for servers or resources L DELTE: Delete Resources marked by URI L TRACE: Debug Customer and Server Communication Note:
HTTP request the default method: GET 1.2 Request l ServletRequest interface n Parameter u public String getParameter (String name) u public Enumeration getParameterNames () u public String [] getParameterValues () n receives the character stream u public BufferedReader getReader () n number of reception bit stream u public ServletInputStream getInputStream () l HttpServletRequest interface n HEAD information u public String getHeader (String name) u public Enumeration getHeaders (String name) u public long getDateHeader (String name) u public int getIntHeader (String name) u public Enumeration getHeaderNames () Remarks : And the method at which the HTTP protocol is related to HTTPSERVLETREQUEST, other belongs to servletRequest 1.3 Response L servletResponse N Set the response content type and encoding mode u public void setContentType (String type) n response string U public java.io.printwriter getWriter () n response to stream digital (binary) u public javax.servlet.ServletOutputStream getOutputStream () l HttpServletResponse n HTTP response header information setting u public void setHeader (String name, String value) u public void setIntHeader (String name, int value) u Public void setdateHeader (String name, long value) n Add HTTP response header information u public void addHeader (String name, String value) u public void addIntHeader (String name, int value) u public void addDateHeader (String name, long value) n detected header information u public boolean containsHeader (String name) n send an error message u public void sendError (int sc) u public void sendError (int sc, String msg) n URL redirection u public void sendRedirect (String location) n Add Cookie u public void addCookie (Cookie cookie) n made Cookie u public cookie [] getCookie () N setting state u public void setstatus (int Sc, String MSG) Remarks: