【发布时间】:2018-12-27 18:58:35
【问题描述】:
I am using Swagger to get response of PUT() method. I have created a filter to limit request body size to 10000kb in my Spring boot Application. When I send request os size greater than 10000kb, i get swagger response as below.
Response Body :"no content"
Response code: 500
我参考了下面的链接 Spring boot Embedded Tomcat "application/json" post request restriction to 10KB
我用下面来注册过滤器..
@Bean
public FilterRegistrationBean loginRegistrationBean() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
filterRegistrationBean.setFilter(new ApplicationJsonRequestSizeLimitFilter());
filterRegistrationBean.setUrlPatterns(Collections.singletonList("/*"));
return filterRegistrationBean;
}
如何在响应正文中获取状态代码和过滤器抛出的自定义消息。
【问题讨论】:
标签: java rest spring-boot swagger-ui spring-filter