HttpServlet
HttpServletRequest类主要处理:
1.读取和写入HTTP头标B:
request.getHeader(String s);
2.取得和设置cookies
request.getCookies();
3.取得路径信息
request.getContextPath();/request.getServletPath();
4.标识HTTP会话
HttpServletResponse完成:
1.设置http头标,
response.setHeader("Refresh","3"); //三秒刷新页面一次
2设置cookie,
Cookie c1 = new Cookie("username","only"); response.addCookie(c1);
3设置返回数据类型,
response.setContentType("text/html;charset=utf-8");
4输出返回数据;
HttpServleteResponse.getOutputStream().write();