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 no setX 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 no withX 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

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -