On Fri, 2008-03-14 at 19:22 -0400, Mark Wyszomierski wrote: > Hi, > > I'm trying to use HttpClient.execute() inside a java applet. > > I have it > working fine in a local application. I got my applet signed via the > instructions here: > > http://forum.java.sun.com/thread.jspa?threadID=174214 > > now the web page the applet is hosted in asks for user approval, ok, > agreed to the certificate. Still though, a call to HttpClient.execute > fails when run from the applet. Here's how the code is being used: > > HttpClient client = new HttpClient(); > PostMethod requestMethod = new PostMethod(postURL); > requestMethod.setRequestHeader("Content-Type", "application/json"); > RequestEntity requestEntity = new StringRequestEntity(postJSON); > requestMethod.setRequestEntity(requestEntity); > status = client.executeMethod(requestMethod); > > The last call (execute()) generates an exception, this is the stack trace: > > java.security.AccessControlException: access denied > (java.net.SocketPermission api.mysite.com resolve) > 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.checkConnect(Unknown Source) > at java.net.InetAddress.getAllByName0(Unknown Source) > at java.net.InetAddress.getAllByName(Unknown Source) > at java.net.InetAddress.getAllByName(Unknown Source) > at java.net.InetAddress.getByName(Unknown Source) > at java.net.InetSocketAddress.<init>(Unknown Source) > at java.net.Socket.<init>(Unknown Source) > at > org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80) > at > org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122) > at > org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) > at > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387) > at > org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) > at myapplet.makeHttpRequest(myapplet.java:79) > at java.lang.Thread.run(Unknown Source) > > Well, I thought after going through the signing procedure, that would > have given me the right permissions. Perhaps I'm missing something > else though? Any ideas would be great, >
Have you signed each and every jar used in the applet? Oleg > Thanks, > Mark > > --------------------------------------------------------------------- > 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]
