package Http0824;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/demo/HttpServlet")
public class HttpServlet extends javax.servlet.http.HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("getMethod: " +request.getMethod());
System.out.println("getContextPath: " +request.getContextPath());
System.out.println("getServletPath: " + request.getServletPath());
System.out.println("getRequestsURI: " + request.getRequestURI());
System.out.println("getRequestURL:"+ request.getRequestURL());
System.out.println("getQueryString:" + request.getQueryString());
System.out.println("getRemoteAddr: " + request.getRemoteAddr());
}
}
http协议的reqeust方法getContextPath
最新推荐文章于 2022-02-25 08:40:07 发布