Issue #1671 asymmetric trailer usage on MetaData.Request
This commit is contained in:
parent
c9959fd633
commit
0bc9149ff1
|
@ -25,6 +25,7 @@ import java.util.List;
|
|||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.servlet.DispatcherType;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
|
@ -75,9 +76,18 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
|||
private final HttpChannelState _state;
|
||||
private final Request _request;
|
||||
private final Response _response;
|
||||
private final Supplier<HttpFields> _trailerSupplier = new Supplier<HttpFields>()
|
||||
{
|
||||
@Override
|
||||
public HttpFields get()
|
||||
{
|
||||
return _trailers;
|
||||
}
|
||||
};
|
||||
private MetaData.Response _committedMetaData;
|
||||
private RequestLog _requestLog;
|
||||
private long _oldIdleTimeout;
|
||||
private HttpFields _trailers;
|
||||
|
||||
/** Bytes written after interception (eg after compression) */
|
||||
private long _written;
|
||||
|
@ -581,6 +591,7 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
|||
if (idleTO>=0 && _oldIdleTimeout!=idleTO)
|
||||
setIdleTimeout(idleTO);
|
||||
|
||||
request.setTrailerSupplier(_trailerSupplier);
|
||||
_request.setMetaData(request);
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
|
@ -608,7 +619,7 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
|||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} onTrailers {}", this, trailers);
|
||||
_request.setTrailers(trailers);
|
||||
_trailers = trailers;
|
||||
}
|
||||
|
||||
public boolean onRequestComplete()
|
||||
|
|
|
@ -39,6 +39,7 @@ import java.util.EventListener;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.AsyncContext;
|
||||
|
@ -199,7 +200,6 @@ public class Request implements HttpServletRequest
|
|||
private long _timeStamp;
|
||||
private MultiPartInputStreamParser _multiPartInputStream; //if the request is a multi-part mime
|
||||
private AsyncContextState _async;
|
||||
private HttpFields _trailers;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public Request(HttpChannel channel, HttpInput input)
|
||||
|
@ -215,9 +215,12 @@ public class Request implements HttpServletRequest
|
|||
return metadata==null?null:metadata.getFields();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public HttpFields getTrailers()
|
||||
{
|
||||
return _trailers;
|
||||
MetaData.Request metadata=_metaData;
|
||||
Supplier<HttpFields> trailers = metadata==null?null:metadata.getTrailerSupplier();
|
||||
return trailers==null?null:trailers.get();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -1859,7 +1862,6 @@ public class Request implements HttpServletRequest
|
|||
_multiPartInputStream = null;
|
||||
_remote=null;
|
||||
_input.recycle();
|
||||
_trailers = null;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -2228,11 +2230,6 @@ public class Request implements HttpServletRequest
|
|||
_scope = scope;
|
||||
}
|
||||
|
||||
public void setTrailers(HttpFields trailers)
|
||||
{
|
||||
_trailers = trailers;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public AsyncContext startAsync() throws IllegalStateException
|
||||
|
|
Loading…
Reference in New Issue