Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
84b61e36
Commit
84b61e36
authored
Jun 27, 2019
by
xiaoguang.xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复错误的301
parent
ad413f24
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
WeChatController.java
...group/xyqb/controller/external/user/WeChatController.java
+20
-2
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/WeChatController.java
View file @
84b61e36
...
...
@@ -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
();
}
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment