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

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -