How can I modify/update a java.net.URI object? -
Looking at an object, let me either:
- Destructively modify (such as
path
component). Although there are nosetX
methods, it seems that these objects are irreversible. - Create a new
URI
object which is similar to the original ("Functional Update") except for a given field although there are nowithX
methods , So I have to write my own logic to deal with this.
Do I really need to write my own work to deal with? URI
with the amendment of objects?
Yes, you can create a new object every time java.net.URI
is irreversible. You can use third party classes such as Apache HTTP Components.
Example:
URI Yuri = new URLIBiller () .setScheme ("http") .setHost ("UP") .setPath ("/ search"). Sitemap ("Q", "httpclient") .setParameter ("BTNG", "Google search"). Sitemapator ("A", "F") .setParameter ("Oak", "") .build (); // Build method creates a new URI example behind the scenario
Comments
Post a Comment