当前位置:网站首页>通过Referer请求头实现防盗链
通过Referer请求头实现防盗链
2022-07-25 11:21:00 【JackLi0812】
通过Referer请求头实现防盗链
<a href="${pageContext.request.contextPath }/NewsServlet">重磅新闻</a>public class NewsServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.getWriter().write("本大侠吃包子....");
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
public class NewsServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
String referer = request.getHeader("Referer");
if(referer == null || "".equals(referer) || !referer.contains("localhost/")) {
response.sendRedirect(request.getContextPath() + "/index.jsp");
return;
}
response.getWriter().write("本大侠吃包子....");
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}

边栏推荐
- Power Bi -- these skills make the report more "compelling"“
- Solutions to the failure of winddowns planning task execution bat to execute PHP files
- brpc源码解析(六)—— 基础类socket详解
- LeetCode第303场周赛(20220724)
- Innovation and breakthrough! AsiaInfo technology helped a province of China Mobile complete the independent and controllable transformation of its core accounting database
- 【AI4Code】《Unified Pre-training for Program Understanding and Generation》 NAACL 2021
- OSPF综合实验
- 【AI4Code】《InferCode: Self-Supervised Learning of Code Representations by Predicting Subtrees》ICSE‘21
- brpc源码解析(一)—— rpc服务添加以及服务器启动主要过程
- Sword finger offer 22. the penultimate node in the linked list
猜你喜欢

【AI4Code】《IntelliCode Compose: Code Generation using Transformer》 ESEC/FSE 2020

微信公众号开发 入手

Transformer variants (spark transformer, longformer, switch transformer)

【多模态】《HiT: Hierarchical Transformer with Momentum Contrast for Video-Text Retrieval》ICCV 2021

GPT plus money (OpenAI CLIP,DALL-E)

图神经网络用于推荐系统问题(IMP-GCN,LR-GCN)

LeetCode 50. Pow(x,n)

Brpc source code analysis (VI) -- detailed explanation of basic socket

Application of comparative learning (lcgnn, videomoco, graphcl, XMC GaN)

Javescript loop
随机推荐
Transformer变体(Routing Transformer,Linformer,Big Bird)
【GCN-RS】Learning Explicit User Interest Boundary for Recommendation (WWW‘22)
氢能创业大赛 | 国家能源局科技司副司长刘亚芳:构建高质量创新体系是我国氢能产业发展的核心
【GCN-RS】MCL: Mixed-Centric Loss for Collaborative Filtering (WWW‘22)
PHP curl post x-www-form-urlencoded
30 sets of Chinese style ppt/ creative ppt templates
微信公众号开发 入手
Scott+Scott律所计划对Yuga Labs提起集体诉讼,或将确认NFT是否属于证券产品
php curl post Length Required 错误设置header头
JS interview question: handwriting throttle function
Application and innovation of low code technology in logistics management
PHP 上传ftp路径文件到外网服务器上 curl base64图片
Objects in JS
【GCN-RS】MCL: Mixed-Centric Loss for Collaborative Filtering (WWW‘22)
已解决The JSP specification requires that an attribute name is preceded by whitespace
What is the difference between session and cookie?? Xiaobai came to tell you
【图攻防】《Backdoor Attacks to Graph Neural Networks 》(SACMAT‘21)
【多模态】《TransRec: Learning Transferable Recommendation from Mixture-of-Modality Feedback》 Arxiv‘22
【高并发】我用10张图总结出了这份并发编程最佳学习路线!!(建议收藏)
There is no sound output problem in the headphone jack on the front panel of MSI motherboard [solved]