Open arinban opened 10 years ago
@glassfishrobot Commented Reported by mark30000
@glassfishrobot Commented oleksiys said: Thank you! The source code and diffs will help a lot! You can use the github mirror [1] to create a pull request.
WBR, Alexey.
@glassfishrobot Commented This issue was imported from java.net JIRA GRIZZLY-1692
When running Grizzly code inside Sandbox Java applet (used by Tyrus implementation of Java client websocket) we got many access rights exceptions. Those all come for one reason - illegal access to system properties (in sandbox applet you are allowed to access only handful set of very specific system properties, see http://docs.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/properties.html). To resolve the issue, we implemented a very straightforward solution as follows:
1. /modules/grizzly/src/main/java/org/glassfish/grizzly/Grizzly.java - decision whether we are running inside sandbox applet or standalone application with full access rights. Helper methods for conditional access of the system properties.
2. Made conditinal access to system property(s) (when having no access, use predefined default) in the following files: /modules/grizzly/src/main/java/org/glassfish/grizzly/Writer.java /modules/grizzly/src/main/java/org/glassfish/grizzly/attributes/AttributeBuilderInitializer.java /modules/grizzly/src/main/java/org/glassfish/grizzly/compression/lzma/LZMAEncoder.java /modules/grizzly/src/main/java/org/glassfish/grizzly/memory/BufferArray.java /modules/grizzly/src/main/java/org/glassfish/grizzly/memory/BuffersBuffer.java /modules/grizzly/src/main/java/org/glassfish/grizzly/memory/ByteBufferArray.java /modules/grizzly/src/main/java/org/glassfish/grizzly/memory/ByteBufferManager.java /modules/grizzly/src/main/java/org/glassfish/grizzly/memory/HeapMemoryManager.java /modules/grizzly/src/main/java/org/glassfish/grizzly/memory/MemoryManagerInitializer.java /modules/grizzly/src/main/java/org/glassfish/grizzly/nio/SelectionKeyHandlerInitializer.java /modules/grizzly/src/main/java/org/glassfish/grizzly/nio/transport/TCPNIOTransport.java /modules/http/src/main/java/org/glassfish/grizzly/http/util/B2CConverter.java
3. /modules/grizzly/src/main/java/org/glassfish/grizzly/utils/Charsets.java - preload of charsets only when running outside sandbox.
If you might need the exact source code, we will gladly provide it upon request.
Environment
WildFly 8.1.0 application server, sandbox Java applet that uses Tyrus websocket client (that in turn uses Grizzly libraries).
Affected Versions
[2.3.12]