Forums Register Login

Updating host and port informaiton for a given URL.

+Pie Number of slices to send: Send
Are there any common libraries that will update the host and port for a given URL - I do not want to str replace the url string or construct a new URL for an already formed URL String I would like to replace the hostname and port.

Thanks.
+Pie Number of slices to send: Send
Welcome to JavaRanch

If you meant to replace the host and port of a String that contains a URL (just an address), why don't you just replace the host and port with String replacements? Even if there exists a library/API, that must be doing the same behind the scene. If you meant to change the host/port of a java.net.URL object, the only possible way is creating your own URLStreamHandler, which is not a good idea at all. The best thing what you can do is constructing a new URL object. Moving to the sockets forum.
+Pie Number of slices to send: Send
Creating a new URL object from an existing one seems like a simple thing to do:


A magnificient life is loaded with tough challenges. En garde tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 9781 times.
Similar Threads
How to configure SSL in RAD 7
ConnectionException under Win ME
allow requests from a certain url with remote host filter
How to get exact exception type
Doing ftp from a JSP
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:45:26.