java - programmatically get base url from inside google app engine endpoint method -


I am creating a Google Appengine Endpoint API. In one endpoint method, I have to find the base url. How can I do this in Java? According to the document, you can type in injection API methods; For example, if you use the HTTPServletRequest object as your API You can inject the method

After you have the request object, you can get the base URL as necessary. For example

  stringbuffer url = req.getRequestURL (); String uri = rick Jatrquensturai (); String ctx = req.getContextPath (); String base = url.substring (0, url.length () - uri.length () + ctx.length ()) + "/";    

Comments

Popular posts from this blog

ruby on rails - How to avoid ActionController::InvalidCrossOriginRequest exception? -

Selenium IDE Conditional Statements -

How to edit the second line in text file using batch? -