电子邮件的RFC 2282具有以下用于引用字符串的 ABNF。
quoted-string = [CFWS]
DQUOTE *([FWS] qcontent) [FWS] DQUOTE
[CFWS]
Run Code Online (Sandbox Code Playgroud)
我用谷歌搜索,发现 CFWS 是 Comments, Folding, Whitespaces。我知道空格是什么,但不知道电子邮件地址中的 ABNF 中的注释和折叠是什么。
另外 *() 里面的 [FWS] 是什么意思?双引号可以有 0 次或多次出现在折叠和空格之前的 qcontent?
这是非常令人困惑的。了解 ABNF 的参考资料将不胜感激。
以下链接表示您可以将CookieAuthenticator用作无状态或有状态.
http://silhouette.mohiva.com/docs/authenticator
但我看不到任何选项可以在下面的链接做出选择.
http://silhouette.mohiva.com/v3.0/docs/config-authenticators#cookieauthenticator
我已经复制了以下示例的实现.这是无国籍还是有状态的?如果有状态我如何实现无状态身份验证?
我正在编写一个处理多个系统的应用程序.用户可以选择他想要使用的系统,并将该系统ID存储在会话中(客户端会话)
现在我有Service类,比如说CustomerService.
class CustomerService(val systemID: String) {
// Implementation
}
Run Code Online (Sandbox Code Playgroud)
我想使用Guice将Customer实例注入控制器.但是我希望使用存储在会话中的SystemID来实例化CustomerService.
如何request.session
在Guice模块中访问?
编辑:
已经简化了上面的代码.我的实际代码使用接口.我怎样才能使用辅助注射?
trait CustomerService(val systemID: String) {
// Definition
}
object CustomerService{
trait Factory {
def apply(systemID: String) : CustomerService
}
}
class DefaultCustomerService @Inject() (@Assisted systemID: String)
extends CustomerService {
// Definition
}
class CustomerController @Inject()(
val messagesApi: MessagesApi,
csFactory: CustomerService.Factory)
{
}
Run Code Online (Sandbox Code Playgroud)
这给了我:CustomerService是一个接口,而不是具体的类.无法创建AssistedInject工厂.
而且我不想把工厂放在控制器下面DefaultCustomerService
并使用DefaultCustomerService.Factory
它.这是因为对于单元测试,我将使用TestCustomerService
存根并希望依赖注入注入TestCustomerService
控制器而不是DefaultCustomerService
.
我有一个使用Hikari连接池的项目.我逐个为所有数据库创建连接池new HikariDataSource(someConfig)
当所有数据库都可用时,这可以正常工作.但是,如果任何数据库处于脱机状态,Play项目会给出以下错误:
[RuntimeException: java.lang.ExceptionInInitializerError]
Run Code Online (Sandbox Code Playgroud)
如果只有少数数据库处于脱机状态,我不希望应用程序崩溃.
如何避免此错误导致应用程序崩溃?
注意:我在另一个子项目中使用HikariCP软件包.我没有使用play-hikari插件.