I'm trying to read the query arguments of the URL in client side Java code, but I can't figure out how to find the current URL in Java.
When I tried using httpServletRequest
as recommended in this question, it says that it cannot be resolved and it doesn't offer adding an import statement.
I'm using Google Web Toolkit with Google App Engine.
Look at Window.Location:
There are a number of methods to retrieve info about the URL, including one to get the whole thing (
getHref()
) or get the constituent components (e.g.getProtocol()
,getHost()
,getHostName()
, etc).Since you say you want to read the query arguments, you probably want one of these: