Calling the applet from Javascript
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 269
- Joined: Sat Jul 10, 2010 4:03 pm
Calling the applet from Javascript
I'm having intermittent crashes when calling the applet to load up a file and am sure its something I'm not doing right.
I see two different methods used..
this one elevates privileges
this one calls runnable, elevates privileges and waits on a thread.
1.) Why the difference?
2.) If I add a function which should I use?
3.) If I return a value there is no built in thread accessors?
4.) What happens if these get stacked? elevate, calls another elevate?
thanks,
Scott
I see two different methods used..
this one elevates privileges
Code: Select all
public String getSerializedDocument() {
//EXM-27477 This method might come from Javascript code, elevate privileges.
return AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
StringBuilder builder = new StringBuilder();
BufferedReader reader = new BufferedReader(editorComponent
Code: Select all
public void setDocumentContent(final String url, final String xmlContent)
throws AuthorComponentException {
documentURL = url;
Runnable runnable = new Runnable() {
@Override
public void run() {
//EXM-27477 This method might come from Javascript code, elevate privileges.
AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
invokeOnAWT(new Runnable() {
@Override
public void run() {
2.) If I add a function which should I use?
3.) If I return a value there is no built in thread accessors?
4.) What happens if these get stacked? elevate, calls another elevate?
thanks,
Scott
-
- Posts: 269
- Joined: Sat Jul 10, 2010 4:03 pm
Re: Calling the applet from Javascript
I cleaned up and combined the function calls into the applet from javascript, and so far that has ended the odd crash.
Though I haven't been able to run the applet from a remote server yet to really test it. It did appear to be timing or thread issues..
Scott
Though I haven't been able to run the applet from a remote server yet to really test it. It did appear to be timing or thread issues..
Scott
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Calling the applet from Javascript
Hi Scott,
I am not sure why those crashes occurred, did you find any meaningful information in the Java console view?
From what I remember, when the Javascript code calls the applet code, it calls it with restrictive security permissions so we elevated the rights in the Java code.
An alternative to elevating the rights in the Java functions called from JS would have been to call System.setSecurityManager(null); early when the applet was started.
Regards,
Radu
I am not sure why those crashes occurred, did you find any meaningful information in the Java console view?
From what I remember, when the Javascript code calls the applet code, it calls it with restrictive security permissions so we elevated the rights in the Java code.
An alternative to elevating the rights in the Java functions called from JS would have been to call System.setSecurityManager(null); early when the applet was started.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 269
- Joined: Sat Jul 10, 2010 4:03 pm
Re: Calling the applet from Javascript
Radu,
When it happened, The browser would hang, no output in the console. When it would finally recover the console would close, and the web page would report the plugin had crashed.
If it happens again I will enable logging in the java control panel.
Scott
When it happened, The browser would hang, no output in the console. When it would finally recover the console would close, and the web page would report the plugin had crashed.
If it happens again I will enable logging in the java control panel.
Scott
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service