Polishing

This commit is contained in:
Juergen Hoeller
2014-08-22 22:55:57 +02:00
parent 28a966f544
commit b93dd95475
9 changed files with 108 additions and 113 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.http.server;
/**
@@ -39,17 +40,17 @@ public interface ServerHttpAsyncRequestControl {
void start(long timeout);
/**
* Whether asynchronous request processing has been started.
* Return whether asynchronous request processing has been started.
*/
boolean isStarted();
/**
* Causes asynchronous request processing to be completed.
* Mark asynchronous request processing as completed.
*/
void complete();
/**
* Whether asynchronous request processing has been completed.
* Return whether asynchronous request processing has been completed.
*/
boolean isCompleted();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@ public class ServletServerHttpAsyncRequestControl implements ServerHttpAsyncRequ
private static long NO_TIMEOUT_VALUE = Long.MIN_VALUE;
private final ServletServerHttpRequest request;
private final ServletServerHttpResponse response;
@@ -52,7 +53,6 @@ public class ServletServerHttpAsyncRequestControl implements ServerHttpAsyncRequ
* respectively.
*/
public ServletServerHttpAsyncRequestControl(ServletServerHttpRequest request, ServletServerHttpResponse response) {
Assert.notNull(request, "request is required");
Assert.notNull(response, "response is required");
@@ -69,7 +69,7 @@ public class ServletServerHttpAsyncRequestControl implements ServerHttpAsyncRequ
@Override
public boolean isStarted() {
return ((this.asyncContext != null) && this.request.getServletRequest().isAsyncStarted());
return (this.asyncContext != null && this.request.getServletRequest().isAsyncStarted());
}
@Override
@@ -84,9 +84,7 @@ public class ServletServerHttpAsyncRequestControl implements ServerHttpAsyncRequ
@Override
public void start(long timeout) {
Assert.state(!isCompleted(), "Async processing has already completed");
if (isStarted()) {
return;
}
@@ -109,6 +107,7 @@ public class ServletServerHttpAsyncRequestControl implements ServerHttpAsyncRequ
}
}
// ---------------------------------------------------------------------
// Implementation of AsyncListener methods
// ---------------------------------------------------------------------
@@ -120,12 +119,15 @@ public class ServletServerHttpAsyncRequestControl implements ServerHttpAsyncRequ
}
@Override
public void onStartAsync(AsyncEvent event) throws IOException { }
public void onStartAsync(AsyncEvent event) throws IOException {
}
@Override
public void onError(AsyncEvent event) throws IOException { }
public void onError(AsyncEvent event) throws IOException {
}
@Override
public void onTimeout(AsyncEvent event) throws IOException { }
public void onTimeout(AsyncEvent event) throws IOException {
}
}

View File

@@ -45,6 +45,7 @@ import org.springframework.util.Assert;
* {@link ServerHttpRequest} implementation that is based on a {@link HttpServletRequest}.
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
* @since 3.0
*/
public class ServletServerHttpRequest implements ServerHttpRequest {