Java library/class to parse clean URLs and get its different components [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this questionI am looking for a java library/class to parse clean URL's and get all the properties like query, port, host , domain, subdomain etc. Essentially most of the functionality that java.net.URI does but even for clean URLs. I am guessing since this is a pretty common requirement, there might be some libraries already built to handle this. Help?
java.net.URL
class has methods getHost()
, getPort()
, getQuery()
, getPath()
.
You can also look at URI
class, it's more preferred to use it.
The standard Java Url classes do not have functionality to parse request parameters. There is a utility class in Commons HTTP Client which has a useful method to do this.
精彩评论