标签:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); String referer = request.getHeader("Referer"); if (referer == null) {//通过地址栏盗链 response.sendError(404); return; } else if (!referer.contains(getServletContext().getContextPath())) {// 通过超链接盗链 response.sendError(500, "你这个可耻的链接小偷"); return; } response.getWriter().print("下载成功"); }
标签:
原文地址:http://www.cnblogs.com/sflik/p/4567913.html