package com.dream.request;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class FengjieServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
String ref = request.getHeader("Referer");
if(ref==null || "".equals(ref) || !ref.startsWith("http://localhost")){
response.sendRedirect(request.getContextPath()+"/index.html");
return;//如果if语句成立,不要往下走了
}
response.getWriter().write("小明独家回忆..我在xxx的日子..很开心......");
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}