-
Notifications
You must be signed in to change notification settings - Fork 776
Description
@crossorigin(methods = {RequestMethod.POST, RequestMethod.GET})
@controller
@RequestMapping(path = "/offline")
public class AndAppTileController {
@GetMapping("/tiles/{z}/{x}/{y}")
public void tiles(@PathVariable(name = "z") int z,
@PathVariable(name = "x") int x,
@PathVariable(name = "y") int y,
HttpResponse response) {
byte[] tileBytes = OfflineTileService.getInstance().tile(z, x, y);
ByteArrayInputStream bis = new ByteArrayInputStream(tileBytes);
ResponseBody responseBody = new StreamBody(bis, bis.available(), MediaType.IMAGE_PNG);
response.setHeader("Cache-Control", "public, max-age=86400"); // 24小时缓存
response.setHeader("Content-type", "image/png");
response.setBody(responseBody);
// FileBody body=new FileBody(new File("file:///storage/emulated/0/CqsfAppData/tile/blank_tile.png"));
// response.setHeader("Content-Disposition", "attachment;filename=blank_tile.png");
response.setBody(responseBody);
}
}
报错:
Server internal error, The return value of [null] is not supported.
com.yanzhenjie.andserver.error.ServerInternalException: Server internal error, The return value of [null] is not supported.
at com.yanzhenjie.andserver.framework.view.ViewResolver.resolvePath(ViewResolver.java:133)
at com.yanzhenjie.andserver.framework.view.ViewResolver.resolve(ViewResolver.java:68)
at com.yanzhenjie.andserver.DispatcherHandler.handle(DispatcherHandler.java:160)
at com.yanzhenjie.andserver.DispatcherHandler.handle(DispatcherHandler.java:128)
at org.apache.httpcore.protocol.HttpService.doService(HttpService.java:437)
at org.apache.httpcore.protocol.HttpService.handleRequest(HttpService.java:342)
at org.apache.httpcore.impl.bootstrap.Worker.run(Worker.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1251)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:668)
at java.lang.Thread.run(Thread.java:1012)