Thanks for the reply. I'm trying to feed my own content to a URL object for testing purposes. Basically, I want to load my own Html code to a URL, and then run testing on that URL. I know there are libraries such as Jtidy, or HtmlCleaner which can do parsing of the html and loading it, but I really want to be able to load Html to a URL object, rather than use these third party libraries.
What you're saying still doesn't make sense--you don't "load content into a URL"--a URL is used to *retrieve* content.
What, *precisely*, are you trying to do?
Cyrus Taz
Greenhorn
Joined: Sep 27, 2010
Posts: 3
posted
0
It does make sense. I have thousands of pages of Html which are saved into database rather than on the file system, and this is not uncommon practice at all. Now, I want to read these html pages, process them, and then save them back to the database; and we have third party classes and methods which require URL objects to be passed to them. So, one solution is to save them to a temporary file, and create URL based on the path of that temporary file. In this situation (and there are many similar situations), it is of no material where the content comes from; and the process of saving the files of course is very slow compared to the rest of the tests. So, I'm doing the extra step of saving the html content to a file just cause the API of these third party libraries are asking for URL.
URLs don't have content. They *read* content. I'd probably just write a URLStreamHandler, or subclass and override URL.openStream, depending on your requirements. Or just expose them with an internal server and pass a normal URL.