@Override public HttpStatus handle(Channel ctx, boolean isKeepAlive, Req req) { HttpIO.INSTANCE.write200(HttpUtils.maybe(req), ctx, isKeepAlive, contentType, response); return HttpStatus.DONE; }
@Override public HttpStatus handle(Channel ctx, boolean isKeepAlive, Req req) { byte[] bytes = resource.getBytesOrNull(); if (bytes != null) { HttpIO.INSTANCE.write200(HttpUtils.maybe(req), ctx, isKeepAlive, contentType, bytes); return HttpStatus.DONE; } else { return HttpStatus.NOT_FOUND; } }
@Override public HttpStatus handle(Channel ctx, boolean isKeepAlive, Req req) { if (!HttpUtils.isGetReq(req)) return HttpStatus.NOT_FOUND; try { String[] staticFilesLocations = customization.staticFilesPath(); if (!U.isEmpty(staticFilesLocations)) { Res res = HttpUtils.staticResource(req, staticFilesLocations); if (res != null) { StaticFilesSecurity staticFilesSecurity = customization.staticFilesSecurity(); if (staticFilesSecurity.canServe(req, res)) { byte[] bytes = res.getBytesOrNull(); if (bytes != null) { MediaType contentType = U.or(MediaType.getByFileName(res.getName()), MediaType.BINARY); HttpIO.INSTANCE.write200(HttpUtils.maybe(req), ctx, isKeepAlive, contentType, bytes); return HttpStatus.DONE; } } } } return HttpStatus.NOT_FOUND; } catch (Exception e) { return HttpIO.INSTANCE.errorAndDone(req, e, LogLevel.ERROR); } }
@Override public HttpStatus handle(Channel ctx, boolean isKeepAlive, Req req) { HttpIO.INSTANCE.write200(HttpUtils.maybe(req), ctx, isKeepAlive, contentType, response); return HttpStatus.DONE; }
@Override public HttpStatus handle(Channel ctx, boolean isKeepAlive, Req req) { byte[] bytes = resource.getBytesOrNull(); if (bytes != null) { HttpIO.INSTANCE.write200(HttpUtils.maybe(req), ctx, isKeepAlive, contentType, bytes); return HttpStatus.DONE; } else { return HttpStatus.NOT_FOUND; } }
@Override public HttpStatus handle(Channel ctx, boolean isKeepAlive, Req req) { if (!HttpUtils.isGetReq(req)) return HttpStatus.NOT_FOUND; try { String[] staticFilesLocations = customization.staticFilesPath(); if (!U.isEmpty(staticFilesLocations)) { Res res = HttpUtils.staticResource(req, staticFilesLocations); if (res != null) { StaticFilesSecurity staticFilesSecurity = customization.staticFilesSecurity(); if (staticFilesSecurity.canServe(req, res)) { byte[] bytes = res.getBytesOrNull(); if (bytes != null) { MediaType contentType = U.or(MediaType.getByFileName(res.getName()), MediaType.BINARY); HttpIO.INSTANCE.write200(HttpUtils.maybe(req), ctx, isKeepAlive, contentType, bytes); return HttpStatus.DONE; } } } } return HttpStatus.NOT_FOUND; } catch (Exception e) { return HttpIO.INSTANCE.errorAndDone(req, e, LogLevel.ERROR); } }