Thread View: pl.comp.lang.java
3 messages
3 total messages
Started by Yan' Terrien
Sun, 12 Oct 1997 06:17
Ftp Applet
Author: Yan' Terrien
Date: Sun, 12 Oct 1997 06:17
Date: Sun, 12 Oct 1997 06:17
33 lines
1730 bytes
1730 bytes
I am trying to create an applet for connect to FTP from a web page.
When I run from command line, it works.
When I write the same code in an applet, and call it from a web page, it
says :
' violation security error '
Can somebody tell me why ? Here is the code :
Socket controlSocket = null;
DataInputStream controlInputStream = null;
PrintStream controlOutputStream = null;
public boolean connect (String hostName)
{
try {
controlSocket = new Socket(hostName, 21);
controlInputStream = new
DataInputStream(controlSocket.getInputStream());
controlOutputStream = new
PrintStream(controlSocket.getOutputStream());
} catch (UnknownHostException e) {
printText("Hote inconnu: " + hostName);
return(false);
} catch (IOException e) {
printText("Connection Ó: " + hostName + " impossible");
return(false);
}
return(true);
}
-
http://perso.wanadoo.fr/yan.terrien/
Fed at Mic Rosoft of Ron Billgates
on double Big-Mic and Bug-Burger
Re: Ftp Applet
Author: Kim Do-Hyung
Date: Sun, 12 Oct 1997 12:09
Date: Sun, 12 Oct 1997 12:09
20 lines
1808 bytes
1808 bytes
Unsigned applet can only open connections to the host
from which it originates. That is, if the ftp server
that your applet trys to connect to is in the same
host as your web server which is delivering your applet,
it's ok. Otherwise, SecurityException will occur.
This restriction on applets is forced by SecurityManager
of web browsers. So your applet could run successfully
using appletviewer which enforces somewhat relaxed
security policies. What applets can and can't do is well
described at http://www.javasoft.com/sfaq/index.html.
Currently this restriction can be overcome by applet
signing. But unfortunately, Netscape and IE need different
methods to acquire required capabilities.
Hope this helps.
P.S. I think you crossposted your article to too many newsgroups.
I've even seen your article in Korean one in which most articles
are written in Korean. If you have no proper reason to post
articles to a specific group, you'd better not, IMHO.
Re: Ftp Applet
Author: Johnathan Mark Smith
Date: Mon, 13 Oct 1997 16:49
Date: Mon, 13 Oct 1997 16:49
43 lines
2145 bytes
2145 bytes
check out the Staten Island Java Group FTp Class
http://www.statenislandonline.com/java
On 12 Oct 1997 06:17:57 GMT, "Yan' Terrien" <Yan.Terrien@wanadoo.fr>
wrote:
>
>I am trying to create an applet for connect to FTP from a web page.
>When I run from command line, it works.
>When I write the same code in an applet, and call it from a web page, it
>says :
>' violation security error '
>Can somebody tell me why ? Here is the code :
>
>Socket controlSocket = null;
>DataInputStream controlInputStream = null;
>PrintStream controlOutputStream = null;
>
>public boolean connect (String hostName)
> {
> try {
> controlSocket = new Socket(hostName, 21);
> controlInputStream = new
>DataInputStream(controlSocket.getInputStream());
> controlOutputStream = new
>PrintStream(controlSocket.getOutputStream());
> } catch (UnknownHostException e) {
> printText("Hote inconnu: " + hostName);
> return(false);
> } catch (IOException e) {
> printText("Connection Ó: " + hostName + " impossible");
> return(false);
> }
> return(true);
> }
>-
>http://perso.wanadoo.fr/yan.terrien/
>Fed at Mic Rosoft of Ron Billgates
>on double Big-Mic and Bug-Burger
Staten Island Java Group
http://www.statenislandonline.com/java
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads