Java EE的有ServletRequest.getParameterValues().
Java EE has ServletRequest.getParameterValues().
在非EE平台,URL.getQuery()简单地返回一个字符串。
On non-EE platforms, URL.getQuery() simply returns a string.
什么是正常的方式正确地解析查询字符串的URL时的没有的关于Java EE?
What's the normal way to properly parse the query string in a URL when not on Java EE?
< 咆哮>
这是问题的答案,试图使自己的解析器受欢迎。这是非常有趣和令人兴奋的微型编码的项目,但 我不能说这是一个好主意的:(
It is popular in the answers to try and make your own parser. This is very interesting and exciting micro-coding project, but I cannot say that it is a good idea :(
下面的code段一般都是有缺陷或损坏,顺便说一句。打破他们是一个有趣的练习留给读者。 而到了黑客攻击使用它们的网站的。
The code snippets below are generally flawed or broken, btw. Breaking them is an interesting exercise for the reader. And to the hackers attacking the websites that use them.
解析查询字符串是一个明确的问题,但阅读的规格和理解的细微差别是不平凡的。这是远不如让一些平台库codeR做艰苦的工作,并做了固定,为您服务!
Parsing query strings is a well defined problem but reading the spec and understanding the nuances is non-trivial. It is far better to let some platform library coder do the hard work, and do the fixing, for you!
< /咆哮>
推荐答案
在Android上:
import android.net.Uri;
[...]
Uri uri=Uri.parse(url_string);
uri.getQueryParameter("para1");
相关推荐
最新文章