Commit d95a01b9 by Ryan Baxter

Compatibility with Java 1.7 when cherry picking 50924f29

parent b9bfd4fb
...@@ -63,7 +63,7 @@ public class SendResponseFilter extends ZuulFilter { ...@@ -63,7 +63,7 @@ public class SendResponseFilter extends ZuulFilter {
this(new ZuulProperties()); this(new ZuulProperties());
} }
public SendResponseFilter(ZuulProperties zuulProperties) { public SendResponseFilter(final ZuulProperties zuulProperties) {
this.zuulProperties = zuulProperties; this.zuulProperties = zuulProperties;
// To support Servlet API 3.1 we need to check if setContentLengthLong exists // To support Servlet API 3.1 we need to check if setContentLengthLong exists
try { try {
...@@ -72,7 +72,12 @@ public class SendResponseFilter extends ZuulFilter { ...@@ -72,7 +72,12 @@ public class SendResponseFilter extends ZuulFilter {
} catch(NoSuchMethodException e) { } catch(NoSuchMethodException e) {
useServlet31 = false; useServlet31 = false;
} }
buffers = ThreadLocal.withInitial(() -> new byte[zuulProperties.getInitialStreamBufferSize()]); buffers = new ThreadLocal<byte[]>(){
@Override
public byte[] get() {
return new byte[zuulProperties.getInitialStreamBufferSize()];
}
};
} }
/* for testing */ boolean isUseServlet31() { /* for testing */ boolean isUseServlet31() {
......
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