小编Adr*_*ien的帖子

来自Heroku的SSH隧道

我正在提供一个托管在Heroku上的服务,它允许用户使用他们的数据库报告他们自己的数据.我的客户必须将我的Heroku应用程序连接到他们的数据库.他们中的一些人显然害怕通过互联网清除数据.

是否可以使用Heroku从我的应用程序(Play Framework/Java)打开SSH隧道到他们的机器?

注意:我知道从Heroku到远程数据库SSH隧道?但在这个问题上,使用内置的Heroku数据库是可能的.

谢谢,阿德里安

ssh heroku ssh-tunnel

26
推荐指数
1
解决办法
1万
查看次数

如何使用ANTLR v4进行语法高亮?

我已经为 DSL 构建了语法,并且想以某些颜色显示一些元素(表名称)。我从 Java 输出 HTML。

columnIdentifier :
      columnName=Identifier
    | tableName=Identifier '.' columnName=Identifier
    ;

Identifier : Letter LetterOrDigit* ;
fragment Letter : [a-zA-Z_];
fragment LetterOrDigit : [a-zA-Z0-9_];

WS  :  [ \t\r\n\u000C]+ -> skip ;
Run Code Online (Sandbox Code Playgroud)

我考虑过使用 AbstractParseTreeVisitor 按原样返回所有元素,除了那些我想突出显示的将作为<span class="tablename" >theoriginaltext</span>. 这是一个好方法吗?

请注意,空格在发送到解析器之前会被消除,对吗?因此,如果我使用 AbstractParseTreeVisitor 重建输出,我将无法重建空间。

我认为有一种使用 ANTLR4 进行语法突出显示的规范方法。很难找到这方面的信息,因为搜索经常返回有关在 Eclipse/IDEA 中突出显示 Antlr4 文件的结果。

antlr antlr4

6
推荐指数
1
解决办法
4787
查看次数

How to gather copyright notices using Maven License Plugin?

I use many open-source libraries in my project and I use license-maven-plugin to gather information about them. I can see all the license texts in the target directory and THIRD-PARTY-included-modules.txt as follows:

Lists of 144 third-party dependencies.
 (Apache License 2.0) Commons Codec (commons-codec:commons-codec:1.8 - http://commons.apache.org/proper/commons-codec/)
 (Apache License 2.0) Commons IO (commons-io:commons-io:1.4 - http://commons.apache.org/io/)
 (Apache License 2.0) Commons Logging (commons-logging:commons-logging:1.1.3 - http://commons.apache.org/proper/commons-logging/)
 (CDDL) JavaBeans Activation Framework (JAF) (javax.activation:activation:1.0.2 - http://java.sun.com/products/javabeans/jaf/index.jsp)
...(and 140 more lines)
Run Code Online (Sandbox Code Playgroud)

However, this doesn't seem to match the …

licensing maven

5
推荐指数
1
解决办法
2573
查看次数

如何在Play中的Promise中使用Http.Context.current()?

在Play Framework 2.2.2中,我想返回一个Promise.但是我正在调用一个需要访问存储在Http.Context.current()(当前登录用户,JPA连接......)中的变量的函数.

当然,由于Promise在另一个线程中执行,因此它无权访问Http.Context.current().我可以将它保存在Promise中,还是应该手动恢复?我应该使用另一种模式吗?

例:

public static Promise<Result> getAvailableServices() {
    return new Promise.promise(new Function0<Result>(){
        @Override
        public Result apply() throws Throwable {
            // Long operation
            List<Services> data = buildResult();
            // Render the template
            // (The header of the template requires access to 
            // Http.Context.current().args.get("usermodel"))
            return Results.ok(services_template.render(services));
        }
    });
}
Run Code Online (Sandbox Code Playgroud)

playframework playframework-2.2

4
推荐指数
1
解决办法
4910
查看次数