Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
a01e4498
Commit
a01e4498
authored
Sep 27, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] add mistack for delete CorsFilter
parent
b0d55663
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
CorsFilter.java
...api/src/main/java/pwc/taxtech/atms/common/CorsFilter.java
+35
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/CorsFilter.java
0 → 100644
View file @
a01e4498
package
pwc
.
taxtech
.
atms
.
common
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.filter.OncePerRequestFilter
;
import
javax.servlet.FilterChain
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
@Component
public
class
CorsFilter
extends
OncePerRequestFilter
{
@Autowired
private
AtmsApiSettings
atmsApiSettings
;
@Override
public
void
doFilterInternal
(
HttpServletRequest
request
,
HttpServletResponse
response
,
FilterChain
chain
)
throws
ServletException
,
IOException
{
response
.
setHeader
(
"Access-Control-Allow-Origin"
,
atmsApiSettings
.
getWebUrl
());
response
.
setHeader
(
"Access-Control-Allow-Credentials"
,
"true"
);
response
.
setHeader
(
"Access-Control-Allow-Methods"
,
"GET, POST, PUT, DELETE, OPTIONS"
);
response
.
setHeader
(
"Access-Control-Allow-Headers"
,
"origin, content-type, accept, x-requested-with, authorization, x-xsrf-token, X-HTTP-Method-Override, withcredentials, access-control-allow-origin,from"
);
response
.
setHeader
(
"Access-Control-Allow-Credentials"
,
"true"
);
if
(
"OPTIONS"
.
equalsIgnoreCase
(
request
.
getMethod
()))
{
return
;
}
chain
.
doFilter
(
request
,
response
);
}
}
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