Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342995 - Provide a public JSExecutor API
Summary: Provide a public JSExecutor API
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.4   Edit
Hardware: All All
: P3 enhancement with 6 votes (vote)
Target Milestone: 2.0 M3   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: plan-version=2.0 plan-theme=alternati...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-15 11:33 EDT by Benjamin Wolff CLA
Modified: 2012-10-10 08:59 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Wolff CLA 2011-04-15 11:33:54 EDT
Since there have been recent issues in the newsgroup that could be solved by using the JSExecutor, I wonder if it would make sens to provide a public API for that.

I'm using the internal JSExecutor myself to execute arbitrary JS that needs to be executed on the hole page and not only in a Browser widget (closing the page or redirect, dynamically change the browser title).

So would it would make sens to provide this class or a similar mechanism as public API or are there more appropriate measures? It would definetely add more flexibility to execute arbitrary JS code but would also expose internals.
Comment 1 Rüdiger Herrmann CLA 2011-04-16 08:09:14 EDT
We should also consider to provide an API that allows to read request parameters.
Comment 2 Ralf Sternberg CLA 2011-04-17 16:16:41 EDT
I agree that there should be API to execute custom script code on the client. We're going to provide a dedicated slot for this in the protocol.

However, I currently don't think that such an API should be limited to JavaScript. Even though the current RAP client can only handle JavaScript, it may become possible to execute code in different languages on a RAP client. I'm thinking about an API with an additional type parameter along the lines of <script type="text/javascript">... in HTML.
Comment 3 Ivan Furnadjiev CLA 2012-10-10 08:59:44 EDT
We implemented the JavaScriptExecutor as a web client service. Usage:
JavaScriptExecutor executor = RWT.getClient().getService( JavaScriptExecutor.class );
if( executor != null ) {
  executor.execute( javaScriptCode );
}