This commit is contained in:
@@ -26,15 +26,23 @@ import org.redkale.util.*;
|
||||
*/
|
||||
public class HttpContext extends Context {
|
||||
|
||||
//是否开启pipeline
|
||||
protected final boolean pipeline;
|
||||
|
||||
protected final SecureRandom random = new SecureRandom();
|
||||
|
||||
protected final ConcurrentHashMap<Class, Creator> asyncHandlerCreators = new ConcurrentHashMap<>();
|
||||
|
||||
public HttpContext(HttpContextConfig config) {
|
||||
super(config);
|
||||
this.pipeline = config.pipeline;
|
||||
random.setSeed(Math.abs(System.nanoTime()));
|
||||
}
|
||||
|
||||
public final boolean isPipeline() {
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
protected String createSessionid() {
|
||||
byte[] bytes = new byte[16];
|
||||
random.nextBytes(bytes);
|
||||
@@ -179,5 +187,7 @@ public class HttpContext extends Context {
|
||||
|
||||
public static class HttpContextConfig extends ContextConfig {
|
||||
|
||||
//是否开启pipeline
|
||||
public boolean pipeline;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +320,9 @@ public class HttpServer extends Server<String, HttpContext, HttpRequest, HttpRes
|
||||
String jsonContentType = null;
|
||||
HttpCookie defaultCookie = null;
|
||||
String remoteAddrHeader = null;
|
||||
boolean pipeline = false;
|
||||
if (config != null) {
|
||||
pipeline = config.getBoolValue("pipeline", false);
|
||||
AnyValue reqs = config == null ? null : config.getAnyValue("request");
|
||||
if (reqs != null) {
|
||||
AnyValue raddr = reqs.getAnyValue("remoteaddr");
|
||||
@@ -440,6 +442,7 @@ public class HttpServer extends Server<String, HttpContext, HttpRequest, HttpRes
|
||||
contextConfig.logger = this.logger;
|
||||
contextConfig.executor = this.executor;
|
||||
contextConfig.sslContext = this.sslContext;
|
||||
contextConfig.pipeline = pipeline;
|
||||
contextConfig.bufferCapacity = rcapacity;
|
||||
contextConfig.bufferPool = bufferPool;
|
||||
contextConfig.responsePool = responsePool;
|
||||
|
||||
Reference in New Issue
Block a user