I had started working on something for a JavaServer Page that would read the contents between the html <title></title> tags to find the title of the page. What I was looking at was the java.net.URL class and the related classes in the Javadoc. There is a method: object URL.getContent() in the URL class. The object returned has to do with the Content Type and the MIME, etc. That's where I realized it was more trouble than it was worth for my purposes. Since all the URLs I were interested in where on my server, I just used the Servlet methods to obtain the real path of the files and accessed them with the java.io file classes. I doubt that would work with files that don't belong to you, however I'm sure it can be done, it's just gonna take some research either on the web or throught the javadoc. Good Luck.
------------------ --- WebNelly.com Java/XML Web Development Check it out! http://www.webnelly.com
WebNelly.com<br />Java/XML Web Development<br />Check it out!<br /><a href="http://www.webnelly.com" target="_blank" rel="nofollow">http://www.webnelly.com</a>
Somebody in a different part of the forum was having a similar problem, and I think he figured it out. Here's the URL: http://www.javaranch.com/ubb/Forum7/HTML/006735.html He might be just the right person to help you out.
------------------ WebNelly.com Java/XML Web Development Check it out! http://www.webnelly.com
lili la
Greenhorn
Joined: Nov 05, 2001
Posts: 3
posted
0
Thank you All. I'm now able to solve the problem.
Kris Nelson
Ranch Hand
Joined: Nov 04, 2001
Posts: 35
posted
0
I was curious on how it worked out. Got any details of what you did?
------------------ WebNelly.com Java/XML Web Development Check it out! http://www.webnelly.com
Just do something like this: <code> URL url = new URL("http://www.javaranch.com"); HttpUrlConnection conn = new HttpUrlConnection(url); url.connect(); InputStream in = url.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); </code> then you can iterate over reader, calling readLine() which will return each line of the html returned.
Kris Nelson
Ranch Hand
Joined: Nov 04, 2001
Posts: 35
posted
0
Thanks BJ, It'll be put to good use, I promise
------------------ WebNelly.com Java/XML Web Development Check it out! http://www.webnelly.com