You've already forked FrameTour-BE
2
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package com.ycwl.basic.config;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
import java.io.*;
|
||||
|
||||
public class CachedBodyHttpServletRequest extends HttpServletRequestWrapper {
|
||||
private final byte[] cachedBody;
|
||||
|
||||
public CachedBodyHttpServletRequest(HttpServletRequest request) throws IOException {
|
||||
super(request);
|
||||
// 缓存请求体内容
|
||||
InputStream requestInputStream = request.getInputStream();
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int read;
|
||||
while ((read = requestInputStream.read(buffer)) != -1) {
|
||||
byteArrayOutputStream.write(buffer, 0, read);
|
||||
}
|
||||
cachedBody = byteArrayOutputStream.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletInputStream getInputStream() {
|
||||
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(cachedBody);
|
||||
return new ServletInputStream() {
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return byteArrayInputStream.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadListener(ReadListener readListener) {
|
||||
// 不需要实现
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedReader getReader() throws IOException {
|
||||
return new BufferedReader(new InputStreamReader(this.getInputStream()));
|
||||
}
|
||||
|
||||
public byte[] getCachedBody() {
|
||||
return cachedBody;
|
||||
}
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
//package com.ycwl.basic.config;
|
||||
//
|
||||
//import org.redisson.Redisson;
|
||||
//import org.redisson.api.RedissonClient;
|
||||
//import org.redisson.config.Config;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
//@Configuration
|
||||
//public class RedissonConfig {
|
||||
//
|
||||
// @Value("${spring.redis.host}")
|
||||
// private String host;
|
||||
// @Value("${spring.redis.port}")
|
||||
// private String port;
|
||||
// @Value("${spring.redis.password}")
|
||||
// private String password;
|
||||
//
|
||||
// @Bean
|
||||
// public RedissonClient getRedisSon() {
|
||||
// Config config = new Config();
|
||||
// String address = new StringBuilder("redis://").append(host).append(":").append(port).toString();
|
||||
// config.useSingleServer().setAddress(address);
|
||||
// if (null != password && !"".equals(password.trim())) {
|
||||
// config.useSingleServer().setPassword(password);
|
||||
// }
|
||||
// return Redisson.create(config);
|
||||
// }
|
||||
//
|
||||
//}
|
@@ -12,7 +12,7 @@ public class SchedulerConfig {
|
||||
@Bean
|
||||
public ThreadPoolTaskScheduler taskScheduler() {
|
||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
||||
scheduler.setPoolSize(256);
|
||||
scheduler.setPoolSize(128);
|
||||
scheduler.setThreadNamePrefix("Scheduler-");
|
||||
return scheduler;
|
||||
}
|
||||
|
Reference in New Issue
Block a user