简体   繁体   English

Google App Engine:我可以通过编程方式找出这是否是默认版本吗?

[英]Google App Engine: Can I programmatically find out if this is the default version?

Is something to programmatically discover if the this request was for the default version, as opposed to another specific version set on the request. 是否可以通过编程方式发现此请求是否针对默认版本,而不是针对该请求设置的另一个特定版本。 I thought there may be something like: 我以为可能是这样的:

SystemProperty.isDefaultVersion

Use API provided by the new Modules functionality: 使用新模块功能提供的API:

ModulesService modulesService = ModulesServiceFactory.getModulesService();
String currentModuleName = modulesService.getCurrentModule();
String version = modulesService.getDefaultVersion(currentModuleName);

One not so full proof way you can get around this is by checking the URL. 您可以通过以下方法来解决此问题,其中一种不是完全证明的方法:检查URL。 If it matches X.name.appspot.com , it probably isn't the default version. 如果与X.name.appspot.com匹配,则可能不是默认版本。 It might be, but it's definitely not a normal user accessing your page and therefore probably a development operation. 可能是,但绝对不是普通用户访问您的页面,因此可能不是开发操作。

Far from perfect, but might be enough... 远非完美,但可能就足够了……

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在系统中哪里可以找到App Engine Maven插件的当前安装版本? - Where can I find the current installed version of the App Engine Maven plugin in my system? 无法部署到 Google App Engine,原因是:默认服务(模块)可能不会被删除,并且必须至少包含一个版本 - Can't deploy to Google App Engine due to: The default service (module) may not be deleted, and must comprise at least one version 如何在Java版本的Google App Engine中动态更新JSP文件的内容? - How can I dynamically update the contents of a JSP file in the Java version of Google App Engine? 如何将不同的Google App Engine版本网址连接到其他域名? - How can i connect different Google App Engine Version urls to A different domain name? 如何更改Google App Engine上的Web服务调用的默认超时? - How I can change default timeout for web services call on Google app engine? Google App Engine和Java版本? - Google App Engine and Java Version? Google App Engine和Java版本 - Google App Engine and Java Version 我可以在Google App Engine上使用HikariCP吗? - Can i use HikariCP on Google App Engine 我可以在Google App Engine中使用JavaCompiler吗? - Can I use JavaCompiler in Google app Engine? “帮助亚瑟找到他的受限课程”或“我怎样才能让谷歌应用引擎开心” - “Help Arthur find his restricted class” or “how can i make google app engine happy”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM