欢迎来到天天文库
浏览记录
ID:3914150
大小:602.60 KB
页数:20页
时间:2017-11-25
《head first 串讲笔记》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、<>Servletservice(ServletRequest,ServletResponse)init(ServletConfig)destroy()ServletConfiggetServletConfig()StringgetServletInfo()<>GenericServletservice(ServletRequest,ServletResponse)init(ServletConfig)init()destroy()getServletConf
2、ig():ServletConfiggetServletInfo():StringgetInitParameter(String):StringgetInitParameterNames():EnumerationgetServletContext():ServletContextlog(String):Stringlog(String,Throwable):String<>HttpServlet■XXX:Get(預設值)、Post(非等冪notidempotent)、#servi
3、ce(HttpServletRequest,HttpServletResponse)Head(Get原本回傳的標頭)、service(ServletRequest,ServletResponse)#doXXX(HttpServletRequest,HttpServletResponse)Options(列出可回應的HTTP方法)、#getLastModified(HttpServletRequest):longPut、Trace、Delete■Idempotent:對服務進行多次操作,其結果與操作一次
4、相同。<>ServletRequestgetAttribute(String):Object<>getContentLength():intServletResponsegetInputStream():ServletInputStreamgetReader():BufferedReadergetBufferSize():intgetRemoteXXX()■XXX:Addr(回傳ip)、setContentType(String)getServerXXX()
5、Name(forServer)/Host(forRemote)setContentLength(int)getRemotePort():int客戶端連接埠(回傳DomainName)getOutputStream():ServletOutputStream位元組write()getWriter():PrintWriter字元println()getServerPort():int原目標埠getLocalPort():int實際抵達埠//othermethods…getParameter(String)
6、:StringgetParameterNames():Enumeration//othermethods…<>雖然請求總是被送往單一埠,但伺HttpServletResponse服器會為每個執行緒找一個不同的本地連接埠,讓web應用程式可以addCookie(Cookie)同時服務多個客戶端。addHeader(Stringname,Stringvalue)添加額外值<>setHeader(Stringname,Stringvalue)覆寫既有值HttpSe
7、rvletRequestsetIntHeader(Stringname,Stringvalue)Cookie失效,getContextPath():StringencodeURL(Stringurl):String需要URL重寫時:getCookies():Cookie[]encodeRedirectURL(Stringurl):StringgetHeader(String):StringsendError(int)getHeaders():EnumerationsendRedirect(String
8、)“/”開頭:相對於container根目錄getQueryString():StringsetStatus(int)getSession():HttpSession//othermethods…getSession(boolean):HttpSessiongetMethod():String■重導=客戶端isUserInRole():boolean請求分派=伺服器RequestDispatcherview//othermethods…=request.
此文档下载收益归作者所有