当前位置: 首页 > news >正文

做推广优化的网站有哪些江苏搜索引擎优化公司

做推广优化的网站有哪些,江苏搜索引擎优化公司,中文wordpress模板,贵阳建站用JAVA进行编写WEB项目时,我们一般需要对WEB进行统一配置,例如制定拦截路径、页面解析器、跨域配置、fastjson报文解析、文件上传大小配置等。 Getter Setter Configuration public class WebConfiguration extends WebMvcConfigurationSupport {priva…

用JAVA进行编写WEB项目时,我们一般需要对WEB进行统一配置,例如制定拦截路径、页面解析器、跨域配置、fastjson报文解析、文件上传大小配置等。

@Getter
@Setter
@Configuration
public class WebConfiguration  extends WebMvcConfigurationSupport {private static final String MATCH_ALL = "/**";@Overridepublic void addInterceptors(InterceptorRegistry registry) {registry.addInterceptor(new RequestIdInterceptor()).addPathPatterns(MATCH_ALL);registry.addInterceptor(new MockRequestEntityInterceptor()).addPathPatterns(MATCH_ALL);}@Overridepublic void addViewControllers(ViewControllerRegistry registry) {registry.addViewController("/").setViewName("index");registry.setOrder(Ordered.HIGHEST_PRECEDENCE);super.addViewControllers(registry);}/** Spring mvc 的页面解析器配置*/@Beanpublic InternalResourceViewResolver viewResolver(){InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();viewResolver.setPrefix("/");viewResolver.setSuffix(".html");return viewResolver;}/*** 跨域配置*/public CorsFilter corsFilter() {UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();source.registerCorsConfiguration("/**", corsConfig());return new CorsFilter(source);}/** Spring mvc 的静态资源路径配置*/@Overridepublic void addResourceHandlers(ResourceHandlerRegistry registry) {registry.addResourceHandler("/resource/**").addResourceLocations("classpath:/static/resource/");registry.addResourceHandler("/*.html").addResourceLocations("classpath:/static/");}/** 项目序列化使用fastjson,因序列化解析器执行是列表由前至后的优先级,故把fastjson加入到序列0的位置*/@Overridepublic void extendMessageConverters(List<HttpMessageConverter<?>> converters) {converters.set(0,fastJsonHttpMessageConverter());}/** 生成FastJsonHttpMessageConverter返回值解析器*/public FastJsonHttpMessageConverter fastJsonHttpMessageConverter() {FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();converter.setFastJsonConfig(fastJsonConfig());converter.setSupportedMediaTypes(mediaTypes());return converter;}/** 生成FastJsonHttpMessageConverter返回值解析器 - 解析详细配置*/public FastJsonConfig fastJsonConfig() {FastJsonConfig fastJsonConfig = new FastJsonConfig();fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat,SerializerFeature.WriteEnumUsingToString);// 日期时间格式及字符集配置fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");fastJsonConfig.setCharset(Charset.forName("utf-8"));// 防止Long类型转json丢失精度的问题SerializeConfig serializeConfig = SerializeConfig.globalInstance;serializeConfig.put(Long.class, ToStringSerializer.instance);serializeConfig.put(Long.TYPE, ToStringSerializer.instance);fastJsonConfig.setSerializeConfig(serializeConfig);return fastJsonConfig;}/** 生成FastJsonHttpMessageConverter返回值解析器 - 解析格式组件 支持的mediaType的类型* 1.application/json;charset=UTF-8* 2.application/json*/public List<MediaType> mediaTypes() {List<MediaType> mediaTypeList = new ArrayList<>();mediaTypeList.add(MediaType.APPLICATION_JSON_UTF8);mediaTypeList.add(MediaType.APPLICATION_JSON);return mediaTypeList;}@Beanpublic CommonsMultipartResolver multipartResolver() {CommonsMultipartResolver resolver = new CommonsMultipartResolver();resolver.setDefaultEncoding("UTF-8");//resolveLazily属性启用是为了推迟文件解析,以在在UploadAction中捕获文件大小异常resolver.setResolveLazily(true);resolver.setMaxInMemorySize(40960);//上传文件大小 5M 5*1024*1024resolver.setMaxUploadSize(5 * 1024 * 1024);return resolver;}private CorsConfiguration corsConfig() {CorsConfiguration corsConfiguration = new CorsConfiguration();corsConfiguration.addAllowedOrigin("*");corsConfiguration.addAllowedHeader("*");corsConfiguration.addAllowedMethod("*");corsConfiguration.setAllowCredentials(true);corsConfiguration.setMaxAge(3600L);return corsConfiguration;}
}

http://www.yidumall.com/news/15495.html

相关文章:

  • 互联网做网站的话术今日足球比赛预测推荐分析
  • wordpress文档管理关键词优化排名软件案例
  • 定制网站开发公司哪家好?点击查看友情链接交换群
  • 国外做兼职网站设计成都sem优化
  • 建筑工程公司需要什么资质无锡优化网站排名
  • b2b网站大全至勤新东方托福班价目表
  • 火蝠网店代运营可靠吗seo优化技术
  • 有什么展厅设计做的好的网站宁德seo优化
  • 网站主机免费电商培训机构推荐
  • 国家网站建设谷歌搜索引擎大全
  • 有名做网站公司营销技巧
  • 网站建设公司兴田德润实惠帮收款的接单平台
  • 枣强县住房和城乡建设局网站收录入口在线提交
  • 成都百度推广公司电话seo站外优化平台
  • 成都广告公司简介网站怎样优化关键词好
  • 做网站导出用什么色彩模式合肥优化营商环境
  • 福田网站建设seo信科百度点击软件找名风
  • 建设网站地图免费设计模板网站
  • 做响应式的网站有哪些潍坊新闻头条最新消息
  • 海东营销网站建设公司西安排名seo公司
  • 知道一个网站怎么知道是谁做的百度优化产品全网营销推广
  • 劳务公司网站建设外贸seo是什么意思
  • 画画在线青岛seo关键词排名
  • 在韶关做网站怎么做一个免费的网站
  • 怎么样自己做网站seo代运营
  • 网站建设公司 待遇百度如何推广网站
  • 深圳网站建设网站排名优化营销型网站模板
  • 开州区住房与城乡建设委员网站seo排名优化推广报价
  • 陕西锦宇建设有限公司网站网络营销的四大要素
  • 大型网站化方案网络营销的四大基础理论