-
Notifications
You must be signed in to change notification settings - Fork 560
/
ResourcesReturnValueHandler.java
43 lines (35 loc) · 1.51 KB
/
ResourcesReturnValueHandler.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package org.springframework.data.rest.webmvc;
import org.springframework.core.MethodParameter;
import org.springframework.data.rest.core.ResourceSet;
import org.springframework.data.rest.repository.RepositoryExporterSupport;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.method.support.ModelAndViewContainer;
/**
* {@link HandlerMethodReturnValueHandler} implementation that applies user-defined post-processors to the
* representation being sent back to the client.
*
* @author Jon Brisbin
*/
public class ResourcesReturnValueHandler
extends RepositoryExporterSupport<ResourcesReturnValueHandler>
implements HandlerMethodReturnValueHandler {
private RepositoryRestConfiguration config = RepositoryRestConfiguration.DEFAULT;
public ResourcesReturnValueHandler(RepositoryRestConfiguration config) {
if(null != config) {
this.config = config;
} else {
this.config = config;
}
}
@Override public boolean supportsReturnType(MethodParameter returnType) {
return ResourceSet.class.isAssignableFrom(returnType.getParameterType());
}
@Override
public void handleReturnValue(Object returnValue,
MethodParameter returnType,
ModelAndViewContainer mavContainer,
NativeWebRequest webRequest) throws Exception {
ResourceSet resources = (ResourceSet)returnValue;
}
}