• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to read files from internet

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if i post a txt file on the internet is it possible to make a program to read this file?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes: http://www.exampledepot.com/egs/java.net/ReadFromURL.html
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

I just tried your suggestion, I am getting the following exception after a couple of seconds:



I too want to know about this. Can anyone please help me out to resolve this exception? I am using a proxy server which requires authentication to access the internet. Is it anything to do with this?

Thanks for your help...!
 
Marshal
Posts: 28174
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

zahid zubair wrote:I am using a proxy server which requires authentication to access the internet. Is it anything to do with this?



Quite likely yes. Here's a link to Sun's writeup about how to connect via proxy servers. It's possible that just implementing that will automatically deal with the authentication, but it depends on what platform your code is running on and what kind of proxy server it is and so on.
 
zahid zubair
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for your response. I gone through it and was able to accomplish my task using the website given and some google search on java website.



However, I don't understand why the proxyType is set to 4, what does it mean?
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

zahid zubair wrote:
However, I don't understand why the proxyType is set to 4, what does it mean?



I don't see anything about that system property in the JDK Networking Documentation. Where did you find it?
The java.net.Proxy class is probably easier to deal with than the system properties. Have a look here for an example.
 
zahid zubair
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While I was receiving the HTTP 407 error when I tried the code in the url posted by you, I found the resolution in http://forums.sun.com/thread.jspa?threadID=500360
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

zahid zubair wrote:While I was receiving the HTTP 407 error when I tried the code in the url posted by you



I'm not Ulf or Paul
I can't find any references to the "http.proxyType" property. The links in that thread don't mention it. The original poster says he got it from another thread, but searching that forum only brings up his post. I think he imagined it.
 
Paul Clapham
Marshal
Posts: 28174
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Likewise there isn't anything about

in that documentation either.

You'll find that it makes no difference whether you use this system property or not, because it isn't used by any of the JRE code. It's a bogus property, in other words, which somebody thought up years ago and it's been copied from one internet site to another without anybody checking it.
 
zahid zubair
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh. Is it so!!! Thanks for making me aware guys. However, my code copying mistake might have made others aware as well.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic