Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
zhangshaowu
/
pipi-helper
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 61a10da9
authored
Oct 16, 2022
by
zhangshaowu
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
跨域
1 parent
39c35eba
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
src/main/java/com/pipihelper/project/configurer/WebMvcConfigurer.java
src/main/java/com/pipihelper/project/configurer/WebMvcConfigurer.java
View file @
61a10da
package
com
.
pipihelper
.
project
.
configurer
;
package
com
.
pipihelper
.
project
.
configurer
;
import
java.io.IOException
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.alibaba.fastjson.support.config.FastJsonConfig
;
import
com.alibaba.fastjson.support.config.FastJsonConfig
;
import
com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter
;
import
com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter
;
import
com.pipihelper.project.core.Result
;
import
com.pipihelper.project.core.ResultCode
;
import
com.pipihelper.project.core.ResultCode
;
import
com.pipihelper.project.core.ServiceException
;
import
com.pipihelper.project.core.ServiceException
;
import
com.pipihelper.project.core.Result
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -36,6 +23,15 @@ import org.springframework.web.servlet.config.annotation.CorsRegistry;
...
@@ -36,6 +23,15 @@ import org.springframework.web.servlet.config.annotation.CorsRegistry;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
/**
/**
* Spring MVC 配置
* Spring MVC 配置
*/
*/
...
@@ -101,7 +97,7 @@ public class WebMvcConfigurer extends WebMvcConfigurerAdapter {
...
@@ -101,7 +97,7 @@ public class WebMvcConfigurer extends WebMvcConfigurerAdapter {
@Override
@Override
public
void
addCorsMappings
(
CorsRegistry
registry
)
{
public
void
addCorsMappings
(
CorsRegistry
registry
)
{
registry
.
addMapping
(
"/**"
)
registry
.
addMapping
(
"/**"
)
.
allowedOrigins
(
"*"
)
.
allowedOrigin
Pattern
s
(
"*"
)
.
allowedMethods
(
"POST"
,
"GET"
,
"PUT"
,
"OPTIONS"
,
"DELETE"
)
.
allowedMethods
(
"POST"
,
"GET"
,
"PUT"
,
"OPTIONS"
,
"DELETE"
)
.
allowCredentials
(
true
)
.
allowCredentials
(
true
)
.
allowedHeaders
(
"*"
)
.
allowedHeaders
(
"*"
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment