Java server access  
Author Message
James David Miller





PostPosted: 2003-11-3 12:08:00 Top

java-programmer, Java server access 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

 
Shripathi Kamath





PostPosted: 2003-11-3 12:30:00 Top

java-programmer >> Java server access
"James David Miller" <email***@***.com> wrote in message
news:cwkpb.67993$275.175579@attbi_s53...
> 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,


--
Shripathi Kamath
NETAPHOR SOFTWARE INC.
http://www.netaphor.com


 
James David Miller





PostPosted: 2003-11-3 12:42:00 Top

java-programmer >> Java server access This is a multi-part message in MIME format.

Shripathi Kamath wrote:

>"James David Miller" <email***@***.com> wrote in message
>news:cwkpb.67993$275.175579@attbi_s53...
>
>
>>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,
>
>
>
>
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


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Shripathi Kamath wrote:<br>
<blockquote type="cite" cite="mid7Rkpb.52565$hp5.12964@fed1read04">
<pre wrap="">"James David Miller" <a class="moz-txt-link-rfc2396E" href="mailto:email***@***.com"><email***@***.com></a> wrote in message
<a class="moz-txt-link-freetext" href="news:cwkpb.67993$275.175579@attbi_s53">news:cwkpb.67993$275.175579@attbi_s53</a>...
</pre>
<blockquote type="cite">
<pre wrap="">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

</pre>
</blockquote>
<pre wrap=""><!---->
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 <a class="moz-txt-link-freetext" href="http://server/list/directory_name">http://server/list/directory_name</a>

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,


</pre>
</blockquote>
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.  <br>
Does servlets use http to communicate with applets?<br>
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?<br>
<br>
David<br>
<br>
</body>
</html>

 
 
Michael Borgwardt





PostPosted: 2003-11-3 18:32:00 Top

java-programmer >> Java server access James David Miller wrote:
> 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.

 
 
Michael Borgwardt





PostPosted: 2003-11-3 19:20:00 Top

java-programmer >> Java server access > 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.

 
 
raynaudolivier





PostPosted: 2003-11-3 22:31:00 Top

java-programmer >> Java server access Michael Borgwardt <email***@***.com> wrote in message news:<bo5ar1$17e6bt$email***@***.com>...
> James David Miller wrote:
> > 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.

Thats it !!