yanzhenjie / AndServer

:cherries: Web server and web framework of Android platform.
https://yanzhenjie.com/AndServer
Apache License 2.0
3.74k stars 755 forks source link

ResponseBody类的使用方法示例代码报错 #513

Closed qiubin2016 closed 7 months ago

qiubin2016 commented 1 year ago

文档地址:https://yanzhenjie.com/AndServer/class/ResponseBody.html

@Controller public class ProjectController {

@GetMapping("/project/info")
public void info(HttpResponse response) {
    String content = ...;
    RequestBody body = new StringBody(content);
    response.setBody(body);
}

} 客户端请求/project/info报异常:com.yanzhenjie.andserver.error.ServerInternalException: Server internal error, The return value of [null] is not supported.

yanzhenjie commented 12 months ago

普通的Controller不能直接操作HttpResponse,看起来你应该需要使用RestController。