-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.修复bejson安全防护策略拦截问题(感谢@liangbintao和@1808083642的反馈) 2.优化字段名含date字符串的处…
…理(感谢@smilexzh的反馈) 3.控制台动态输出项目访问地址(感谢@gaohanghang的提交)
- Loading branch information
1 parent
8b37443
commit 03152e5
Showing
6 changed files
with
83 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 48 additions & 48 deletions
96
generator-web/src/main/java/com/softdev/system/generator/config/WebMvcConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
package com.softdev.system.generator.config; | ||
|
||
import com.alibaba.fastjson.support.config.FastJsonConfig; | ||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.converter.HttpMessageConverter; | ||
import org.springframework.http.converter.StringHttpMessageConverter; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
import java.nio.charset.Charset; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
/** | ||
* 2019-2-11 liutf WebMvcConfig 整合 cors 和 SpringMvc MessageConverter | ||
*/ | ||
@Configuration | ||
public class WebMvcConfig implements WebMvcConfigurer { | ||
|
||
/* @Override | ||
public void addCorsMappings(CorsRegistry registry) { | ||
registry.addMapping("/**") | ||
.allowedOrigins("*") | ||
.allowedHeaders("x-requested-with") | ||
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "TRACE") | ||
.maxAge(3600); | ||
}*/ | ||
|
||
@Override | ||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { | ||
//FastJsonHttpMessageConverter | ||
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter(); | ||
|
||
List<MediaType> fastMediaTypes = new ArrayList<>(); | ||
fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8); | ||
fastConverter.setSupportedMediaTypes(fastMediaTypes); | ||
|
||
FastJsonConfig fastJsonConfig = new FastJsonConfig(); | ||
fastJsonConfig.setCharset(Charset.forName("UTF-8")); | ||
fastConverter.setFastJsonConfig(fastJsonConfig); | ||
|
||
//StringHttpMessageConverter | ||
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter(); | ||
stringConverter.setDefaultCharset(Charset.forName("UTF-8")); | ||
stringConverter.setSupportedMediaTypes(fastMediaTypes); | ||
converters.add(stringConverter); | ||
converters.add(fastConverter); | ||
} | ||
package com.softdev.system.generator.config; | ||
|
||
import com.alibaba.fastjson.support.config.FastJsonConfig; | ||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.converter.HttpMessageConverter; | ||
import org.springframework.http.converter.StringHttpMessageConverter; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
/** | ||
* 2019-2-11 liutf WebMvcConfig 整合 cors 和 SpringMvc MessageConverter | ||
*/ | ||
@Configuration | ||
public class WebMvcConfig implements WebMvcConfigurer { | ||
|
||
/* @Override | ||
public void addCorsMappings(CorsRegistry registry) { | ||
registry.addMapping("/**") | ||
.allowedOrigins("*") | ||
.allowedHeaders("x-requested-with") | ||
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "TRACE") | ||
.maxAge(3600); | ||
}*/ | ||
|
||
@Override | ||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { | ||
//FastJsonHttpMessageConverter | ||
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter(); | ||
|
||
List<MediaType> fastMediaTypes = new ArrayList<>(); | ||
fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8); | ||
fastConverter.setSupportedMediaTypes(fastMediaTypes); | ||
|
||
FastJsonConfig fastJsonConfig = new FastJsonConfig(); | ||
fastJsonConfig.setCharset(StandardCharsets.UTF_8); | ||
fastConverter.setFastJsonConfig(fastJsonConfig); | ||
|
||
//StringHttpMessageConverter | ||
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter(); | ||
stringConverter.setDefaultCharset(StandardCharsets.UTF_8); | ||
stringConverter.setSupportedMediaTypes(fastMediaTypes); | ||
converters.add(stringConverter); | ||
converters.add(fastConverter); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"version": "20191128"} | ||
{"version": "20191229"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters