首页>代码>java编写一个迷你版的Tomcat服务器,适合初学者>/MiniTomcat/src/com/tomlin/tomcat/method/MyServlet.java
package com.tomlin.tomcat.method;

import com.tomlin.tomcat.handle.MyRequest;
import com.tomlin.tomcat.handle.MyResponse;

/**
 * @Author: tomlin
 * @Description: doGet方法 doPost方法  处理请求和响应
 * @ClassName: MyServlet
 * @Date: 2018/10/1 12:09
 * @Version: 1.0
 */
public abstract class MyServlet {
    //处理get请求
    public abstract void doGet(MyRequest myRequest, MyResponse myResponse);

    //处理响应
    public abstract void doPost(MyRequest myRequest, MyResponse myResponse);

    //判断浏览器发送的请求
    public void service(MyRequest myRequest, MyResponse myResponse) {
        if (myRequest.getMethod().equalsIgnoreCase("POST")) {

            doPost(myRequest, myResponse);
        } else if (myRequest.getMethod().equalsIgnoreCase("GET")) {
            doGet(myRequest, myResponse);
        }
    }
}
最近下载更多
xun9er  LV1 2023年3月18日
lironggang  LV38 2021年6月16日
1316463958  LV8 2019年10月14日
ly3812  LV17 2019年10月2日
陆地火箭  LV3 2019年7月10日
ljkfdsjh  LV2 2019年4月10日
二两小面加个蛋  LV10 2019年3月6日
pdd  LV2 2019年2月14日
myzczx  LV25 2019年2月9日
xinjames  LV27 2019年2月5日
最近浏览更多
lee123321  LV22 2023年12月19日
annazhang  LV29 2023年10月3日
xun9er  LV1 2023年3月18日
al-aaalll  LV3 2022年12月13日
xsxtxbb  LV8 2022年10月10日
tomcat_test  LV2 2022年7月6日
isfrand  LV4 2022年4月18日
3188681084  LV1 2022年3月24日
李润石  LV2 2022年1月18日
lironggang  LV38 2021年6月16日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友