Hello Kedar,
Let me put in this way, Below is a applet where I have
given the statemnt
PostMethod pMethod = new PostMethod(targetUrl);
public class FileStreamApplet extends Applet {
public void init() {
try {
String targetURL =
"http://localhost:8080/echo/echo";
PostMethod filePost = new PostMethod(targetURL);
}
catch(Exception e) {
e.printStackTrace();
}
}
}
I have complied and signed this applet , It is giving
me the following exception
java.lang.ExceptionInInitializerError
at
org.apache.commons.httpclient.HttpMethodBase.<clinit>(HttpMethodBase.java:102)
at FileStreamApplet.init(FileStreamApplet.java:21)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException:
access denied (java.util.PropertyPermission
org.apache.commons.logging.LogFactory.HashtableImpl
read)
at
java.security.AccessControlContext.checkPermission(Unknown
Source)
at
java.security.AccessController.checkPermission(Unknown
Source)
at java.lang.SecurityManager.checkPermission(Unknown
Source)
at
java.lang.SecurityManager.checkPropertyAccess(Unknown
Source)
at java.lang.System.getProperty(Unknown Source)
at
org.apache.commons.logging.LogFactory.createFactoryStore(LogFactory.java:320)
at
org.apache.commons.logging.LogFactory.<clinit>(LogFactory.java:1725)
... 4 more
I have taken out the OutputStream stuff.
R.Shiv Shankar
--- Kedar Panse <[EMAIL PROTECTED]> wrote:
> 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]
>
>
__________________________________________________
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]