企业在网站建设上的不足,做网站的电话号码,外贸业务员招聘人才网,wordpress注册数学验证请求 客户端请求由ServletRequest类型的request对象表示#xff0c;在HTTP请求场景下#xff0c;容器提供的请求对象的具体类型为HttpServletRequest HTTP的请求消息分为三部分#xff1a;请求行、请求头、请求正文。 请求行对应方法 // 获取请求行中的协议名和版本public S… 请求 客户端请求由ServletRequest类型的request对象表示在HTTP请求场景下容器提供的请求对象的具体类型为HttpServletRequest HTTP的请求消息分为三部分请求行、请求头、请求正文。 请求行对应方法 // 获取请求行中的协议名和版本public String getProtocol();// 获取请求方式public String getMethod();// url中的额外路径信息public String getPathInfo();// url中的额外路径信息多对应的资源的真是路径public String getPathTranslated();// 获取请求URL所属的WEB应用程序路径以/开头表示整个web站点的根目录public String getContextPath();// 请求行中的参数public String getQueryString();// 获取请求行中的资源名主机端口之后参数之前的部分public String getRequestURI();// 获取Servlet所映射的路径public String getServletPath(); 网络连接信息相关方法 // 客户端的ippublic String getRemoteAddr();//客户端的主机public String getRemoteHost();//客户端的端口public int getRemotePort();// 服务器接收当前请求的网络接口的ip对应的主机名public String getLocalName();// 服务器接收当前请求的网络接口的ippublic String getLocalAddr();// 服务器接收当前请求的网络接口的端口public int getLocalPort();// 获取URLpublic StringBuffer getRequestURL();// 当前请求所指向的主机名public String getServerName();// 当前请求所连接的服务器端口号public int getServerPort();// 协议名public String getScheme(); 请求头信息 // 获取请求头public long getDateHeader(String name);public String getHeader(String name); public EnumerationString getHeaders(String name); public EnumerationString getHeaderNames();public int getIntHeader(String name);// 获取Content-Length头字段信息public int getContentLength();// 返回Content-Type头字段信息public String getContentType();// 返回请求消息的字符集编码Content-Type头字段信息public String getCharacterEncoding();public String getAuthType(); public Cookie[] getCookies();public String getRemoteUser();public boolean isUserInRole(String role);public java.security.Principal getUserPrincipal();public String getRequestedSessionId();public HttpSession getSession(boolean create);public HttpSession getSession();public String changeSessionId();public boolean isRequestedSessionIdValid();public boolean isRequestedSessionIdFromCookie();public boolean isRequestedSessionIdFromURL();public boolean isRequestedSessionIdFromUrl();public boolean authenticate(HttpServletResponse response) throws IOException,ServletException;public void login(String username, String password) throws ServletException;public void logout() throws ServletException;public CollectionPart getParts() throws IOException, ServletException;public Part getPart(String name) throws IOException, ServletException;public T extends HttpUpgradeHandler T upgrade(ClassT handlerClass) throws IOException, ServletException; 获取请求参数 // 读取url地址后的参数或者POST请求中application/x-www-form-urlencoded编码的实体// 可以对编码内容自动完成参数的分解、提取以及解码public String getParameter(String name);public EnumerationString getParameterNames();public String[] getParameterValues(String name);public MapString, String[] getParameterMap();// 获取流对象public ServletInputStream getInputStream() throws IOException; public BufferedReader getReader() throws IOException; https://zhhll.icu/2021/javaweb/基础/2.请求/ 本文由 mdnice 多平台发布