@SuppressWarnings(value = "unchecked") private static Result invokeHandler(play.api.Application app, play.api.mvc.Handler handler, Request requestBuilder, long timeout) { if (handler instanceof play.api.mvc.Action) { play.api.mvc.Action action = (play.api.mvc.Action) handler; return wrapScalaResult(action.apply(requestBuilder.asScala()), timeout); } else if (handler instanceof JavaHandler) { final play.api.inject.Injector injector = app.injector(); final JavaHandlerComponents handlerComponents = injector.instanceOf(JavaHandlerComponents.class); return invokeHandler( app, ((JavaHandler) handler).withComponents(handlerComponents), requestBuilder, timeout ); } else { throw new RuntimeException("This is not a JavaAction and can't be invoked this way."); } }
@SuppressWarnings(value = "unchecked") private static Result invokeHandler(play.api.Application app, play.api.mvc.Handler handler, Request requestBuilder, long timeout) { if (handler instanceof play.api.mvc.Action) { play.api.mvc.Action action = (play.api.mvc.Action) handler; return wrapScalaResult(action.apply(requestBuilder.asScala()), timeout); } else if (handler instanceof JavaHandler) { final play.api.inject.Injector injector = app.injector(); final JavaHandlerComponents handlerComponents = injector.instanceOf(JavaHandlerComponents.class); return invokeHandler( app, ((JavaHandler) handler).withComponents(handlerComponents), requestBuilder, timeout ); } else { throw new RuntimeException("This is not a JavaAction and can't be invoked this way."); } }
/** * The original Play request Header used to create this context. * For internal usage only. * * @return the original request header. * * @deprecated Use {@link #request()}.asScala() instead. Since 2.7.0. */ @Deprecated public play.api.mvc.RequestHeader _requestHeader() { return request.asScala(); }
/** * Creates a new HTTP context. * * @param request the HTTP request * @param components the context components. */ public Context(Request request, JavaContextComponents components) { this.request = request; this.id = this.request.asScala().id(); this.response = new Response(); this.session = new Session(this.request.session()); this.flash = new Flash(this.request.flash()); this.args = new HashMap<>(); this.components = components; }
/** * Creates a new HTTP context. * * @param request the HTTP request * @param components the context components. */ public Context(Request request, JavaContextComponents components) { this.request = request; this.id = this.request.asScala().id(); this.response = new Response(); this.session = new Session(this.request.session()); this.flash = new Flash(this.request.flash()); this.args = new HashMap<>(); this.components = components; }
/** * Creates a new HTTP context. * * @param request the HTTP request * @param components the context components. */ public Context(Request request, JavaContextComponents components) { this.request = request; this.id = this.request.asScala().id(); this.response = new Response(); this.session = new Session(this.request.session()); this.flash = new Flash(this.request.flash()); this.args = new HashMap<>(); this.components = components; }
@Override @Deprecated public play.api.mvc.RequestHeader _requestHeader() { return wrapped.request().asScala(); }
/** * @param wrapped the context the created instance will wrap */ public WrappedContext(Context wrapped) { super(wrapped.id(), wrapped.request().asScala(), wrapped.request(), wrapped.session(), wrapped.flash(), wrapped.args, wrapped.lang, wrapped.components); this.args = wrapped.args; this.wrapped = wrapped; }
/** * Generates an alternative result if the user is not authenticated; the default a simple '401 Not Authorized' page. * * @param req the current request * @return a <code>401 Not Authorized</code> result */ public Result onUnauthorized(Request req) { return unauthorized(views.html.defaultpages.unauthorized.render(req.asScala())); }
/** * Generates an alternative result if the user is not authenticated; the default a simple '401 Not Authorized' page. * * @param req the current request * @return a <code>401 Not Authorized</code> result */ public Result onUnauthorized(Request req) { return unauthorized(views.html.defaultpages.unauthorized.render(req.asScala())); }
@Override @Deprecated public play.api.mvc.RequestHeader _requestHeader() { return wrapped.request().asScala(); }
/** * The original Play request Header used to create this context. * For internal usage only. * * @return the original request header. * * @deprecated Use {@link #request()}.asScala() instead. Since 2.7.0. */ @Deprecated public play.api.mvc.RequestHeader _requestHeader() { return request.asScala(); }
/** * @param wrapped the context the created instance will wrap */ public WrappedContext(Context wrapped) { super(wrapped.id(), wrapped.request().asScala(), wrapped.request(), wrapped.session(), wrapped.flash(), wrapped.args, wrapped.lang, wrapped.components); this.args = wrapped.args; this.wrapped = wrapped; }
/** * The original Play request Header used to create this context. * For internal usage only. * * @return the original request header. * * @deprecated Use {@link #request()}.asScala() instead. Since 2.7.0. */ @Deprecated public play.api.mvc.RequestHeader _requestHeader() { return request.asScala(); }
@Override @Deprecated public play.api.mvc.RequestHeader _requestHeader() { return wrapped.request().asScala(); }
/** * Generates an alternative result if the user is not authenticated; the default a simple '401 Not Authorized' page. * * @param req the current request * @return a <code>401 Not Authorized</code> result */ public Result onUnauthorized(Request req) { return unauthorized(views.html.defaultpages.unauthorized.render(req.asScala())); }
/** * Generates a 501 NOT_IMPLEMENTED simple result. */ public static Result TODO(Request request) { return status(NOT_IMPLEMENTED, views.html.defaultpages.todo.render(request.asScala())); }
/** * Generates a 501 NOT_IMPLEMENTED simple result. */ public static Result TODO(Request request) { return status(NOT_IMPLEMENTED, views.html.defaultpages.todo.render(request.asScala())); }
/** * Generates a 501 NOT_IMPLEMENTED simple result. */ public static Result TODO(Request request) { return status(NOT_IMPLEMENTED, views.html.defaultpages.todo.render(request.asScala())); }
/** * @param wrapped the context the created instance will wrap */ public WrappedContext(Context wrapped) { super(wrapped.id(), wrapped.request().asScala(), wrapped.request(), wrapped.session(), wrapped.flash(), wrapped.args, wrapped.lang, wrapped.components); this.args = wrapped.args; this.wrapped = wrapped; }