@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."); } }
/** * Returns the currently running application. */ public static Application application() { return play.api.Play.current().injector().instanceOf(Application.class); }
/** * Returns the default WSClient object managed by the Play application. * * @return a configured WSClient * @deprecated Please use a WSClient instance using DI (since 2.5) */ @Deprecated public static WSClient client() { return play.api.Play.current().injector().instanceOf(WSClient.class); }
private static OpenIdClient client() { return play.api.Play.current().injector().instanceOf(OpenIdClient.class); }