防止盗链:

public void doTag() throws JspException, IOException {
JspFragment jf = this.getJspBody();
PageContext pc = (PageContext)this.getJspContext();
HttpServletRequest request = (HttpServletRequest)pc.getRequest();
String host = request.getHeader(“referer”);
if(host==null || !host.startsWith(“http://localhost”)){
throw new SkipPageException();
}

}

你可能感兴趣的:(防止盗链:)