gpt4 book ai didi

java - 带 GAE 的 Ninja 框架 : accessing the google app engine development console

转载 作者:行者123 更新时间:2023-12-01 09:34:24 25 4
gpt4 key购买 nike

通过 Ninja 框架使用 GAE 时,我似乎无法访问通常位于 http:localhost:8080/_ah/admin 的开发控制台。这是允许您查看数据存储、日志等的控制台。我如何访问它?

最佳答案

因此,我通过查看 ninja-appengine github 自述文件中提供的示例 ninja-appengine 应用程序解决了这个问题。我注意到他们的示例应用程序没有遇到同样的问题,这是由于包含了我丢失的conf/ServletModule.java 文件。下面的代码做了两件事:

它通过 Java 代码插入 Objectify 过滤器,而不是要求通过 web.xml 包含 objectify 过滤器。

其次,它使 _ah/admin 路径在开发环境中运行时可见。请注意,我刚刚复制了示例 ninja-appengine Web 应用程序中给出的代码:

包配置;

导入 ninja.servlet.NinjaServletDispatcher;

导入 com.google.appengine.api.utils.SystemProperty;导入 com.google.inject.Singleton;导入 com.googlecode.objectify.ObjectifyFilter;

公共(public)类 ServletModule 扩展 com.google.inject.servlet.ServletModule {

@Override
protected void configureServlets() {

bind(NinjaServletDispatcher.class).asEagerSingleton();

// Clean objectify instances with that filter:
bind(ObjectifyFilter.class).in(Singleton.class);
filter("/*").through(ObjectifyFilter.class);

if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Production) {

serve("/*").with(NinjaServletDispatcher.class);

} else {
// do not serve admin stuff like _ah and so on...
// allows to call /_ah/admin and so on
serveRegex("/(?!_ah).*").with(NinjaServletDispatcher.class);
}

}

}

关于java - 带 GAE 的 Ninja 框架 : accessing the google app engine development console,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39129713/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com