I have the url as String, and I am looking for various modifications for it. In particular, I need to change the values ββin the query line if they already exist, and if they do not, create them.
It seems to me that there should already be an existing class that I can build with my URL as a String, which would split the URL into its component components and allow me to modify each component individually. In the case of a query string, it should be possible to address it as a map, change it, then toString the URL object to return the changed URL.
Java has a URL class , but it seems extremely limited - the query string is processed as a string, not a map, and the only way to change is to call set and specify all the components of the URL instead of just installing the component that I want to install. Are there any better alternatives? I would prefer something in the standard java / javax packages, if possible, but I find this unlikely.
source
share