Commit 10436160 by Dave Syer

Whitespace tidy up

parent c2913588
...@@ -22,15 +22,17 @@ import org.springframework.web.context.request.async.DeferredResult; ...@@ -22,15 +22,17 @@ import org.springframework.web.context.request.async.DeferredResult;
import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.context.request.async.WebAsyncUtils;
import org.springframework.web.method.support.AsyncHandlerMethodReturnValueHandler; import org.springframework.web.method.support.AsyncHandlerMethodReturnValueHandler;
import org.springframework.web.method.support.ModelAndViewContainer; import org.springframework.web.method.support.ModelAndViewContainer;
import rx.Observable; import rx.Observable;
import rx.functions.Action1; import rx.functions.Action1;
/** /**
* Handles return values of type {@link rx.Observable}. * MVC handler for return values of type {@link rx.Observable}.
* *
* @author Spencer Gibb * @author Spencer Gibb
*/ */
public class ObservableReturnValueHandler implements AsyncHandlerMethodReturnValueHandler { public class ObservableReturnValueHandler
implements AsyncHandlerMethodReturnValueHandler {
@Override @Override
public boolean isAsyncReturnValue(Object returnValue, MethodParameter returnType) { public boolean isAsyncReturnValue(Object returnValue, MethodParameter returnType) {
...@@ -43,7 +45,9 @@ public class ObservableReturnValueHandler implements AsyncHandlerMethodReturnVal ...@@ -43,7 +45,9 @@ public class ObservableReturnValueHandler implements AsyncHandlerMethodReturnVal
} }
@Override @Override
public void handleReturnValue(Object returnValue, MethodParameter returnType, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception { public void handleReturnValue(Object returnValue, MethodParameter returnType,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest)
throws Exception {
if (returnValue == null) { if (returnValue == null) {
mavContainer.setRequestHandled(true); mavContainer.setRequestHandled(true);
return; return;
...@@ -53,17 +57,17 @@ public class ObservableReturnValueHandler implements AsyncHandlerMethodReturnVal ...@@ -53,17 +57,17 @@ public class ObservableReturnValueHandler implements AsyncHandlerMethodReturnVal
final DeferredResult<Object> deferredResult = new DeferredResult<>(); final DeferredResult<Object> deferredResult = new DeferredResult<>();
observable.subscribe(new Action1<Object>() { observable.subscribe(new Action1<Object>() {
@Override @Override
public void call(Object o) { public void call(Object o) {
deferredResult.setResult(o); deferredResult.setResult(o);
} }
}, new Action1<Throwable>() { }, new Action1<Throwable>() {
@Override @Override
public void call(Throwable throwable) { public void call(Throwable throwable) {
deferredResult.setErrorResult(throwable); deferredResult.setErrorResult(throwable);
} }
}); });
WebAsyncUtils.getAsyncManager(webRequest) WebAsyncUtils.getAsyncManager(webRequest)
.startDeferredResultProcessing(deferredResult, mavContainer); .startDeferredResultProcessing(deferredResult, mavContainer);
......
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