Commit 84b61e36 authored by xiaoguang.xu's avatar xiaoguang.xu

修复错误的301

parent ad413f24
......@@ -32,6 +32,8 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.MessageDigest;
......@@ -282,8 +284,24 @@ public class WeChatController implements IBaseController {
}
String queryString = request.getQueryString();
String redirectUrl = redirect + "?" + queryString;
response.setHeader("Location", redirectUrl);
response.setStatus(301);
StringBuilder html = new StringBuilder();
html.append("<!DOCTYPE html>\n" +
"<html>\n" +
"<head>\n" +
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n" +
"</head>\n" +
"<body>");
html.append(String.format("<a href=\"%s\">让我们走</a>", redirectUrl));
html.append("</body>\n" +
"</html>");
response.setContentType("text/html;charset=utf-8");
try {
PrintWriter out = response.getWriter();
out.write(html.toString());
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment