Redian新闻
>
请教如何在servlet中获取完整的URI
avatar
请教如何在servlet中获取完整的URI# Java - 爪哇娇娃
n*3
1
我有一个如下格式的URI:
http://trial1.myserver.net/mywebapp/test/parseURL#GroupTree=g23h177&HostGraph=ds214
parseURL是一个很简单的servlet. 它调用getPathInfo, getQueryString等api,然后
返回他们的结果。
这是输出:
getPathInfo() = null
getQueryString() = null
getRequestURI() = /mywebapp/test/parseURL
getRequestURL() = http://trial1.myserver.net/mywebapp/test/parseURL
getServletPath() = /test/parseURL
请问有什么办法可以得到整个URI,即:
/mywebapp/test/parseURL#GroupTree=g23h177&HostGraph=ds214

/test/parseURL#GroupTree=g23h177&HostGraph=ds214
(注意:在pa
avatar
m*t
2

Is that even a valid URL? I believe you have to
have a "?" to mark the beginning of the queryString.

【在 n*******3 的大作中提到】
: 我有一个如下格式的URI:
: http://trial1.myserver.net/mywebapp/test/parseURL#GroupTree=g23h177&HostGraph=ds214
: parseURL是一个很简单的servlet. 它调用getPathInfo, getQueryString等api,然后
: 返回他们的结果。
: 这是输出:
: getPathInfo() = null
: getQueryString() = null
: getRequestURI() = /mywebapp/test/parseURL
: getRequestURL() = http://trial1.myserver.net/mywebapp/test/parseURL
: getServletPath() = /test/parseURL

avatar
n*3
3
I am not sure it is valid or not. But it works well in my web application.

【在 m******t 的大作中提到】
:
: Is that even a valid URL? I believe you have to
: have a "?" to mark the beginning of the queryString.

avatar
s*n
4
you can't. browser does not send anything after # to the server.

【在 n*******3 的大作中提到】
: 我有一个如下格式的URI:
: http://trial1.myserver.net/mywebapp/test/parseURL#GroupTree=g23h177&HostGraph=ds214
: parseURL是一个很简单的servlet. 它调用getPathInfo, getQueryString等api,然后
: 返回他们的结果。
: 这是输出:
: getPathInfo() = null
: getQueryString() = null
: getRequestURI() = /mywebapp/test/parseURL
: getRequestURL() = http://trial1.myserver.net/mywebapp/test/parseURL
: getServletPath() = /test/parseURL

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。