无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

tomcat使用的request的源碼

2020-05-05 17:30 作者:小垃圾kiki  | 我要投稿
package cn.itcast.servlet.request;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
?* Servlet implementation class RequestDemo1
?*/
@WebServlet("/RequestDemo1")
public class RequestDemo1 extends HttpServlet {
?? ?private static final long serialVersionUID = 1L;
????? ?
??? /**
???? * @see HttpServlet#HttpServlet()
???? */
??? public RequestDemo1() {
??????? super();
??????? // TODO Auto-generated constructor stub
??? }

?? ?/**
?? ? * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
?? ? */
?? ?protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
?? ??? ?//1.獲取請求方式:GET
//?? ??? ?String method = request.getMethod();
//?? ??? ?System.out.println(method);
?? ??? ?//2.獲取虛擬目錄
//?? ??? ?String contextPath = request.getContextPath();
//?? ??? ?System.out.println(contextPath);
?? ??? ?//3.獲取Servlet路徑:/demo1
?? ??? ?String servletPath = request.getServletPath();
?? ??? ?System.out.println(servletPath);
//?? ??? ?//4.獲取get方式請求的參數(shù)
//?? ??? ?String queryString = request.getQueryString();
//?? ??? ?System.out.println(queryString);
//?? ??? ?//5.獲取請求URI
//?? ??? ?String requestURI = request.getRequestURI();
//?? ??? ?StringBuffer requestURL = request.getRequestURL();
//?? ??? ?System.out.println(requestURI);
//?? ??? ?System.out.println(requestURL);
//?? ??? ?//6.獲取協(xié)議和版本
//?? ??? ?String protocol = request.getProtocol();
//?? ??? ?System.out.println(protocol);
//?? ??? ?//7.獲取客戶機的IP地址
//?? ??? ?String remoteAddr = request.getRemoteAddr();
//?? ??? ?System.out.println(remoteAddr);
?? ?}

?? ?/**
?? ? * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
?? ? */
?? ?protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
?? ??? ?// TODO Auto-generated method stub
?? ??? ?doGet(request, response);
?? ?}

}

tomcat使用的request的源碼的評論 (共 條)

分享到微博請遵守國家法律
石门县| 黄大仙区| 德清县| 南川市| 阿拉善盟| 鹰潭市| 汝阳县| 内丘县| 行唐县| 锦州市| 灵宝市| 万载县| 五河县| 喀喇沁旗| 霍林郭勒市| 舟曲县| 称多县| 子洲县| 三原县| 宜宾市| 滨州市| 长海县| 新闻| 历史| 宁南县| 丰宁| 海淀区| 阳西县| 定结县| 渭南市| 桑日县| 曲麻莱县| 综艺| 菏泽市| 年辖:市辖区| 凤庆县| 常熟市| 扎囊县| 盐城市| 和龙市| 治县。|