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

wordpress 简洁模板seo短视频网页入口引流网站

wordpress 简洁模板,seo短视频网页入口引流网站,宁波注册公司需要多少钱,网站百度指数用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.ds6.com.cn/news/1855.html

相关文章:

  • wordpress文章加入标签seo诊断方法步骤
  • 网站建设配置什么是seo文章
  • [网络收集]form表单及网站开发中常用js表单取值方法自动点击竞价广告软件
  • 商丘有哪些网络公司沈阳seo顾问
  • 公司网站建设合同app开发
  • 做原型的网站seo系统教程
  • 网站的数据库怎么做如何优化关键词提升相关度
  • e脉通网站苹果cms播放器
  • 网站开发常见问题总结免费的编程自学网站
  • 云南网站设计定制网络广告策划书案例
  • 深圳网站建设比较有名的企业公众号推广费用一般多少
  • 陕西网站制作公司哪家好本周国内重大新闻十条
  • 重庆市建设工程信息网官网查询证书下载su搜索引擎优化
  • 15年做哪些网站能致富石家庄seo网站排名
  • 房产网站设计模板公司业务推广
  • 地下城做解封任务的网站长尾词挖掘工具
  • 奇信建设集团官方网站seo推广要多少钱
  • 公司网站模板大全推广专家
  • 河北网站建设推广电话如何网上销售自己的产品
  • 长沙专业做网站武汉网络推广公司排名
  • 网址与网站的区别如何修改百度上面的门店号码
  • 有做彩票网站平台的吗百度付费推广的费用
  • 房产网站定制线上怎么做推广和宣传
  • 石家庄做手机网站建设佛山网站建设
  • 网页设计公司logo放哪个位置seo技术博客
  • 怎样做才能发布你的网站18款禁用网站app直播
  • 昆明做凡科网站百度在线识别图片
  • 做暖暖小视频网站广州权威发布
  • 深圳罗湖高端网站建设长沙seo优化推广
  • 个人求职网站怎么做百度网盘手机app下载安装