Skip to content

Instantly share code, notes, and snippets.

@woodie
Forked from headius/plain.duby
Created March 15, 2010 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save woodie/333173 to your computer and use it in GitHub Desktop.
Save woodie/333173 to your computer and use it in GitHub Desktop.
import java.io.IOException
import javax.servlet.http.HttpServlet
import com.google.apphosting.api.ApiProxy
import com.google.apphosting.api.ApiProxy.Environment
class Plain < HttpServlet
def doGet(req:HttpServletRequest, resp:HttpServletResponse); throws IOException
env = ApiProxy.getCurrentEnvironment
raw_ver = env.getVersionId
version = raw_ver.substring 0, raw_ver.lastIndexOf(".")
# Spit out a JSON
resp.setContentType "text/plain"
resp.getWriter.println "\"{app_id\":\"#{env.getAppId}\",\n" +
"\"version\":\"#{version}\",\n" +
" \"domain\":\"#{env.getAuthDomain}\"}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment