private RouteOptions opts(MediaType contentType) { // don't change if already customized if (options.contentType() == null || !options.contentTypeCustomized()) { options.contentType(contentType); } return options; }
public AbstractHttpHandler(RouteOptions options) { this.options = options; this.contentType = options.contentType(); }
public OnRoute contentType(MediaType contentType) { options.contentType(contentType); return this; }
private RouteOptions opts(MediaType contentType) { // don't change if already customized if (options.contentType() == null || !options.contentTypeCustomized()) { options.contentType(contentType); } return options; }
@Override public boolean isAPI() { if (options.mvc()) return false; return options.contentType() != MediaType.HTML_UTF_8; }
@Override public final HttpStatus handle(Channel ctx, boolean isKeepAlive, Req req) { if (!ctx.isAsync()) { // first checks if not async, to avoid exceptions when running the second time from non-IO thread ctx.async(); } execHandlerJob(ctx, isKeepAlive, options.contentType(), req); return HttpStatus.ASYNC; }
public AbstractDecoratingHttpHandler(FastHttp http, RouteOptions options) { super(options); U.notNull(http, "http"); this.decorator = options.managed() ? new HttpManagedHandlerDecorator(this, http, options) : new HttpUnmanagedHandlerDecorator(this, http, options.contentType()); }
private void execHandlerJob(final Channel channel, final boolean isKeepAlive, final MediaType contentType, final Req req) { With.tag(CTX_TAG_HANDLER).exchange(req).run(() -> { try { req.response() .view(options.view()) .contentType(options.contentType()) .mvc(options.mvc()); handleWithWrappers(channel, isKeepAlive, contentType, req, wrappers.get()); } catch (Throwable e) { handleError(req, e); } }); }
public AbstractHttpHandler(RouteOptions options) { this.options = options; this.contentType = options.contentType(); }
public OnRoute contentType(MediaType contentType) { options.contentType(contentType); return this; }
@Override public final HttpStatus handle(Channel ctx, boolean isKeepAlive, Req req) { if (!ctx.isAsync()) { // first checks if not async, to avoid exceptions when running the second time from non-IO thread ctx.async(); } execHandlerJob(ctx, isKeepAlive, options.contentType(), req); return HttpStatus.ASYNC; }
public AbstractDecoratingHttpHandler(FastHttp http, RouteOptions options) { super(options); U.notNull(http, "http"); this.decorator = options.managed() ? new HttpManagedHandlerDecorator(this, http, options) : new HttpUnmanagedHandlerDecorator(this, http, options.contentType()); }
@Override public void run() { try { req.response() .view(options.view()) .contentType(options.contentType()) .mvc(options.mvc()); handleWithWrappers(channel, isKeepAlive, contentType, req, wrappers.get()); } catch (Throwable e) { handleError(req, e); } }