本文整理了Java中play.api.Application
类的一些代码示例,展示了Application
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application
类的具体详情如下:
包路径:play.api.Application
类名称:Application
暂无
代码示例来源:origin: com.typesafe.play/play_2.10
/**
* Create an application that wraps a Scala application.
*/
public DefaultApplication(play.api.Application application, Injector injector) {
this(application, new Configuration(application.configuration()), injector);
}
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* Get the application classloader.
*
* @return the application classloader
*/
default ClassLoader classloader() {
return asScala().classloader();
}
代码示例来源:origin: com.typesafe.play/play_2.10
/**
* Get the application path.
*
* @return the application path
*/
default File path() {
return getWrappedApplication().path();
}
代码示例来源:origin: com.typesafe.play/play-test_2.12
@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.");
}
}
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* Check whether the application is in {@link Mode#TEST} mode.
*
* @return true if the application is in TEST mode
*/
default boolean isTest() {
return asScala().isTest();
}
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* Check whether the application is in {@link Mode#PROD} mode.
*
* @return true if the application is in PROD mode
*/
default boolean isProd() {
return asScala().isProd();
}
代码示例来源:origin: com.typesafe.play/play
/**
* Check whether the application is in {@link Mode#DEV} mode.
*
* @return true if the application is in DEV mode
*/
default boolean isDev() {
return asScala().isDev();
}
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* Create an application that wraps a Scala application.
*
* @param application the application to wrap
* @param config the new application's configuration
* @param injector the new application's injector
*
* @deprecated Use {@link #DefaultApplication(play.api.Application, Config, Injector, Environment)} instead.
*/
@Deprecated
public DefaultApplication(play.api.Application application, Config config, Injector injector) {
this(application, config, injector, new Environment(application.environment()));
}
代码示例来源:origin: com.typesafe.play/play_2.11
@Override
public Application load(Context context) {
return loader.load(context.asScala()).asJava();
}
};
代码示例来源:origin: com.github.rmannibucau/playx-ioc
@Override
public ActorSystem actorSystem() {
return scalaRef.actorSystem();
}
代码示例来源:origin: com.typesafe.play/play-test_2.11
@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.");
}
}
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* Check whether the application is in {@link Mode#TEST} mode.
*
* @return true if the application is in TEST mode
*/
default boolean isTest() {
return asScala().isTest();
}
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* Check whether the application is in {@link Mode#PROD} mode.
*
* @return true if the application is in PROD mode
*/
default boolean isProd() {
return asScala().isProd();
}
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* Check whether the application is in {@link Mode#DEV} mode.
*
* @return true if the application is in DEV mode
*/
default boolean isDev() {
return asScala().isDev();
}
代码示例来源:origin: com.typesafe.play/play_2.11
/**
* Create an application that wraps a Scala application.
*
* @param application the application to wrap
* @param config the new application's configuration
* @param injector the new application's injector
*
* @deprecated Use {@link #DefaultApplication(play.api.Application, Config, Injector, Environment)} instead.
*/
@Deprecated
public DefaultApplication(play.api.Application application, Config config, Injector injector) {
this(application, config, injector, new Environment(application.environment()));
}
代码示例来源:origin: com.typesafe.play/play
@Override
public Application load(Context context) {
return loader.load(context.asScala()).asJava();
}
};
代码示例来源:origin: com.lightbend.akka.grpc/akka-grpc-play-testkit
/** Creates a GrpcClientSettings from the given NewTestServer. */
public static GrpcClientSettings grpcClientSettings(final RunningServer runningServer) {
final ServerEndpoint http2Endpoint = getHttp2Endpoint(runningServer.endpoints());
return grpcClientSettings(http2Endpoint, runningServer.app().actorSystem());
}
代码示例来源:origin: com.typesafe.play/play
/**
* 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);
}
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* Get the application path.
*
* @return the application path
*/
default File path() {
return asScala().path();
}
代码示例来源:origin: com.typesafe.play/play_2.12
/**
* Get the application classloader.
*
* @return the application classloader
*/
default ClassLoader classloader() {
return asScala().classloader();
}
内容来源于网络,如有侵权,请联系作者删除!