OutputStream oc = new FileOutputStream("c:/shiv/filewrite.txt");
You may need to add this file in to acl for reading
http://java.sun.com/sfaq/#read
Kedar
-----Original Message-----
From: shiv shankar [mailto:[EMAIL PROTECTED]
Sent: Monday, June 19, 2006 3:57 PM
To: [email protected]
Subject: HttpClient : Sending Multipart request from applet
Hello all,
I need help on the httpclient . I have used this api in a JFrame and sending
mutipart request to servlet, which is doing a fine job of uploading the the
file.
But when the same is done using applet, it is gving me
java.Security.AccessConlroleException.
The problem come when it process a statement
PostMethod pMethod = new PostMethod(url);
The following is a small program.Which I tred to execute and giving me
lava.security.AccesscontroleException EVEN AFTER SIGNING THE APPLET
import java.io.*;
import java.awt.*;
import java.applet.*;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import
org.apache.commons.httpclient.methods.PostMethod;
import
org.apache.commons.httpclient.methods.multipart.FilePart;
import
org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import
org.apache.commons.httpclient.methods.multipart.Part;
import
org.apache.commons.httpclient.params.HttpMethodParams;
public class FileStreamApplet extends Applet {
public void init() {
try {
String targetURL =
"http://localhost:8080/echo/echo";
PostMethod filePost = new
PostMethod(targetURL);
System.out.println("Hello from FileStream Applet");
Label l1 = new Label("Write into file using
applet");
this.add(l1);
OutputStream oc = new
FileOutputStream("c:/shiv/filewrite.txt");
oc.write("Welcome to eriting a applet".getBytes());
oc.close();
Label l = new Label("Write into file using applet");
this.add(l);
}
catch(Exception e) {
e.printStackTrace();
}
}
}
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]