tyrus icon indicating copy to clipboard operation
tyrus copied to clipboard

Support for running websocket client inside sandbox Java applet

Open glassfishrobot opened this issue 11 years ago • 3 comments
trafficstars

Tyrus websocket client doesn't function out of the box within sandbox applet due to its restrictions and security limitations. There were 2 major problems with the existing code base: access to system properties (restricted in sandbox except for few specific Java properties, see http://docs.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/properties.html) and some Java reflections code that behaves differently in Sandbox applet than in a standalone application.

Below is the list of changes we've implemented to resolve the issue in Tyrus project (Grizzly project has a much bigger list):

1. /containers/grizzly-client/src/main/java/org/glassfish/tyrus/container/grizzly/client/GrizzlyClientSocket.java Made conditional access to system properties (when having no access - in sandbox applet, use predefined default). Also made conditional access to proxy settings (not allowed in sandbox).

2. /core/src/main/java/org/glassfish/tyrus/core/ReflectionHelper.java getParameterizedClassArguments method behaves differently in sandbox and in standalone application. Specifically, p.genericInterface is never instance of ParameterizedType (Java reflection getGeneric... methods do not return the correct type in sandbox for typed classes; for example, in standalone application we get MyClass.InnerClass<T> while in sandbox we get only MyClass.InnerClass only). As a workaround resolution, we hard coded specific org.glassfish.tyrus.core.coder.X classes instead of dynamic resolution.

Probably the solution we've implemented is not the best so it is just a hint on what should be fixed and where.

Environment

WildFly 8.1.0 application server, sandbox Java applet that uses Tyrus websocket client.

Affected Versions

[1.6]

glassfishrobot avatar Jun 16 '14 09:06 glassfishrobot

  • Issue Imported From: https://github.com/tyrus-project/tyrus/issues/508
  • Original Issue Raised By:@glassfishrobot
  • Original Issue Assigned To: @pavelbucek

glassfishrobot avatar Feb 10 '18 20:02 glassfishrobot

@glassfishrobot Commented Reported by mark30000

glassfishrobot avatar Jun 16 '14 09:06 glassfishrobot

@glassfishrobot Commented This issue was imported from java.net JIRA TYRUS-331

glassfishrobot avatar Apr 25 '17 02:04 glassfishrobot