简体   繁体   中英

Google App Engine java runtime absolute url

I need to send out emails containing icon gifs. It seems that using absolute urls is the best way to achieve this. In order to do so, I need to get hold of the the appengine-web-app.xml and its and so I can build the absolute path.

Is there any straightforward way to get hold of this ?

如果在servlet中发送,则可以从请求中获取网址

HttpServletRequest.getServerPath();

You can use ModulesService :

ModulesService ms = ModulesServiceFactory.getModulesService();
String currentModule = ms.getCurrentModule();
String defVersion = ms.getDefaultVersion(currentModule);
String defaultModuleHostname = ms.getModuleHostname(currentModule, defVersion);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM