本文整理汇总了Java中play.libs.Scala类的典型用法代码示例。如果您正苦于以下问题:Java Scala类的具体用法?Java Scala怎么用?Java Scala使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Scala类属于play.libs包,在下文中一共展示了Scala类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: bindings
import play.libs.Scala; //导入依赖的package包/类
@Override
public Seq<Binding<?>> bindings(Environment environment, Configuration configuration) {
GlobalParams.AWS_ACCESS_KEY = Scala.orNull(configuration.getString("AWS_ACCESS_KEY", scala.Option.empty()));
GlobalParams.AWS_SECRET_KEY = Scala.orNull(configuration.getString("AWS_SECRET_KEY", scala.Option.empty()));
GlobalParams.AWS_S3_BUCKET = Scala.orNull(configuration.getString("AWS_S3_BUCKET", scala.Option.empty()));
String accessKey = GlobalParams.AWS_ACCESS_KEY;
String secretKey = GlobalParams.AWS_SECRET_KEY;
s3Bucket = GlobalParams.AWS_S3_BUCKET;
if ((accessKey != null) && (secretKey != null)) {
awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
amazonS3 = new AmazonS3Client(awsCredentials);
Logger.info("Using S3 Bucket: " + s3Bucket);
}
return seq(
bind(S3Plugin.class).to(S3PluginImpl.class)
);
}
开发者ID:webinerds,项目名称:s3-proxy-chunk-upload,代码行数:21,代码来源:S3Module.java
示例2: call
import play.libs.Scala; //导入依赖的package包/类
public F.Promise<Result> call(Http.Context context) throws Throwable {
User user = checkAuthentication(context);
// Check if a user is logged in
if (user != null) {
// Check if user has an allowed role
User.Role[] allowedRoles = configuration.value();
for(User.Role role : allowedRoles) {
if (role.equals(user.getRole())) {
return delegate.call(context);
}
}
}
List<Tuple2<String, String>> list = new ArrayList<>();
Tuple2<String, String> h = new Tuple2<>("Access-Control-Allow-Origin","*");
list.add(h);
Seq<Tuple2<String, String>> seq = Scala.toSeq(list);
Result error = () -> Results.unauthorized().toScala().withHeaders(seq);
return F.Promise.pure(error);
}
开发者ID:ugent-cros,项目名称:cros-core,代码行数:23,代码来源:Authenticator.java
示例3: upload
import play.libs.Scala; //导入依赖的package包/类
public static Result upload() throws RemoteException {
UploadTableModel uploadTableModel = uploadTableModelForm.bindFromRequest().get();
uploadTableModel.init();
return ok(sql_edit.render("Edit Query | SecureDB", "SQL Editor", Databases
.getDatabases(), Scala.Option((QueryModel) null), Scala.Option(
(QueryInfo) null)));
}
开发者ID:andyhehk,项目名称:SecureDB,代码行数:8,代码来源:Upload.java
示例4: onError
import play.libs.Scala; //导入依赖的package包/类
@Override
public F.Promise<Result> onError(Http.RequestHeader request, Throwable t) {
ObjectNode result = Json.newObject();
result.put("reason", t.getMessage());
// Giant -hack- to add Origin control to error messages
List<Tuple2<String, String>> list = new ArrayList<>();
Tuple2<String, String> h = new Tuple2<>("Access-Control-Allow-Origin","*");
list.add(h);
Seq<Tuple2<String, String>> seq = Scala.toSeq(list);
Result error = () -> Results.internalServerError(result).toScala().withHeaders(seq);
return F.Promise.pure(error);
}
开发者ID:ugent-cros,项目名称:cros-core,代码行数:14,代码来源:Global.java
示例5: authorizeUrl
import play.libs.Scala; //导入依赖的package包/类
public String authorizeUrl(Call returnTo) {
return URL.build(configuration.authorizationEndpoint, Scala.varargs(
param("response_type", "code"),
param("client_id", configuration.clientId),
param("redirect_uri", routes.OAuth.callback().absoluteURL(request())),
param("scope", configuration.scope),
param("state", returnTo.url())
));
}
开发者ID:julienrf,项目名称:pfe-samples,代码行数:10,代码来源:OAuth.java
示例6: callback
import play.libs.Scala; //导入依赖的package包/类
public F.Promise<Result> callback() {
String code = request().getQueryString("code");
if (code != null) {
String state = request().getQueryString("state");
String returnTo = state != null ? state : configuration.defaultReturnUrl;
return ws.url(configuration.tokenEndpoint)
.setContentType(Http.MimeTypes.FORM)
.post(URL.encode(Scala.varargs(
param("code", code),
param("client_id", configuration.clientId),
param("client_secret", configuration.clientSecret),
param("redirect_uri", routes.OAuth.callback().absoluteURL(request())),
param("grant_type", "authorization_code")
))).map(response -> {
JsonNode accessTokenJson = response.asJson().get("access_token");
if (accessTokenJson == null || !accessTokenJson.isTextual()) {
return internalServerError();
} else {
String accessToken = accessTokenJson.asText();
session().put(configuration.tokenKey, accessToken);
return redirect(returnTo);
}
});
} else {
return F.Promise.pure(internalServerError());
}
}
开发者ID:julienrf,项目名称:pfe-samples,代码行数:28,代码来源:OAuth.java
示例7: messagesJs
import play.libs.Scala; //导入依赖的package包/类
/**
* Returns JavaScript containing i18n messages for the license view
* @return Response
*/
public static Result messagesJs(){
// See https://github.com/julienrf/play-jsmessages
JsMessages jsMessages = JsMessages.filtering (play.Play.application(), new play.libs.F.Function<String, Boolean>(){
@Override
public Boolean apply(String key) {
return key.startsWith("license.") || key.startsWith("form.");
}
});
return ok(jsMessages.generateAll(Scala.Option("window.Messages").get())).as("application/javascript");
}
开发者ID:ukwa,项目名称:w3act,代码行数:16,代码来源:LicenseController.java
示例8: javascriptRouter
import play.libs.Scala; //导入依赖的package包/类
/**
* Generates a JavaScript router.
*/
public static String javascriptRouter(String name, String ajaxMethod, play.core.Router.JavascriptReverseRoute... routes) {
return play.api.Routes.javascriptRouter(
name, Scala.Option(ajaxMethod), play.mvc.Http.Context.current().request().host(), Scala.toSeq(routes)
);
}
开发者ID:vangav,项目名称:vos_backend,代码行数:9,代码来源:Routes.java
示例9: plugin
import play.libs.Scala; //导入依赖的package包/类
/**
* Retrieve the plugin instance for the class.
*/
public <T> T plugin(Class<T> pluginClass) {
return Scala.orNull(application.plugin(pluginClass));
}
开发者ID:vangav,项目名称:vos_backend,代码行数:7,代码来源:Application.java
示例10: edit
import play.libs.Scala; //导入依赖的package包/类
public static Result edit() throws RemoteException {
return ok(table_create.render("Create Table | SecureDB", "Create Table " +
"Editor", Databases.getDatabases(), Scala.Option((UploadTableModel)
null)));
}
开发者ID:andyhehk,项目名称:SecureDB,代码行数:6,代码来源:Upload.java
示例11: create
import play.libs.Scala; //导入依赖的package包/类
public static Result create() throws RemoteException {
return ok(table_upload.render("Choose Data Source | SecureDB", "Upload Data",
Databases.getDatabases(), Scala.Option((UploadTableModel) null)));
}
开发者ID:andyhehk,项目名称:SecureDB,代码行数:5,代码来源:Upload.java
示例12: edit
import play.libs.Scala; //导入依赖的package包/类
public static Result edit() throws RemoteException {
return ok(sql_edit.render("Edit Query | SecureDB", "SQL Editor", Databases
.getDatabases(), Scala.Option((QueryModel) null), Scala.Option((QueryInfo) null)));
}
开发者ID:andyhehk,项目名称:SecureDB,代码行数:5,代码来源:Query.java
示例13: share
import play.libs.Scala; //导入依赖的package包/类
public F.Promise<WSResponse> share(String content, String token) {
return ws.url(SHARING_ENDPOINT)
.setQueryParameter("access_token", token)
.setContentType(Http.MimeTypes.FORM)
.post(URL.encode(Scala.varargs(URL.param("content", content))));
}
开发者ID:julienrf,项目名称:pfe-samples,代码行数:7,代码来源:SocialNetwork.java
示例14: onStart
import play.libs.Scala; //导入依赖的package包/类
@Override
public void onStart() {
applicationContext = ApplicationContextHolder.get();
if (applicationContext == null) {
List<String> configLocations =
Lists.newArrayList(getConfiguration().getStringList("spring-plugin.spring-config-locations",
Collections.singletonList("classpath*:spring/**/*.xml")));
List<Plugin> plugins = Scala.asJava(getApplication().getWrappedApplication().plugins());
for (play.api.Plugin plugin : plugins) {
WithSpringConfig annotation = plugin.getClass().getAnnotation(WithSpringConfig.class);
if (annotation != null) {
Collections.addAll(configLocations, annotation.value());
}
}
LOG.info("Starting spring application context with config locations " + configLocations);
ClassPathXmlApplicationContext classPathApplicationContext =
new ClassPathXmlApplicationContext();
List<String> activeProfiles =
getConfiguration().getStringList(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME);
List<String> defaultProfiles =
getConfiguration().getStringList(AbstractEnvironment.DEFAULT_PROFILES_PROPERTY_NAME);
if (activeProfiles != null) {
classPathApplicationContext.getEnvironment().setActiveProfiles(
activeProfiles.toArray(new String[activeProfiles.size()]));
}
if (defaultProfiles != null) {
classPathApplicationContext.getEnvironment().setDefaultProfiles(
defaultProfiles.toArray(new String[defaultProfiles.size()]));
}
classPathApplicationContext.setConfigLocations(
configLocations.toArray(new String[configLocations.size()]));
classPathApplicationContext.refresh();
applicationContext = classPathApplicationContext;
} else {
LOG.info("Using spring application context in ApplicationContextHolder");
}
super.onStart();
}
开发者ID:tfeng,项目名称:play-plugins,代码行数:44,代码来源:SpringPlugin.java
示例15: execute
import play.libs.Scala; //导入依赖的package包/类
public static Result execute() throws RemoteException {
QueryInfo queryInfo = queryInfoForm.bindFromRequest().get();
queryModel.executeQuery(queryInfo.getQuery());
return ok(sql.render("Execute Query | SecureDB", "SQL Editor", Databases
.getDatabases(), Scala.Option(queryModel), Scala.Option(queryInfo)));
}
开发者ID:andyhehk,项目名称:SecureDB,代码行数:10,代码来源:Query.java
示例16: getString
import play.libs.Scala; //导入依赖的package包/类
/**
* Retrieves a configuration value as a <code>String</code>.
*
* @param key configuration key (relative to configuration root key)
* @return a configuration value or <code>null</code>
*/
public String getString(String key) {
return Scala.orNull(conf.getString(key, scala.Option.<scala.collection.immutable.Set<java.lang.String>>empty()));
}
开发者ID:vangav,项目名称:vos_backend,代码行数:10,代码来源:Configuration.java
示例17: getMilliseconds
import play.libs.Scala; //导入依赖的package包/类
/**
* Retrieves a configuration value as a <code>Milliseconds</code>.
*
* @param key configuration key (relative to configuration root key)
* @return a configuration value or <code>null</code>
*/
public Long getMilliseconds(String key) {
return (Long)Scala.orNull(conf.getMilliseconds(key));
}
开发者ID:vangav,项目名称:vos_backend,代码行数:10,代码来源:Configuration.java
示例18: getNanoseconds
import play.libs.Scala; //导入依赖的package包/类
/**
* Retrieves a configuration value as a <code>Nanoseconds</code>.
*
* @param key configuration key (relative to configuration root key)
* @return a configuration value or <code>null</code>
*/
public Long getNanoseconds(String key) {
return (Long)Scala.orNull(conf.getNanoseconds(key));
}
开发者ID:vangav,项目名称:vos_backend,代码行数:10,代码来源:Configuration.java
示例19: getBytes
import play.libs.Scala; //导入依赖的package包/类
/**
* Retrieves a configuration value as a <code>Bytes</code>.
*
* @param key configuration key (relative to configuration root key)
* @return a configuration value or <code>null</code>
*/
public Long getBytes(String key) {
return (Long)Scala.orNull(conf.getBytes(key));
}
开发者ID:vangav,项目名称:vos_backend,代码行数:10,代码来源:Configuration.java
示例20: getDouble
import play.libs.Scala; //导入依赖的package包/类
/**
* Retrieves a configuration value as an <code>Double</code>.
*
* @param key configuration key (relative to configuration root key)
* @return a configuration value or <code>null</code>
*/
public Double getDouble(String key) {
return (Double)Scala.orNull(conf.getDouble(key));
}
开发者ID:vangav,项目名称:vos_backend,代码行数:10,代码来源:Configuration.java
注:本文中的play.libs.Scala类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论