简体   繁体   中英

HOW-TO: remote file access from a web server?

We have a web application which which is deployed and used within an intranet. The application reads in text files from a specified location on the web server itself.

Now we have a requirement of reading in text files from other machines as well, so i'm exploring possible options to implement this. Possible options i've been thinking of are:

  1. Maybe start a ftp server on each local machine and then write a servlet to ftp given machines n read-in data.
  2. Maybe run some utility program thats would read in file contents and push it back to the server using xml etc ?)

Ne help about above/or new ideas would be highly appreciated!

Technologies i'm using are : Tomcat/Struts/JSP/AJAX.

PS i want to handle non NFS situations as well!

Thanks, Abhishek.

apart from the fact that I don't know whats the purpose of the application you're building, and knowing it is a Web-app, why not have users upload the specific files you want to process?, or even better, if they are configuration files, you might put them all in one single location, let's say just one machine. That might be better than having your app stuck just because some machine is not accessible.

I have an idea for you.... You may expose web service on each machine where from you want to get logs.These web services will read log files and send to your web application in bytes. You web application will call these service periodically and will take latest data. your entire system would work like a distributed system. you need to ensure that log file should generate with the name in uniform format - for eg.. log-24-12-2010.log or log24122010.log (if your log file generates on daily basis) - so that web services can form the right name of log and access it.

I recommand you to use RESTful web services because they are pretty easy for such purposes. Use JAX-RS APIs to develop such services.

I hope you would get my idea a little bit.

~~ Priyanjan

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM