标签:header over print ons 第四篇 row Servle ted cep
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("text/html;charset=utf-8");
String referer = req.getHeader("Referer");
if(referer==null|| !"http://localhost:8080/a".equals(referer)){
PrintWriter writer = resp.getWriter();
writer.write("防盗链");
}else{
PrintWriter writer = resp.getWriter();
writer.write("路飞在跑");
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("text/html;charset=utf-8");
PrintWriter writer = resp.getWriter();
writer.write("a");
req.getRequestDispatcher("/b").forward(req,resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("text/html;charset=utf-8");
PrintWriter writer = resp.getWriter();
req.getRequestDispatcher("/c").include(req, resp);//匹配的Servlet代码writer.write("c");
writer.write("a");
req.getRequestDispatcher("/d").include(req, resp);//匹配的Servlet代码writer.write("d");
}
//页面显示:cad
标签:header over print ons 第四篇 row Servle ted cep
原文地址:https://www.cnblogs.com/kwdlh/p/12637268.html