Polishing
This commit is contained in:
@@ -180,12 +180,11 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
|
||||
* names. Encoding is based on the encoded-word syntax defined in RFC 2047
|
||||
* and relies on {@code MimeUtility} from "javax.mail".
|
||||
* <p>If not set file names will be encoded as US-ASCII.
|
||||
* @param multipartCharset the charset to use
|
||||
* @since 4.1.1
|
||||
* @see <a href="http://en.wikipedia.org/wiki/MIME#Encoded-Word">Encoded-Word</a>
|
||||
*/
|
||||
public void setMultipartCharset(Charset multipartCharset) {
|
||||
this.multipartCharset = multipartCharset;
|
||||
public void setMultipartCharset(Charset charset) {
|
||||
this.multipartCharset = charset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -115,37 +115,16 @@ public class ServletHttpHandlerAdapter implements Servlet {
|
||||
this.httpHandler.handle(httpRequest, httpResponse).subscribe(subscriber);
|
||||
}
|
||||
|
||||
protected ServerHttpRequest createRequest(HttpServletRequest request,
|
||||
AsyncContext context) throws IOException {
|
||||
|
||||
protected ServerHttpRequest createRequest(HttpServletRequest request, AsyncContext context) throws IOException {
|
||||
return new ServletServerHttpRequest(
|
||||
request, context, getDataBufferFactory(), getBufferSize());
|
||||
}
|
||||
|
||||
protected ServerHttpResponse createResponse(HttpServletResponse response,
|
||||
AsyncContext context) throws IOException {
|
||||
|
||||
protected ServerHttpResponse createResponse(HttpServletResponse response, AsyncContext context) throws IOException {
|
||||
return new ServletServerHttpResponse(
|
||||
response, context, getDataBufferFactory(), getBufferSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* We cannot combine ERROR_LISTENER and HandlerResultSubscriber due to:
|
||||
* https://issues.jboss.org/browse/WFLY-8515
|
||||
*/
|
||||
private static void runIfAsyncNotComplete(AsyncContext asyncContext, Runnable task) {
|
||||
try {
|
||||
if (asyncContext.getRequest().isAsyncStarted()) {
|
||||
task.run();
|
||||
}
|
||||
}
|
||||
catch (IllegalStateException ex) {
|
||||
// Ignore:
|
||||
// AsyncContext recycled and should not be used
|
||||
// e.g. TIMEOUT_LISTENER (above) may have completed the AsyncContext
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Other Servlet methods...
|
||||
|
||||
@@ -168,6 +147,23 @@ public class ServletHttpHandlerAdapter implements Servlet {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* We cannot combine ERROR_LISTENER and HandlerResultSubscriber due to:
|
||||
* https://issues.jboss.org/browse/WFLY-8515
|
||||
*/
|
||||
private static void runIfAsyncNotComplete(AsyncContext asyncContext, Runnable task) {
|
||||
try {
|
||||
if (asyncContext.getRequest().isAsyncStarted()) {
|
||||
task.run();
|
||||
}
|
||||
}
|
||||
catch (IllegalStateException ex) {
|
||||
// Ignore: AsyncContext recycled and should not be used
|
||||
// e.g. TIMEOUT_LISTENER (above) may have completed the AsyncContext
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private final static AsyncListener ERROR_LISTENER = new AsyncListener() {
|
||||
|
||||
@Override
|
||||
@@ -193,16 +189,15 @@ public class ServletHttpHandlerAdapter implements Servlet {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private class HandlerResultSubscriber implements Subscriber<Void> {
|
||||
|
||||
private final AsyncContext asyncContext;
|
||||
|
||||
|
||||
HandlerResultSubscriber(AsyncContext asyncContext) {
|
||||
this.asyncContext = asyncContext;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Subscription subscription) {
|
||||
subscription.request(Long.MAX_VALUE);
|
||||
|
||||
Reference in New Issue
Block a user