Commit 35ec20d0 authored by 赵啸非's avatar 赵啸非

添加返回http code 500错误

parent eecfa776
package com.mortals.xhx.base.framework.config; package com.mortals.xhx.base.framework.config;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.mortals.xhx.base.framework.DateJacksonConverter; import com.mortals.xhx.base.framework.DateJacksonConverter;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -24,8 +25,12 @@ public class ConverterConfig { ...@@ -24,8 +25,12 @@ public class ConverterConfig {
@Bean @Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter(ObjectMapper objectMapper) { public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter(ObjectMapper objectMapper) {
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(); MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
mappingJackson2HttpMessageConverter.setObjectMapper(objectMapper); mappingJackson2HttpMessageConverter.setObjectMapper(objectMapper);
return mappingJackson2HttpMessageConverter; return mappingJackson2HttpMessageConverter;
} }
} }
package com.mortals.xhx.base.framework.config; package com.mortals.xhx.base.framework.config;
import com.mortals.framework.filter.RepeatableFilter;
import com.mortals.framework.filter.XssFilter; import com.mortals.framework.filter.XssFilter;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.framework.filter.RepeatReadHttpRequest; import com.mortals.xhx.base.framework.filter.RepeatReadHttpRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -21,6 +21,7 @@ import java.util.Map; ...@@ -21,6 +21,7 @@ import java.util.Map;
* @author zxfei * @author zxfei
*/ */
@Configuration @Configuration
@Slf4j
public class FilterConfig { public class FilterConfig {
@Value("${xss.enabled}") @Value("${xss.enabled}")
private String enabled; private String enabled;
...@@ -60,7 +61,6 @@ public class FilterConfig { ...@@ -60,7 +61,6 @@ public class FilterConfig {
public static class RequestReplaceFilter implements Filter { public static class RequestReplaceFilter implements Filter {
@Override @Override
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException { public void init(javax.servlet.FilterConfig filterConfig) throws ServletException {
} }
@Override @Override
...@@ -70,6 +70,7 @@ public class FilterConfig { ...@@ -70,6 +70,7 @@ public class FilterConfig {
@Override @Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
log.info("RequestReplaceFilter~~~~~~~~~~~~~~~~~");
filterChain.doFilter(new RepeatReadHttpRequest((HttpServletRequest) servletRequest), servletResponse); filterChain.doFilter(new RepeatReadHttpRequest((HttpServletRequest) servletRequest), servletResponse);
} }
} }
......
package com.mortals.xhx.base.framework.exception; package com.mortals.xhx.base.framework.exception;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpStatus;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -10,6 +14,9 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -10,6 +14,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/** /**
* 统一异常处理 * 统一异常处理
*/ */
...@@ -17,6 +24,12 @@ import com.mortals.framework.exception.AppException; ...@@ -17,6 +24,12 @@ import com.mortals.framework.exception.AppException;
@Slf4j @Slf4j
public class ExceptionHandle { public class ExceptionHandle {
@Autowired
private HttpServletRequest request;
@Autowired
private HttpServletResponse response;
public static final String KEY_RESULT_CODE = "code"; public static final String KEY_RESULT_CODE = "code";
public static final String KEY_RESULT_MSG = "msg"; public static final String KEY_RESULT_MSG = "msg";
public static final String KEY_RESULT_DATA = "data"; public static final String KEY_RESULT_DATA = "data";
...@@ -25,6 +38,9 @@ public class ExceptionHandle { ...@@ -25,6 +38,9 @@ public class ExceptionHandle {
@ExceptionHandler(value = Exception.class) @ExceptionHandler(value = Exception.class)
@ResponseBody @ResponseBody
public String handle(Exception e) { public String handle(Exception e) {
log.info("[request url]========{}", request.getRequestURL());
response.getStatus();
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE); ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
if (e instanceof AppException) { if (e instanceof AppException) {
...@@ -33,9 +49,15 @@ public class ExceptionHandle { ...@@ -33,9 +49,15 @@ public class ExceptionHandle {
stack.getClassName(), stack.getMethodName(), stack.getLineNumber(), e.getClass().getName()); stack.getClassName(), stack.getMethodName(), stack.getLineNumber(), e.getClass().getName());
AppException ex = (AppException) e; AppException ex = (AppException) e;
ret.put(KEY_RESULT_MSG, ex.getMessage()); ret.put(KEY_RESULT_MSG, ex.getMessage());
}
if (e instanceof HttpMessageNotReadableException) {
log.error("[system error]", e);
response.setStatus(HttpStatus.HTTP_BAD_REQUEST);
ret.put(KEY_RESULT_MSG, "参数错误,"+ StrUtil.subBefore(e.getMessage(), ";", false));
} else { } else {
log.error("[system error]", e); log.error("[system error]", e);
ret.put(KEY_RESULT_MSG, "未知错误!"); response.setStatus(HttpStatus.HTTP_INTERNAL_ERROR);
ret.put(KEY_RESULT_MSG, "未知错误!" + e.getMessage());
} }
return ret.toJSONString(); return ret.toJSONString();
} }
......
...@@ -13,6 +13,7 @@ spring: ...@@ -13,6 +13,7 @@ spring:
jackson: jackson:
serialization: serialization:
WRITE_DATES_AS_TIMESTAMPS: true WRITE_DATES_AS_TIMESTAMPS: true
fail_on_empty_beans: true
default-property-inclusion: NON_NULL default-property-inclusion: NON_NULL
# time-zone: GMT+8 # time-zone: GMT+8
# date-format: yyyy-MM-dd HH:mm:ss # date-format: yyyy-MM-dd HH:mm:ss
......
...@@ -26,7 +26,7 @@ Content-Type: application/json ...@@ -26,7 +26,7 @@ Content-Type: application/json
{ {
"siteId": 1, "siteId": 1,
"appTypeNotList": [4], "appTypeNotList": [4],
"page": 1, "page": 123123123213123212312231231231,
"size": -1 "size": -1
} }
###自助终端应用列表 ###自助终端应用列表
......
...@@ -158,4 +158,4 @@ Content-Type: application/json ...@@ -158,4 +158,4 @@ Content-Type: application/json
POST {{baseUrl}}/site/getSitesGroupByAreaLevel POST {{baseUrl}}/site/getSitesGroupByAreaLevel
Content-Type: application/json Content-Type: application/json
{"areaLevel":3} {"areaLevel":3,"siteName": "%翠屏区%"}
...@@ -208,13 +208,11 @@ Content-Type: application/x-www-form-urlencoded ...@@ -208,13 +208,11 @@ Content-Type: application/x-www-form-urlencoded
businessid=125&matter=125&devicenum=C0-FB-F9-CD-3B-5D&peopleid=13 businessid=125&matter=125&devicenum=C0-FB-F9-CD-3B-5D&peopleid=13
### 参数列表组合查询 ### 参数列表组合查询
POST {{baseUrl}}/param/list POST {{baseUrl}}/param/interlist
Content-Type: application/json Content-Type: application/json
{ {
"page":1, "page":1,
"size": -1,
"firstOrganize": "Window",
"secondOrganize": "hongqi" "secondOrganize": "hongqi"
} }
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mortals.xhx</groupId>
<artifactId>smart-gov-platform</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>portal-manager</artifactId>
<packaging>jar</packaging>
<description>一体化政务门户管理平台</description>
<profiles>
<profile>
<id>develop</id>
<properties>
<profiles.active>develop</profiles.active>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.level>INFO</profiles.log.level>
<profiles.log.path>/mortals/app/logs</profiles.log.path>
<package.environment>test</package.environment>
<skipUi>false</skipUi>
</properties>
</profile>
<profile>
<id>test</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<profiles.active>test</profiles.active>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.level>INFO</profiles.log.level>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<package.environment>test</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
<profile>
<id>product</id>
<properties>
<profiles.active>product</profiles.active>
<profiles.server.path>/zwfw</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>192.168.0.250</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.nacos.server-addr>192.168.0.250:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.level>INFO</profiles.log.level>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
<profile>
<id>yibin</id>
<properties>
<profiles.active>yibin</profiles.active>
<profiles.server.port>17212</profiles.server.port>
<profiles.server.path>/zwfw</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>172.15.28.117</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.nacos.server-addr>172.15.28.120:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.level>INFO</profiles.log.level>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<package.environment>yibin</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
<profile>
<id>sngx</id>
<properties>
<profiles.active>sngx</profiles.active>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.level>INFO</profiles.log.level>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<package.environment>yibin</package.environment>
<skipUi>false</skipUi>
</properties>
</profile>
<profile>
<id>regtest</id>
<properties>
<profiles.active>regtest</profiles.active>
<profiles.server.port>17212</profiles.server.port>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.log.level>info</profiles.log.level>
<package.environment>build</package.environment>
<skipUi>false</skipUi>
</properties>
</profile>
<profile>
<id>reg</id>
<properties>
<profiles.active>reg</profiles.active>
<profiles.server.port>17212</profiles.server.port>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.log.level>info</profiles.log.level>
<package.environment>build</package.environment>
<skipUi>false</skipUi>
</properties>
</profile>
<profile>
<id>yanyuan</id>
<properties>
<profiles.active>yanyuan</profiles.active>
<profiles.server.port>17212</profiles.server.port>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.rabbitmq.host>172.16.30.245</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.nacos.server-addr>172.16.30.245:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
<profiles.holidayUrl>https://timor.tech/api/holiday/year/</profiles.holidayUrl>
</properties>
</profile>
</profiles>
<properties>
</properties>
<dependencies>
<dependency>
<groupId>com.mortals.xhx</groupId>
<artifactId>common-lib</artifactId>
</dependency>
<!-- 引入 SpringMVC 相关依赖,并实现对其的自动配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.31</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.github.javaparser</groupId>
<artifactId>javaparser-core</artifactId>
<version>3.25.6</version>
</dependency>
<!--Token生成与解析-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-bin</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>target/bin
</outputDirectory>
<resources>
<resource>
<directory>src/main/bin/</directory>
<excludes>
<exclude>deploy.sh</exclude>
</excludes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-deploy</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}/
</outputDirectory>
<resources>
<resource>
<directory>src/main/bin</directory>
<includes>
<include>deploy.sh</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<skip>${skipUi}</skip>
</configuration>
<executions>
<execution>
<id>exec-npm-install</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<arguments>
<argument></argument>
</arguments>
<workingDirectory>${project.parent.basedir}/${project.artifactId}-ui/admin</workingDirectory>
</configuration>
</execution>
<execution>
<id>exec-npm-run-build</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<arguments>
<argument>run</argument>
<arguments>${package.environment}</arguments>
</arguments>
<workingDirectory>${project.parent.basedir}/${project.artifactId}-ui/admin</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${project.artifactId}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>./assembly/assembly.xml</descriptor>
</descriptors>
<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}</outputDirectory>
</configuration>
</execution>
<execution>
<id>make-assembly-ui</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<skipAssembly>${skipUi}</skipAssembly>
<finalName>${project.artifactId}-ui</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>./assembly/assembly-manager-ui.xml</descriptor>
</descriptors>
<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
...@@ -181,7 +181,6 @@ public class AccessLogFilter implements GlobalFilter, Ordered { ...@@ -181,7 +181,6 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
} }
private void writeAccessLog(AccessLogPdu accessLogPdu) { private void writeAccessLog(AccessLogPdu accessLogPdu) {
// log.info("accessLog:{}",JSON.toJSONString(accessLogPdu));
messageProducer.syncAccessSend(accessLogPdu); messageProducer.syncAccessSend(accessLogPdu);
} }
...@@ -211,8 +210,6 @@ public class AccessLogFilter implements GlobalFilter, Ordered { ...@@ -211,8 +210,6 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
if (contentLength > 0) { if (contentLength > 0) {
httpHeaders.setContentLength(contentLength); httpHeaders.setContentLength(contentLength);
} else { } else {
// TODO: this causes a 'HTTP/1.1 411 Length Required' // on
// httpbin.org
httpHeaders.set(HttpHeaders.TRANSFER_ENCODING, "chunked"); httpHeaders.set(HttpHeaders.TRANSFER_ENCODING, "chunked");
} }
return httpHeaders; return httpHeaders;
...@@ -220,8 +217,6 @@ public class AccessLogFilter implements GlobalFilter, Ordered { ...@@ -220,8 +217,6 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
@Override @Override
public Flux<DataBuffer> getBody() { public Flux<DataBuffer> getBody() {
// log.info("outputMessage.getBody() contentLength:");
return outputMessage.getBody(); return outputMessage.getBody();
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment