我试图读取 URL 的查询参数 https://stackoverflow.com/questions/4514940/reading-request-parameters-in-google-app-engine-with-java在客户端 Java 代码中,但我不知道如何在 Java 中查找当前 URL。
当我尝试使用httpServletRequest
正如推荐的这个问题 https://stackoverflow.com/questions/1015442/how-to-get-the-current-server-url-of-appengine-app/1016732#1016732,它说无法解决,并且不提供添加导入声明。
我正在将 Google Web Toolkit 与 Google App Engine 结合使用。
Look at 窗口位置 http://google-web-toolkit.googlecode.com/svn/javadoc/2.5/com/google/gwt/user/client/Window.Location.html:
public static class Window.Location
此类提供对浏览器位置对象的访问。位置对象包含有关当前 URL 的信息以及操作它的方法。 Location 是一个非常简单的包装器,因此并非所有浏览器怪癖都对用户隐藏。
有多种方法可以检索有关 URL 的信息,包括一种获取整个内容的方法 (getHref()
)或获取组成部分(例如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.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)