{"id":1059,"date":"2013-05-01T16:31:59","date_gmt":"2013-05-01T07:31:59","guid":{"rendered":"https:\/\/ecoop.net\/memo\/?p=1059"},"modified":"2018-11-21T18:43:54","modified_gmt":"2018-11-21T09:43:54","slug":"how-to-get-gae-app-name","status":"publish","type":"post","link":"https:\/\/www.ecoop.net\/memo\/archives\/how-to-get-gae-app-name.html","title":{"rendered":"Google App Engine \u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u540d\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\uff1f"},"content":{"rendered":"<p>GAE\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u540d\u524d\u306fJava\u3001Python\u3069\u3061\u3089\u3067\u3082\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u304b\u3089\u53c2\u7167\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<!--more-->Java<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nimport com.google.appengine.api.appidentity.AppIdentityServiceFactory;\r\n\r\npublic class AppEngineUtils {\r\n\tprivate AppEngineUtils() {\r\n\t}\r\n\t\/**\r\n\t * war\/WEB-INF\/appengine-web.xml\u3067\u8a2d\u5b9a\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u540d\u3092\u53d6\u5f97\u3059\u308b\u3002\r\n\t * @return \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u540d\r\n\t *\/\r\n\tpublic static String getApplicationName() {\r\n\t\t\treturn AppIdentityServiceFactory.getAppIdentityService()\r\n\t\t\t\t\t.getServiceAccountName().split(&quot;@&quot;)&#x5B;0];\r\n\r\n\t}\r\n}\r\n<\/pre>\n<p>Python:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nfrom google.appengine.api.app_identity import get_application_id\r\nappname = get_application_id()\r\n<\/pre>\n<p>\u3053\u3053\u3067\u53d6\u5f97\u3067\u304d\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u540d\u306fwar\/WEB-INF\/appengine-web.xml\u306eapplication\u30bf\u30b0\u3067\u6307\u5b9a\u3055\u308c\u3066\u3044\u308b\u3082\u306e\u3067\u3059\u3002<br \/>\n\u30c7\u30d7\u30ed\u30a4\u5148\u3054\u3068\u306b\u8a2d\u5b9a\u3092\u5207\u308a\u66ff\u3048\u308b\u6642\u306a\u3069\u306b\u3069\u3046\u305e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GAE\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u540d\u524d\u306fJava\u3001Python\u3069\u3061\u3089\u3067\u3082\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u304b\u3089\u53c2\u7167\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89,135],"tags":[105,42,111],"class_list":["post-1059","post","type-post","status-publish","format-standard","hentry","category-web-dev","category-server","tag-google-app-engine","tag-java","tag-python"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/1059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/comments?post=1059"}],"version-history":[{"count":0,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/1059\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/media?parent=1059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/categories?post=1059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/tags?post=1059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}