I'm currently experimenting with adding an applet layer on top of a
servlet application. This works ok when using URLConnection to fetch/send
data to/from the servlet.

However, while URLConnection works, it is a rather clumsy way of doing
longer conversations. Keeping track of the session cookie and such things
is possible, but a nuisance.

Thus an attempt at utilizing HttpClient. However, it seems that it is not
possible to even instantiate a HttpClient object in a JApplet, as an
AccessControlException (permission denied) is thrown (see attached stack
trace). From reading the stack trace and the source code, I gather that
the problem is the attempted calling of System.getProperties(), which is
not allowed in applets (this call is made around line 179 in the head of
the HttpMethodBase class in order to set the static user agent string
variable).

My question is: Is support for applets planned in HttpClient? Before I
continue tinkering with the source code, are there any known reasons
(apart from the getProperties() call) why HttpClient shouldn't be possible
to use in applets?

I'm using sun j2sdk 1.4.1 and commons-httpclient-20021202.

  // Joel

java.lang.ExceptionInInitializerError
        at testapplet.btnHej_click(testapplet.java:50)
        at testapplet$1.actionPerformed(testapplet.java:25)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
        at 
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)

        at 
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
        at 
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
        at java.awt.Component.processMouseEvent(Component.java:5093)
        at java.awt.Component.processEvent(Component.java:4890)
        at java.awt.Container.processEvent(Container.java:1566)
        at java.awt.Component.dispatchEventImpl(Component.java:3598)
        at java.awt.Container.dispatchEventImpl(Container.java:1623)
        at java.awt.Component.dispatchEvent(Component.java:3439)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
        at java.awt.Container.dispatchEventImpl(Container.java:1609)
        at java.awt.Component.dispatchEvent(Component.java:3439)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
        at 
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
        at 
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
Caused by: java.security.AccessControlException: access denied 
(java.util.PropertyPermission * read,write)
        at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
        at java.security.AccessController.checkPermission(AccessController.java:401)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
        at java.lang.SecurityManager.checkPropertiesAccess(SecurityManager.java:1259)
        at java.lang.System.getProperties(System.java:500)
        at 
org.apache.commons.httpclient.HttpMethodBase.<clinit>(HttpMethodBase.java:179)
        ... 24 more


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to