当前位置:网站首页>通过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);
}
}

边栏推荐
- 【GCN-RS】Towards Representation Alignment and Uniformity in Collaborative Filtering (KDD‘22)
- Heterogeneous graph neural network for recommendation system problems (ackrec, hfgn)
- Brpc source code analysis (V) -- detailed explanation of basic resource pool
- JS 面试题:手写节流(throttle)函数
- 【GCN-RS】Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for RS (SIGIR‘22)
- Web APIs (get element event basic operation element)
- JS operator
- brpc源码解析(二)—— brpc收到请求的处理过程
- brpc源码解析(五)—— 基础类resource pool详解
- 异构图神经网络用于推荐系统问题(ACKRec,HFGN)
猜你喜欢

Intelligent information retrieval (overview of intelligent information retrieval)

Go 垃圾回收器指南

Knowledge maps are used to recommend system problems (mvin, Ctrl, ckan, Kred, gaeat)

Transformer variants (routing transformer, linformer, big bird)

brpc源码解析(一)—— rpc服务添加以及服务器启动主要过程

LeetCode第303场周赛(20220724)

brpc源码解析(七)—— worker基于ParkingLot的bthread调度

【GCN-RS】Region or Global? A Principle for Negative Sampling in Graph-based Recommendation (TKDE‘22)

【AI4Code】《CoSQA: 20,000+ Web Queries for Code Search and Question Answering》 ACL 2021

Brpc source code analysis (I) -- the main process of RPC service addition and server startup
随机推荐
Week303 of leetcode (20220724)
Solutions to the failure of winddowns planning task execution bat to execute PHP files
【GCN-CTR】DC-GNN: Decoupled GNN for Improving and Accelerating Large-Scale E-commerce Retrieval WWW22
Solved files' name is invalid or doors not exist (1205)
LeetCode 50. Pow(x,n)
Power BI----这几个技能让报表更具“逼格“
R语言使用lm函数构建多元回归模型(Multiple Linear Regression)、使用step函数构建前向逐步回归模型筛选预测变量的最佳子集、scope参数指定候选预测变量
Objects in JS
PHP curl post x-www-form-urlencoded
Functions in JS
【GCN】《Adaptive Propagation Graph Convolutional Network》(TNNLS 2020)
Return and finally? Everyone, please look over here,
【AI4Code】《GraphCodeBERT: Pre-Training Code Representations With DataFlow》 ICLR 2021
PHP curl post x-www-form-urlencoded
[cloud co creation] what is the role of AI in mathematics? What will be the disruptive impact on the mathematical world in the future?
The JSP specification requires that an attribute name is preceded by whitespace
JS scope and pre parsing
JS 面试题:手写节流(throttle)函数
Javescript loop
浅谈低代码技术在物流管理中的应用与创新