• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Problem in reading files in remote server

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All

This is regarding a query to read a file in a remote server.

The user interface is a html screen which contains 2 fields: Server ip & file name. Both are drop down fields.So they can select only the given file names & server names.

A servlet will recieve the data from the html.
The logic used is as below:
A URL is created with input given and using URLCOnnection i get the inputstream and read the data in the file. But i get an error, "file not found."
The url path formed looks like this

The file i am checking is in the home directory in the unix server.
Will the path given in the url check in the home directory. If not how to specify the path to the "home" directory in the url path.

Posts: 43011
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A URL starting with "http" will only be understood by a web server. Are all the possible yservers you want to retrieve files from set up with a web server AND with a servlet/CGI that listens to URLs of the form you describe?
It sounds like you are trying to use HTTP as a sort of distributed file system, but that will only work with web servers and proper web apps that listen for file requests and return those files. Is using the filesystem directly (with mounts for the various servers) out of the question?
I would be very hesitant to serve files out of the root directory over HTTP for security reasons.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!