Merge branch '5.1.x'
This commit is contained in:
@@ -246,6 +246,17 @@ public abstract class AbstractListenerWriteFlushProcessor<T> implements Processo
|
||||
super.onSubscribe(processor, subscription);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void onComplete(AbstractListenerWriteFlushProcessor<T> processor) {
|
||||
// This can happen on (very early) completion notification from container..
|
||||
if (processor.changeState(this, COMPLETED)) {
|
||||
processor.resultPublisher.publishComplete();
|
||||
}
|
||||
else {
|
||||
processor.state.get().onComplete(processor);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
REQUESTED {
|
||||
|
||||
@@ -322,6 +322,12 @@ public abstract class AbstractListenerWriteProcessor<T> implements Processor<T,
|
||||
super.onSubscribe(processor, subscription);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void onComplete(AbstractListenerWriteProcessor<T> processor) {
|
||||
// This can happen on (very early) completion notification from container..
|
||||
processor.changeStateToComplete(this);
|
||||
}
|
||||
},
|
||||
|
||||
REQUESTED {
|
||||
|
||||
@@ -259,8 +259,13 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse {
|
||||
protected abstract void applyStatusCode();
|
||||
|
||||
/**
|
||||
* Apply header changes from {@link #getHeaders()} to the underlying response.
|
||||
* This method is called once only.
|
||||
* Invoked when the response is getting committed allowing sub-classes to
|
||||
* make apply header values to the underlying response.
|
||||
* <p>Note that most sub-classes use an {@link HttpHeaders} instance that
|
||||
* wraps an adapter to the native response headers such that changes are
|
||||
* propagated to the underlying response on the go. That means this callback
|
||||
* is typically not used other than for specialized updates such as setting
|
||||
* the contentType or characterEncoding fields in a Servlet response.
|
||||
*/
|
||||
protected abstract void applyHeaders();
|
||||
|
||||
|
||||
@@ -102,8 +102,15 @@ public class JettyHttpHandlerAdapter extends ServletHttpHandlerAdapter {
|
||||
|
||||
@Override
|
||||
protected void applyHeaders() {
|
||||
MediaType contentType = getHeaders().getContentType();
|
||||
HttpServletResponse response = getNativeResponse();
|
||||
MediaType contentType = null;
|
||||
try {
|
||||
contentType = getHeaders().getContentType();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
String rawContentType = getHeaders().getFirst(HttpHeaders.CONTENT_TYPE);
|
||||
response.setContentType(rawContentType);
|
||||
}
|
||||
if (response.getContentType() == null && contentType != null) {
|
||||
response.setContentType(contentType.toString());
|
||||
}
|
||||
|
||||
@@ -119,7 +119,14 @@ class ServletServerHttpResponse extends AbstractListenerServerHttpResponse {
|
||||
this.response.addHeader(headerName, headerValue);
|
||||
}
|
||||
});
|
||||
MediaType contentType = getHeaders().getContentType();
|
||||
MediaType contentType = null;
|
||||
try {
|
||||
contentType = getHeaders().getContentType();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
String rawContentType = getHeaders().getFirst(HttpHeaders.CONTENT_TYPE);
|
||||
this.response.setContentType(rawContentType);
|
||||
}
|
||||
if (this.response.getContentType() == null && contentType != null) {
|
||||
this.response.setContentType(contentType.toString());
|
||||
}
|
||||
@@ -127,6 +134,10 @@ class ServletServerHttpResponse extends AbstractListenerServerHttpResponse {
|
||||
if (this.response.getCharacterEncoding() == null && charset != null) {
|
||||
this.response.setCharacterEncoding(charset.name());
|
||||
}
|
||||
long contentLength = getHeaders().getContentLength();
|
||||
if (contentLength != -1) {
|
||||
this.response.setContentLengthLong(contentLength);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -205,7 +205,14 @@ public class TomcatHttpHandlerAdapter extends ServletHttpHandlerAdapter {
|
||||
@Override
|
||||
protected void applyHeaders() {
|
||||
HttpServletResponse response = getNativeResponse();
|
||||
MediaType contentType = getHeaders().getContentType();
|
||||
MediaType contentType = null;
|
||||
try {
|
||||
contentType = getHeaders().getContentType();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
String rawContentType = getHeaders().getFirst(HttpHeaders.CONTENT_TYPE);
|
||||
response.setContentType(rawContentType);
|
||||
}
|
||||
if (response.getContentType() == null && contentType != null) {
|
||||
response.setContentType(contentType.toString());
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public abstract class OncePerRequestFilter extends GenericFilterBean {
|
||||
protected void doFilterNestedErrorDispatch(HttpServletRequest request, HttpServletResponse response,
|
||||
FilterChain filterChain) throws ServletException, IOException {
|
||||
|
||||
doFilter(request, response, filterChain);
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user