您的位置:首页 > 编程语言 > Java开发

JavaWeb学习记录(二)——防盗链技术

2015-06-30 16:10 537 查看
public class TestServlet extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String value=request.getHeader("referer");
System.out.println(value);
if(value!=null&&value.startsWith("http://localhost:8080/web04")){
System.out.println("正常访问");
}else{
System.out.println("不可访问");
}
}

public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: