Java server access

  • Thread starter James David Miller
  • Start date
J

James David Miller

I have a javaApplet that needs to access a directory on the server, list
the files in directory, then access the selected file. My first idea
was to use a servlet on the server then I found out that the server that
this needs to work with doesn't support servlets or Tomcat. The server
supports PHP and CGI and the hosting company does not want to add java
support.
Can anyone give me an idea on how to go about this?

David Miller
 
S

Shripathi Kamath

James David Miller said:
I have a javaApplet that needs to access a directory on the server, list
the files in directory, then access the selected file. My first idea
was to use a servlet on the server then I found out that the server that
this needs to work with doesn't support servlets or Tomcat. The server
supports PHP and CGI and the hosting company does not want to add java
support.
Can anyone give me an idea on how to go about this?

David Miller

Depending upon what you mean by "access", it is possible to do the above
without even using an applet. Simply have a URL which specifies the name of
the directory you wish to access.

Something like http://server/list/directory_name

On the server side, either via PHP or CGI, parse the URL for the command
"list", and the directory name "directory_name", return an HTML response
which has the list of the files in the directory in a list box.

Handle the submission from the client of a selected file, and provide as a
response whatever constitutes "access" to it.

Of course, you may want to get fancy in your output and selection, but that
is the gist of it. Of course, other solutions are possible.

HTH,
 
J

James David Miller

Shripathi said:
Depending upon what you mean by "access", it is possible to do the above
without even using an applet. Simply have a URL which specifies the name of
the directory you wish to access.

Something like http://server/list/directory_name

On the server side, either via PHP or CGI, parse the URL for the command
"list", and the directory name "directory_name", return an HTML response
which has the list of the files in the directory in a list box.

Handle the submission from the client of a selected file, and provide as a
response whatever constitutes "access" to it.

Of course, you may want to get fancy in your output and selection, but that
is the gist of it. Of course, other solutions are possible.

HTH,
Ok I have that, I have PHP that I can make a request and get back a
list of files, etc. but now I have this applet that I need to parse data
from the selected file and display specific info in the applet frame. I
have the bulk of the applet working now.
Does servlets use http to communicate with applets?
If yes, is there a special header that is needed in the response? I can
make my applet send a post or get to my PHP to generate a response but
what goes in this response to tell my browser that it isn't a new page
to be displayed but data to be sent to the applet?

David
 
M

Michael Borgwardt

James said:
I have a javaApplet that needs to access a directory on the server, list
the files in directory, then access the selected file. My first idea
was to use a servlet on the server then I found out that the server that
this needs to work with doesn't support servlets or Tomcat. The server
supports PHP and CGI and the hosting company does not want to add java
support.
Can anyone give me an idea on how to go about this?

Should be easy enough to write PHP or other CGI script to do the directory
listing.

Actually, you might not even need that. If the web server has directory
listings activated (or lets you activate them) then you could request
the directory URL and parse the output within the applet.
 
M

Michael Borgwardt

Does servlets use http to communicate with applets?

It's your choice, really.
If yes, is there a special header that is needed in the response? I can
make my applet send a post or get to my PHP to generate a response but
what goes in this response to tell my browser that it isn't a new page
to be displayed but data to be sent to the applet?

If you do the HTML request within the applet code, the web browser
doesn't get involved at all.
 
T

tiger10112

Michael Borgwardt said:
Should be easy enough to write PHP or other CGI script to do the directory
listing.

Actually, you might not even need that. If the web server has directory
listings activated (or lets you activate them) then you could request
the directory URL and parse the output within the applet.

Thats it !!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top