Does Java have a modified URL / URI?

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.

+3
source share
1 answer

There is no JDK class that I know of.

The Spring Web ( Maven link ) provides UriComponentsBuildera build class UriComponentsthat

URI, . . java.net.URI, URI.

+2

All Articles