如何通过客户端Java代码获取Google Web Toolkit中的当前URL? [英] How can I get the current URL in Google Web Toolkit via client side Java code?
问题描述
我正尝试阅读URL 在客户端Java代码中,但我无法弄清楚如何在Java中找到当前的URL。
当我尝试使用 httpServletRequest
按照这个问题,它表示它无法解析,并且不提供添加导入语句。
我正在使用Google使用Google App Engine的Web Toolkit。
请看 Window.Location :
public static class Window.Location
这个课程提供acces s到浏览器的位置的对象。位置对象包含有关当前网址的 信息以及操纵它的方法 。位置是一个非常简单的包装,所以不是所有浏览器的怪癖都隐藏在用户面前。
有许多方法可以检索信息( 既然你说你想读取查询参数,你可能需要其中的一个: 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 I'm using Google Web Toolkit with Google App Engine. Look at Window.Location:
This class provides access to the browser's location's object. The location object contains information about the current URL and methods to manipulate it. Location is a very simple wrapper, so not all browser quirks are hidden from the user. There are a number of methods to retrieve info about the URL, including one to get the whole thing ( Since you say you want to read the query arguments, you probably want one of these:
这篇关于如何通过客户端Java代码获取Google Web Toolkit中的当前URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! getHref()
)或获取构成组件(例如 getProtocol()$ c $) c>,
getHost()
, getHostName()
等)。
static java。 lang.String getQueryString()
获取URL的查询字符串。
static java.lang.String getParameter(java.lang.String name)
获取指定名称的URL参数
static java.util.Map< java.lang.String中,java.util.List的< java.lang.String中>> getParameterMap()
返回主机页面的URL查询参数的映射;因为改变地图不会改变窗口的位置,返回的地图是不可变的。
httpServletRequest
as recommended in this question, it says that it cannot be resolved and it doesn't offer adding an import statement.public static class Window.Location
getHref()
) or get the constituent components (e.g. getProtocol()
, getHost()
, getHostName()
, etc).static java.lang.String getQueryString()
Gets the URL's query string.
static java.lang.String getParameter(java.lang.String name)
Gets the URL's parameter of the specified name
static java.util.Map<java.lang.String,java.util.List<java.lang.String>> getParameterMap()
Returns a Map of the URL query parameters for the host page; since changing the map would not change the window's location, the map returned is immutable.