Is it possible to grab a file stored on the server without using Tomcat?
I have been tasked with parsing and displaying a log file inside a legacy Applet. Both the Applet and the log file are stored on the same server. As I am reading up on this, I have discovered that JSch may be the way to go. That said, Tomcat is not installed on the server and the powers that be don't want to "mess" with that server.
Could someone point me in the right direction as to how I might grab a file (with this Tomcat restriction) so I can display it in the Applet? I can do everything involved with this task except get the file.
I can ssh into the server from the client.
Appreciate the help
I've got just enough Java knowledge to royally screw everything up. :-)
Probably you can. You don't need Tomcat to do that, you just need an ordinary web server which will serve that file to the outside world. You're already running a server to support the applet, right? So configuring that server to serve the file would work fine.
Once you get the configuration done, the first test is to see whether a browser can access the file. If it can, then the applet should be able to access it as well.
Joined: Mar 30, 2012
I appreciate the response Paul.
Today I explored grabbing the file via PHP and that worked well. I now have the contents displaying in the browser after parsing it with PHP.
I can get the file onto the client easily from outside the Applet, but I need it passed (or the parsed contents of the file passed) into the Applet. Also, the specific file is chosen via JComboBox in the Applet so that variable must be sent to the server.
Anyway, the PHP seems to be working but I'll take your advice and look into having IT configure the server so the log directory is served to the outside world. I don't expect that to be a problem since this is an intranet and the "world" is kinda small.
To access the file from the applet, you first need to know its URL, i.e. the URL via which the browser can download it. Then use the applet's getDocumentBase() method to get the URL of the page in which the applet is embedded, and work from there (via a relative path) to get the URL of the file. Then the URL has an openStream() method which gives you an InputStream to read the file from.
Joined: Mar 30, 2012
Ulf & Paul,
These two breadcrumbs you've given me are exactly what I was looking for. Now I have a trail to follow and implement.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Access Server File from Applet without Tomcat