我有一个 servlet,是否可以检查请求是否来自特定域,例如“example.com”?
public abstract class MyServlet extends HttpServlet {
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
if (didOriginateFrom("example.com", req)) {
// ok to process
}
}
}
我有一台服务器会将一些工作卸载到辅助服务器(上图),只是想确保它只处理来自我的主服务器的请求,
谢谢