/** * Starts a new application. * * @param application the application to start. */ public static void start(Application application) { play.api.Play.start(application.asScala()); }
/** * Stops an application. * * @param application the application to stop. */ public static void stop(Application application) { play.api.Play.stop(application.asScala()); }
@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."); } }
/** * Create an application that wraps a Scala application. * * @param application the application to wrap * @param injector the new application's injector */ public DefaultApplication(play.api.Application application, Injector injector) { this(application, application.configuration().underlying(), injector); }
/** * Similar to {@link #isInfoEnabled()} method except that the marker * data is also taken into consideration. * * @param marker The marker data to take into consideration * @return true if this logger is warn enabled, false otherwise */ public boolean isInfoEnabled(Marker marker) { return logger.isInfoEnabled(new DefaultMarkerContext(marker)); }
/** * Similar to {@link #isDebugEnabled()} method except that the * marker data is also taken into account. * * @param marker The marker data to take into consideration * @return True if this Logger is enabled for the DEBUG level, * false otherwise. */ public boolean isDebugEnabled(Marker marker) { return logger.isDebugEnabled(new DefaultMarkerContext(marker)); }
/** * Similar to {@link #isTraceEnabled()} method except that the * marker data is also taken into account. * * @param marker The marker data to take into consideration * @return True if this Logger is enabled for the TRACE level, * false otherwise. */ public boolean isTraceEnabled(Marker marker) { return logger.isTraceEnabled(new DefaultMarkerContext(marker)); }
/** * Similar to {@link #isWarnEnabled()} method except that the marker * data is also taken into consideration. * * @param marker The marker data to take into consideration * @return True if this Logger is enabled for the WARN level, * false otherwise. */ public boolean isWarnEnabled(Marker marker) { return logger.isWarnEnabled(new DefaultMarkerContext(marker)); }
/** * Similar to {@link #isErrorEnabled()} method except that the * marker data is also taken into consideration. * * @param marker The marker data to take into consideration * @return True if this Logger is enabled for the ERROR level, * false otherwise. */ public boolean isErrorEnabled(Marker marker) { return logger.isErrorEnabled(new DefaultMarkerContext(marker)); }
@Before public void startPlay() { app = provideApplication(); Helpers.start(app); mat = app.asScala().materializer(); }
@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."); } }
/** * Create an application that wraps a Scala application. * * @param application the application to wrap * @param injector the new application's injector */ public DefaultApplication(play.api.Application application, Injector injector) { this(application, application.configuration().underlying(), injector); }
/** * Similar to {@link #isInfoEnabled()} method except that the marker * data is also taken into consideration. * * @param marker The marker data to take into consideration * @return true if this logger is warn enabled, false otherwise */ public boolean isInfoEnabled(Marker marker) { return logger.isInfoEnabled(new DefaultMarkerContext(marker)); }
/** * Similar to {@link #isDebugEnabled()} method except that the * marker data is also taken into account. * * @param marker The marker data to take into consideration * @return True if this Logger is enabled for the DEBUG level, * false otherwise. */ public boolean isDebugEnabled(Marker marker) { return logger.isDebugEnabled(new DefaultMarkerContext(marker)); }
/** * Starts a new application. * * @param application the application to start. */ public static void start(Application application) { play.api.Play.start(application.asScala()); }
/** * Stops an application. * * @param application the application to stop. */ public static void stop(Application application) { play.api.Play.stop(application.asScala()); }
@Before public void startPlay() { app = provideApplication(); Helpers.start(app); mat = app.asScala().materializer(); }
/** * Similar to {@link #isInfoEnabled()} method except that the marker * data is also taken into consideration. * * @param marker The marker data to take into consideration * @return true if this logger is warn enabled, false otherwise */ public boolean isInfoEnabled(Marker marker) { return logger.isInfoEnabled(new DefaultMarkerContext(marker)); }
/** * Starts a new application. */ public static void start(Application application) { play.api.Play.start(application.getWrappedApplication()); }
/** * Stops an application. */ public static void stop(Application application) { play.api.Play.stop(application.getWrappedApplication()); }