Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
10436160
Commit
10436160
authored
Feb 18, 2016
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Whitespace tidy up
parent
c2913588
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
ObservableReturnValueHandler.java
...mework/cloud/netflix/rx/ObservableReturnValueHandler.java
+18
-14
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/rx/ObservableReturnValueHandler.java
View file @
10436160
...
...
@@ -22,15 +22,17 @@ import org.springframework.web.context.request.async.DeferredResult;
import
org.springframework.web.context.request.async.WebAsyncUtils
;
import
org.springframework.web.method.support.AsyncHandlerMethodReturnValueHandler
;
import
org.springframework.web.method.support.ModelAndViewContainer
;
import
rx.Observable
;
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
*/
public
class
ObservableReturnValueHandler
implements
AsyncHandlerMethodReturnValueHandler
{
public
class
ObservableReturnValueHandler
implements
AsyncHandlerMethodReturnValueHandler
{
@Override
public
boolean
isAsyncReturnValue
(
Object
returnValue
,
MethodParameter
returnType
)
{
...
...
@@ -43,7 +45,9 @@ public class ObservableReturnValueHandler implements AsyncHandlerMethodReturnVal
}
@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
)
{
mavContainer
.
setRequestHandled
(
true
);
return
;
...
...
@@ -53,17 +57,17 @@ public class ObservableReturnValueHandler implements AsyncHandlerMethodReturnVal
final
DeferredResult
<
Object
>
deferredResult
=
new
DeferredResult
<>();
observable
.
subscribe
(
new
Action1
<
Object
>()
{
@Override
public
void
call
(
Object
o
)
{
deferredResult
.
setResult
(
o
);
}
},
new
Action1
<
Throwable
>()
{
@Override
public
void
call
(
Throwable
throwable
)
{
deferredResult
.
setErrorResult
(
throwable
);
}
});
observable
.
subscribe
(
new
Action1
<
Object
>()
{
@Override
public
void
call
(
Object
o
)
{
deferredResult
.
setResult
(
o
);
}
},
new
Action1
<
Throwable
>()
{
@Override
public
void
call
(
Throwable
throwable
)
{
deferredResult
.
setErrorResult
(
throwable
);
}
});
WebAsyncUtils
.
getAsyncManager
(
webRequest
)
.
startDeferredResultProcessing
(
deferredResult
,
mavContainer
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment