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);
}
}
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);
}
}
相关文章推荐
- JavaWeb学习记录(五)——Servlet随机产生验证码
- android开发环境搭建 eclipse ADT
- JavaWeb学习记录(九)——Cookie的增加、删除、查看
- JavaWeb学习记录(六)——用户登录功能之Session与验证码验证功能的实现
- JavaWeb学习记录(六)——用户登录功能之Cookie
- JavaWeb学习记录(十五)——浏览器Cookie禁用后的处理
- JavaWeb学习记录(十六)——防止表单重复提交
- JavaWeb学习记录(十七)——JSP九大隐式对象
- 【java0009】多线程同步代码块和同步函数
- Java导出数据到Excel
- webService之(二)java原生态客户端
- Java中的ReentrantLock和synchronized两种锁定机制的对比
- java面向对象的三大特性
- Java基础练习题
- 【Java基础】Swing设计_1:常用窗体
- struts2的工作机制
- JavaWeb学习记录(十九)——jsp标签库
- JavaWeb学习记录(十九)——jstl自定义标签库之传统标签
- SpringMVC+RestFul详细示例实战教程
- JavaWeb学习记录(十九)——jstl自定义标签之简单标签