类 ObjectHandlerMethodReturnValueHandler
java.lang.Object
cn.taketoday.web.handler.result.ObjectHandlerMethodReturnValueHandler
public class ObjectHandlerMethodReturnValueHandler
extends Object
implements HandlerMethodReturnValueHandler
HandlerMethod return Object
Iterate handlers in runtime
@GET("/object")
public Object object(boolean key1, boolean key2, boolean key3, RequestContext context) throws IOException {
if (key1) {
return new Body("key1", 1);
}
if (key2) {
Resource resource = new ClassPathResource("error/404.png");
context.setContentType(MediaType.IMAGE_JPEG_VALUE);
return ImageIO.read(resource.getInputStream());
}
if (key3) {
return ResourceUtils.getResource("classpath:application.yaml");
}
return "body:Hello";
}
- 作者:
- TODAY 2019-07-14 17:41
-
字段概要
字段从接口继承的字段 cn.taketoday.web.ReturnValueHandler
NONE_RETURN_VALUE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidhandleReturnValue(RequestContext context, Object handler, Object returnValue) Handle result of the handlerbooleansupportsHandlerMethod(HandlerMethod handler) Whether the given method is supported by this handler.booleansupportsReturnValue(Object returnValue) If thisReturnValueHandlersupports the target handler's result从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.taketoday.web.handler.result.HandlerMethodReturnValueHandler
handleHandlerMethodReturnValue, supportsHandler
-
字段详细资料
-
delegate
-
-
构造器详细资料
-
ObjectHandlerMethodReturnValueHandler
-
ObjectHandlerMethodReturnValueHandler
-
-
方法详细资料
-
handleReturnValue
public void handleReturnValue(RequestContext context, Object handler, Object returnValue) throws Exception 从接口复制的说明:HandlerMethodReturnValueHandlerHandle result of the handler- 指定者:
handleReturnValue在接口中HandlerMethodReturnValueHandler- 指定者:
handleReturnValue在接口中ReturnValueHandler- 参数:
context- Current HTTP request contexthandler- handler may be HandlerMethodreturnValue- Handler execution result OrHandlerExceptionHandlerreturn value- 抛出:
Exception- return-value handled failed
-
supportsReturnValue
从接口复制的说明:ReturnValueHandlerIf thisReturnValueHandlersupports the target handler's resultThis method can test this
ReturnValueHandlersupports the target handler in application runtime- 指定者:
supportsReturnValue在接口中ReturnValueHandler- 参数:
returnValue- Target handler's return-value or result- 返回:
- If this
ReturnValueHandlersupports the target handler's result
-
supportsHandlerMethod
从接口复制的说明:HandlerMethodReturnValueHandlerWhether the given method is supported by this handler.- 指定者:
supportsHandlerMethod在接口中HandlerMethodReturnValueHandler- 返回:
trueif this handler supports the supplied return type;falseotherwise- 另请参阅:
-