WebView and Twitter4j

Hi All,
I have a very strange one. Using a WebView by itself is fine. Using a twitter4j instance by itself is also fine. But for some reason, when I use both, it bombs out with a null pointer and seems to be blaming a cookie!?
The main issue arises when I get to the requestToken. You'll need twitter4j to test this:
package webtest;
import java.io.IOException;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.auth.RequestToken;
public class WebTest extends Application {
     * @param args the command line arguments
    public static void main(String[] args) {
        Application.launch(WebTest.class, args);
    @Override
    public void start(Stage primaryStage) throws TwitterException, IOException {
        primaryStage.setTitle("Hello World");
        Group root = new Group();
        Scene scene = new Scene(root, 800, 600, Color.LIGHTGREEN);
        primaryStage.setScene(scene);
        primaryStage.setVisible(true);
        WebView browser = new WebView();
        browser.setPrefSize(600, 400);
        WebEngine webEngine = new WebEngine();
        webEngine.load("http://www.google.com");
        browser.setEngine(webEngine);
        root.getChildren().add(browser);
        Twitter twitter = new TwitterFactory().getInstance();
        twitter.setOAuthConsumer("Nothing", "Test");
        RequestToken requestToken = twitter.getOAuthRequestToken();
}Note: Using a valid "twitter.setOAuthConsumer("Nothing", "Test");" does the excat same thing, so it's not that I'm using an incorrect consumer key.
Now, am I crazy, or is this really bombing out due to the combination of both? Commenting out the requestToken goes fine and commenting out the WebView stuff also goes fine....

Hi Narayan,
thanks for the reply. I am aware of how to do it, but running that code throws me a null pointer. Did you try that code yourself? perhaps it is just me for some reason.... Please let me know if it works for you :)
package webtest;
import java.io.IOException;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.auth.AccessToken;
import twitter4j.auth.RequestToken;
public class WebTest extends Application {
     * @param args the command line arguments
    public static void main(String[] args) {
        Application.launch(WebTest.class, args);
    @Override
    public void start(Stage primaryStage) throws TwitterException, IOException {
        primaryStage.setTitle("Hello World");
        Group root = new Group();
        Scene scene = new Scene(root, 800, 600, Color.LIGHTGREEN);
        primaryStage.setScene(scene);
        primaryStage.setVisible(true);
        WebView browser = new WebView();
        browser.setPrefSize(600, 400);
        WebEngine webEngine = new WebEngine();
        browser.setEngine(webEngine);
        Twitter twitter = new TwitterFactory().getInstance();
        twitter.setOAuthConsumer("{myKey}", "{mySecret}");
// Set break point here if you wish :)
        RequestToken requestToken = twitter.getOAuthRequestToken();
        if(requestToken.getAuthorizationURL()!=null){
            webEngine.load(requestToken.getAuthorizationURL());
        root.getChildren().add(browser);
        //AccessToken accessToken = twitter.getOAuthAccessToken(requestToken,"1234567");
}And null pointer:
run:
Exception in Application start method
java.lang.RuntimeException: java.lang.NullPointerException
     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1137)
     at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2346)
     at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:388)
     at twitter4j.internal.http.HttpResponseImpl.<init>(HttpResponseImpl.java:35)
     at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:168)
     at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
     at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:102)
     at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:121)
     at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:104)
     at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:271)
     at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:264)
     at webtest.WebTest.start(WebTest.java:48)
     at com.sun.javafx.application.LauncherImpl$3.run(LauncherImpl.java:112)
     at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:87)
     at com.sun.javafx.application.PlatformImpl$2.run(PlatformImpl.java:65)
     at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
     at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
     at com.sun.glass.ui.win.WinApplication$2.run(WinApplication.java:51)
     at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
     at com.sun.webpane.webkit.network.CookieJar$PolicyDelegateFilter.shouldAccept(CookieJar.java:41)
     at com.sun.webpane.webkit.network.CookieManager.put(CookieManager.java:193)
     at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:710)
     at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
     at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
     ... 16 more
BUILD SUCCESSFUL (total time: 2 seconds)Edited by: user6459266 on 06-Jul-2011 01:00

Similar Messages

  • Using internal SSL Certs for Webview and Reskill (ICM 7.2.X)

    Hi,
    I would like to use corporate ssl certs for webview and reskill to avoid the user having to install the self signed certificate on the local machine. Has anyone any experience of this? Can it cause any unforseen problems?
    My plan for webview is to create the certificate request in IIS for the default website, use this csr to generate the cert, then complete it by uploading the certificate.
    For reskilling, I will assume I will have to do some command line stuff here ...
    eg: keytool -genkey -keyalg RSA -keystore hostname.key
    to create the key,
    keytool -certreq -keyalg RSA -keystore hostname.key -file hostname.csr
    to create the csr, and
    keytool -import -trustcacerts -alias tomcat -file hostname.cer -keystore hostname.key
    to import the new cert
    Suggestions or comments for anyone who has tried this before would be appreciated.
    Regards,
    Brian

    I've never done it on a version so old, but at the end of the day it's just IIS and Tomcat and importing an SSL cert is very standard.
    david

  • Call C# method from javascript in WebView and retrieve the return value

    The issue I am facing is the following :
    I want to call a C# method from the javascript in my WebView and get the result of this call in my javascript.
    In an WPF Desktop application, it would not be an issue because a WebBrowser
    (the equivalent of a webView) has a property ObjectForScripting to which we can assign a C# object containg the methods we want to call from the javascript.
    In an Windows Store Application, it is slightly different because the WebView
    only contains an event ScriptNotify to which we can subscribe like in the example below :
    void MainPage_Loaded(object sender, RoutedEventArgs e)
    this.webView.ScriptNotify += webView_ScriptNotify;
    When the event ScriptNotify is raised by calling window.external.notify(parameter), the method webView_ScriptNotify is called with the parameter sent by the javascript :
    function CallCSharp() {
    var returnValue;
    window.external.notify(parameter);
    return returnValue;
    private async void webView_ScriptNotify(object sender, NotifyEventArgs e)
    var parameter = e.Value;
    var result = DoSomerthing(parameter);
    The issue is that the javascript only raise the event and doesn't wait for a return value or even for the end of the execution of webView_ScriptNotify().
    A solution to this issue would be call a javascript function from the webView_ScriptNotify() to store the return value in a variable in the javascript and retrieve it after.
    private async void webView_ScriptNotify(object sender, NotifyEventArgs e)
    var parameter = e.Value;
    var result = ReturnResult();
    await this.webView.InvokeScriptAsync("CSharpCallResult", new string[] { result });
    var result;
    function CallCSharp() {
    window.external.notify(parameter);
    return result;
    function CSharpCallResult(parameter){
    result = parameter;
    However this does not work correctly because the call to the CSharpResult function from the C# happens after the javascript has finished to execute the CallCSharp function. Indeed the
    window.external.notify does not wait for the C# to finish to execute.
    Do you have any solution to solve this issue ? It is quite strange that in a Window Store App it is not possible to get the return value of a call to a C# method from the javascript whereas it is not an issue in a WPF application.

    I am not very familiar with the completion pattern and I could not find many things about it on Google, what is the principle? Unfortunately your solution of splitting my JS function does not work in my case. In my example my  CallCSharp
    function is called by another function which provides the parameter and needs the return value to directly use it. This function which called
    CallCSharp will always execute before an InvokeScriptAsync call a second function. Furthermore, the content of my WebView is used in a cross platforms context so actually my
    CallCSharp function more look like the code below.
    function CallCSharp() {
    if (isAndroid()) {
    //mechanism to call C# method from js in Android
    //return the result of call to C# method
    } else if (isWindowsStoreApp()) {
    window.external.notify(parameter);
    // should return the result of call to C# method
    } else {
    In android, the mechanism in the webView allows to return the value of the call to a C# method, in a WPF application also. But I can't figure why for a Windows Store App we don't have this possibility.

  • Webview and dojo

    Hi,
    If you use the latest Java7u9 WebView and browse to this dojo example page:
    http://dojotoolkit.org/reference-guide/1.8/dijit/form/FilteringSelect.html
    you can test some simple dojo dexamples.
    The first example opens a small dojo window containing a single combobox.
    After opening the dropdown list of the combobox I have no chance to select
    an entry in the dropdown list.
    The keyboard cursor keys still control the main webpage instead of the combox dropdown list.
    Clicking on entries using the mouse doesn't select the entry.
    So it seems to be a focus problem. The webview gets keyboard and mouse events
    but does not forward them to the dojo controls properly??
    So my current conclusion is that JavaFX WebView is not compatible with dojo.
    Is there anyone else having troubles with common JavaScript libraries and WebView?
    Best Regards
    Peter

    Is there anyone else having troubles with common JavaScript libraries and WebView?From time to time I have issues with using WebView with JavaScript libraries.
    I file bug reports with code to reproduce the issues at http://javafx-jira.kenai.com and eventually the issues get fixed.

  • UCCE 7.5.6 Supported Browsers for Webview and Agent reskilling

    Hi,  Can anyone out there please give me a link to the supported browsers (IE, FireFox etc) and their versions for UCCE 7.5(6) - We currently run with WIndows XP clients on IE7, however, would like to migrate to WIndows7 with IE8 / IE9
    Thanks in anticipation,
    gmb

    Below browser versions are supported and mentioned in the BOM for ICM 7.5
    http://www.cisco.com/en/US/docs/voice_ip_comm/cust_contact/contact_center/icm_enterprise/icm_enterprise_7_5/user/guide/icm75bom.pdf
    Check additional requirements for WebView Clients pg 44
    Internet Explorer 6.0 (SP1 or greater)
    Internet Explorer 7.0
    Internet Explorer 8.0 for ICM 7.5(7) or later
    Hope this helps.
    Shirish

  • Webview and LocationChangeEvent doesn't works

    Hello,
    In a mobile project with ActionScript and AIR, I use a Webview with a LocationChangeEvent.LOCATION_CHANGING attached to it.
    During my last test, it appears that it doesn't work anymore and I've seen it is caused by the last version of AIR since the 15.0.0.274.
    I've tried again with the AIR 16 without better results.
    Does something changed about the LocationChangeEvent since the AIR 15 ?
    Thanks for telling me.

    Hope you are using as below:
    ;with cte1
    as
    select 1 as level
    union all
    select level+1 from cte1
    where level<=1
    union all
    select level+2 from cte1
    where level<=1
    cte2
    as
    select level from cte1
    union all
    select level+3 from cte2 where level<=2
    select * from cte2
    order by level
    In these case be careful not to go for unnecessary or too many recursions. If in case too mnay recursions are required, giving a hint like below shud help..
    option (maxrecursion 100) --place this at the last..
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Webview and RSS

    Hi all
    We are setting up a public screen in our foyer and I want to use keynote simply as the output is amazing. I really want to display news from an RSS feed and have tried a few things with webview with limited success.
    Is there anyway to get news headlines on a Keynote slide, ideally scrolling but I would accept any format
    David

    Once a presentation has been opened, Keynote will not update a webpage, so this can't be done solely within Keynote. One option may be to create a Dashboard widget that displays the headlines, and use the technique described in this thread to float it above the presentation. Widgets are pretty simple to make and/modify, and I would bet that you can find a scrolling RSS reader that would meet your needs.

  • Performance issue using WebView and OpenLayers

    Hi Team,
    i am running javafx 2.2 from jdk7u21.
    openlayers version used is 2.12
    when i am trying to add a huge number of vectors to a vector layer, the CPU usage goes high and nothing gets displayed.
    Most of the CPU usage is done by com.sun.javafx.sg.prism.NGWebView.update()
    it works well till around 4K vectors, but goes for a toss beyond that.
    OpenLayers Code is as follows.
    vector layer Definition
    ==============
    var vector1= new OpenLayers.Layer.Vector("Drivers",{
    styleMap: new OpenLayers.StyleMap({
    "default": new OpenLayers.Style(OpenLayers.Util.applyDefaults({
    pointRadius: 3,
    fillColor : "blue",
    graphicName : "circle",
    fillOpacity : 1
    }, OpenLayers.Feature.Vector.style["default"])),
    "select": new OpenLayers.Style({
    externalGraphic: "${select_externalGraphic}"
    vector1.events.on({
    "featureselected": function(e) {
    //TODO: on Selection
    app.printOnConsole("From Vector Event>>"+e.feature.attributes.name);
    app.printOnConsole("From Vector Event"+Object.toJSON(e.feature.attributes));
    "featureunselected": function(e) {
    //TODO: on Deslect:
    Adding the vector code
    ===============
    var mymarker = new OpenLayers.Feature.Vector(
    new OpenLayers.Geometry.Point(LON,LAT),{
    default_externalGraphic: 'triangle_8.png',
    select_externalGraphic: 'triangle_8.png',
    rat : jsonObj.rat
    mylayer.addFeatures([mymarker]);
    Please suggest if there is a way i can fine tune my code to display the vectors.

    If running under a windows make sure you use a 32 bit java runtime (64 bit java runtimes on windows do not have a JavaScript jit compiler and are many times slower).
    Try java 8, it has many performance improvements.
    https://jdk8.java.net/download.html
    Use code tags
    https://forums.oracle.com/forums/ann.jspa?annID=1622

  • WebView inside JFXPanel: No drag and drop events received

    Hi,
    I'd like to manage Dnd between apps and a Swing application with a JFXPanel which embeds a WebView component.
    Currently, all drops are forbidden on top of the WebView, and I'd like to find a way for the WebView to accept transferable object such as URL...
    Moreover, code like this does not display anything in console. If I create a native JFX application (without JFXPanel Swing layer) the drag events occur.
                    webView.setOnDragDetected(new EventHandler<MouseEvent>() {
                   public void handle(MouseEvent event) {
                        System.err.println(event.toString());
              webView.setOnDragEntered(new EventHandler<DragEvent>() {
                   public void handle(DragEvent event) {
                        System.err.println(event.toString());
              webView.setOnDragOver(new EventHandler<DragEvent>() {
                   @Override
                   public void handle(DragEvent event) {
                        System.err.println(event.toString());                    
              webView.setOnDragDropped(new EventHandler<DragEvent>() {
                   @Override
                   public void handle(DragEvent event) {
                        System.err.println(event.toString());                    
              });I guess JFXPanel catches events, or I missed something...
    If anyone could help, thanks in advance!

    Hi,
    For people who can help, here is the entire code to reproduce the problem.
    JFXPanel seems to consume the DND event, and the JFX WebView component does not receive anything.
    Thanks a lot.
    import java.awt.Dimension;
    import javafx.application.Platform;
    import javafx.embed.swing.JFXPanel;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.input.DragEvent;
    import javafx.scene.input.Dragboard;
    import javafx.scene.input.TransferMode;
    import javafx.scene.paint.Color;
    import javafx.scene.web.WebView;
    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    public class WebViewInJFXPanel {
         private void initAndShowGUI() {
              // This method is invoked on Swing thread
              JFrame frame = new JFrame("WebView in JFXPanel");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              final JFXPanel fxPanel = new JFXPanel();
              fxPanel.setOpaque(false);
              fxPanel.setPreferredSize(new Dimension(800,600));
              frame.add(fxPanel);
              frame.pack();
              frame.setVisible(true);
              // Init JFX
              Platform.runLater(new Runnable() {
                   @Override
                   public void run() {
                        initFX(fxPanel);
         private void initFX(JFXPanel fxPanel) {
              // This method is invoked on JavaFX thread
              WebView webView = new WebView();
              webView.getEngine().load("http://javafx.com");
              // The following triggers are never invoked once in a JFXPanel
              webView.setOnDragEntered(new EventHandler<DragEvent>() {
                   public void handle(DragEvent event) {
                        System.err.println(event.toString());
              webView.setOnDragOver(new EventHandler<DragEvent>() {
                   @Override
                   public void handle(DragEvent event) {
                        System.err.println(event.toString());
                        Dragboard db = event.getDragboard();
                        if (db.hasString()) {
                             event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
                        event.consume();
              webView.setOnDragDropped(new EventHandler<DragEvent>() {
                   @Override
                   public void handle(DragEvent event) {
                        System.err.println(event.toString());          
                        Dragboard db = event.getDragboard();
                        boolean success = false;
                        if (db.hasString()) {
                             System.out.println("Dropped: " + db.getString());
                             success = true;
                        event.setDropCompleted(success);
                        event.consume();
              Scene scene = new Scene(webView, 800, 650, Color.BLACK);
              scene.setFill(Color.BLACK);
              fxPanel.setScene(scene);
         public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                   @Override
                   public void run() {
                        new WebViewInJFXPanel().initAndShowGUI();
    }

  • OO and webview Questions

    Hello,
    i have two questions ;
    1- how can i know the the starting date of hestorical Data that stored in AW webview,and how can i change that date ,is it refering to the size of drive allocated for that or what exactly ?
    2- in Outbound dialer: is there a way to flush the dialing list, some times the client calls me to delet the dialing list because of inserting some contacts by mistake ?
    usually, i go to Query rule and click on 'update dialing list ' to overwrite the exist list, is that the only way or there another ?
    regards and thanks

    If they want you to purge a campaign completely then the easiest option is to probably just change the import rule to overwrite and load in a dummy file to overwrite all the records.
    If you need to delete individual records then it gets a little trickier. You would have to jump into the instance_baA database and delete the relevant records from the dialing list tables (in the format: DL_CampaignID_QueryRuleID). Once that has been done it would be a good idea to probably restart CampaignManager as well.
    Cheers,
    Nathan

  • URGENT HELP NEEDED ... Tomcat Realm and JRE1.4 plug-in problem

    I have tried the Security Realm of Tomcat. Since I do not have
    an LDAP server, I decided to use the Tomcat-users.xml file in
    Tomcat\conf directory.
    I added the following lines of code in the web.xml file.
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Entire Application</web-resource-name>
    <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <!-- NOTE: This role is not present in the default users file -->
    <role-name>webviewer</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Tomcat Manager Application</realm-name>
    </login-config>
    The <role-name> "webviewer" is added into "Tomcat-Users.xml" as the following:
    <tomcat-users>
    <user name="test" password="password" roles="webviewer" />
    </tomcat-users>
    So, now when we type the url: http://localhost:8080/adbpdbre/default.htm, TOMCAT shows a dialog box asking for UserName: and Password:Now, only when we give the username and password, it shows the page. This is exactly what we want.
    But the problem now is, this default.htm page, has 5 links to 5 applets. The first time that I click on one of these links, the JRE plug of 1.4 shows a dialog again asking for the username and password. Till I dont provide the username and password the system doesnt go ahead and applet doesnt load. I do not want the JRE to ask me for the username/passwords again..How to avoid this ?
    Can you give me some more information on this. Ultimately in the production usage, we will be using LDAP and not Tomcat's memory realm.
    URGENT HELP NEEDED ... I need to get back to my client on this.
    Help would be v. much appreciated.

    In the config file, you 're essentially saying that you want Tomcat to prompt for usr/passw on every request (url-pattern = /*) made by a 'webviewer', and that's exactly what Tomcat is doing.
    Consider using specific url-patterns & roles for resources to be protected. If for now, all you need is to protect the first page, use a more specific url-pattern.
    Just an advice : if you'll be using LDAP in production, do not waste time with Tomcat's Security Realm and the BASIC authentication type, since the two have not much in common. Start reading doc on LDAP, and code a prototype, or even better, a vertical slice of the app (i.e a proof of concept).

  • Tree in Visual Composer WebView

    Hi All,
    Is it possible to create a tree in VC Webview? I know this can be done in VC in NWDS. However, I believe this is not possible in the webview since I have not seen any integration with webdynpro components in webview. I am forced to use webview since I have to work on some BI data sources.
    Thanks and regards,
    Ritesh

    Hi Kirun,
    Thanks for your reply.
    I am using the Webview of Visual composer and not using the integrated feature of VC in NWDS. I am using the webview since some of the BI data sources that I am using is available only in webview and not in the NWDS integrated VC.
    In Webview, I do not see any feature wherein I can build a tree. Can you please help?
    Thanks and regards,
    Ritesh

  • How do i make WebView automatically load when using TakeStringURLFrom??

    I haven't added any code yet. I've WebKit, a Webview and a editable textbox where it takes the URL from. Normally it would require you to hit enter, but i would like it to just load it automatically. How do i do this? Please explain EXACTLY how! I would also like to know how instead of it using scrollers, i can make it just do like if you play a windowed game, u know, so u can still see it all. Also i would like to know how u make it stretch out when it enters fullscreen, please.

    Open Accounts preferences, click on the Login Items tab. Select entries and press Delete [-] to remove. Click on the Add [+] button to place an application into the list.
    Note that the more items in the list you load at startup the slower your startup time will be.

  • Browsers not loading Webview properly

    Hello all,
    I can connect to Webview and login just fine, but the home page isn't loading right. When loading, the graphics don't load all the way and in the middle somewhere is a scroll window that flashes for a brief second then disappears, maybe I can show a picture:
    Browser picture
    and here is the home page code:
    Home page codeMessage Edited by kb0iic on 01-02-200708:17 AM

    Linksys have advised that they have not fully tested these products on Mac's and that it is a Java issue. Linksys also provide very limited support for Mac.
    I have other Linksys products and they do work.
    I suspect that it is just this version of webview and that greater testing is required of the java script across all platforms not just windows.
    I would like to think that I will be able to make this work on os X and have to buy windows to do so.

  • Is html5 dnd really supported in WebView?

    Hi,
    While testing dnd support in WebView, I faced a strange behavior regarding the transferable data retrieved.
    The data is always "*undefined*" in WebView, and is correct under other browsers...
    Any idea? Workaround?
    Thanks.
    Simply load the following HTML page into WebEngine.
    Try to drag the top rectangle into the second one.
    Note: Due to syntax highlighting in this forum the complete HTML code does not appear! The following attributes are missing on first and second div. Sorry.
    ondragstart="startDrag(event)
    ondrop="drop(event)" ondragover="canDrop(event)
    <!DOCTYPE HTML>
    <html>
         <head>
         <style type="text/css">
              #drop1 {width:350px;height:70px;padding:10px;border:1px solid #aaaaaa;}
              #startDrag1 {width:350px;height:70px;padding:10px;border:1px solid #000000;}
         </style>
         <script>
         function canDrop(ev)
              ev.preventDefault();
         function startDrag(ev)
              ev.dataTransfer.setData("Text",ev.target.id);
         function drop(ev)
              ev.preventDefault();
              var data=ev.dataTransfer.getData("Text");
              var result=document.getElementById("result");
              // Display result in Div and alert
              result.innerHTML=data;
              alert(data);
         </script>
    </head>
    <body>
         <p>Drag the top rectangle into the second:</p>
         <div style="color:#FFFF00;border: 2px dotted  black;" id="startDrag1" ondragstart="startDrag(event)"></div>
         <br/>
         <div style="color:#00FFFF;border: 3px dashed black;" id="drop1" ondrop="drop(event)" ondragover="canDrop(event)">
           <output id="result"></output>
         </div>
         <br>
    </body>
    </html>

    I played around with this a little bit using your example and the behaviour of JavaFX seemed buggy to me.
    If I set the data type to Text, I could reproduce the undefined message in the drop box. I thought maybe it just wasn't looking up the event target id ok, so I changed to set the text to a static string, and the behaviour was still the same (still printed undefined in the drop box). I thought I'd try a well defined data type of text/plain rather than Text, and then I didn't get undefined in the drop box, but I didn't get the text displayed there either, just nothing at all. Additionally the drag initiation seemed buggy and only worked for me sometime all of the time I was trying it. For instance, a lot of the time rather than the drag cursor, I'd end up with a selection being done or a text insert caret which prevented the use of of the drag and drop function as it seemed the drag and drop wasn't initialized. Only on the fifth or sixth attempt would a drag seem to be initiated. So I wouldn't really advise making use of html5 dnd in your app until you file some bugs on this at http://javafx-jira.kenai.com and they are fixed.
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.web.WebView;
    import javafx.stage.Stage;
    public class WebViewDragAndDrop extends Application {
      final static String html =
    "<!DOCTYPE HTML>\n"+
    "<html>\n"+
    "\t<head>\n"+
    "\t<style type=\"text/css\">\n"+
    "\t\t#drop1 {width:350px;height:70px;padding:10px;border:1px solid #aaaaaa;}\n"+
    "\t\t#startDrag1 {width:350px;height:70px;padding:10px;border:1px solid #000000;}\n"+
    "\t</style>\n"+
    "\t<script>\n"+
    "\tfunction canDrop(ev)\n"+
    "\t{\n"+
    "\t\tev.preventDefault();\n"+
    "\t}\n"+
    "\t\n"+
    "\tfunction startDrag(ev)\n"+
    "\t{\n"+
    "\t\tev.dataTransfer.setData('text/plain','xyzzy');\n"+
    "\t}\n"+
    "\t\n"+
    "\tfunction drop(ev)\n"+
    "\t{\n"+
    "\t\tev.preventDefault();\n"+
    "\t\tvar data=ev.dataTransfer.getData('text/plain');\n"+
    "\t\tvar result=document.getElementById(\"result\");\n"+
    "\t\t\n"+
    "\t\t// Display result in Div and alert\n"+
    "\t\tresult.innerHTML=data;\n"+
    "\t}\n"+
    "\t</script>\n"+
    "</head>\n"+
    "<body>\n"+
    " \n"+
    "\t<p>Drag the top rectangle into the second:</p>\n"+
    "\t\n"+
    "\t<div ondragstart='startDrag(event)' style=\"color:#FFFF00;border: 2px dotted  black;\" id=\"startDrag1\"></div>\n"+
    "\t<br/>\n"+
    "\t<div ondrop='drop(event)' ondragover='canDrop(event)' style=\"color:#00FFFF;border: 3px dashed black;\" id=\"drop1\">\n"+
    "\t  <output id=\"result\"></output>\n"+
    "\t</div>\n"+
    "\t\n"+
    "\t<br>\n"+
    " \n"+
    " \n"+
    "</body>\n"+
    "</html>"; 
      public static void main(String[] args) { launch(args); }
      @Override public void start(Stage stage) {
        WebView webview = new WebView();
        webview.getEngine().loadContent(html);
        stage.setScene(new Scene(webview, 750, 450));
        stage.show();
    }

Maybe you are looking for

  • Degree symbol not displayed properly in Safari 6

    I don't know whether this is a font/configuration issue or a bug. If I look at a certain web site, the degree symbol is displayed as a black diamond with a white "?" inside it in Safari 6. It displays properly on the same Mac using Chrome. It display

  • Concerns about Using Aperature

    My wife is a professional photographer. I provide her technical support. We use a competitive image database product today. We are both curious about Aperature. But, I have some concerns about how it will work for us. These concerns arise first from

  • Error in payment method

    When I change my credit card details in my iTunes account, I get an error saying "Your payment method was declined. Please enter a valid payment method information". Can anyone help.?

  • Crashes on launch, even with option key held down

    It crashes immediately whenever I launch. This happens even if I hold down the option key. I have version 23.0.1, which I believe is current. bp-98bc09af-ceea-4295-b10d-b2fe82130914

  • Increase screen size for SAPMV45A 8309

    Hi, I need to add additional fields in additional data B tab in sales order i.e. program SAPMV45A screen 8309. but the screen has already occupied 20 Lines/80 columns. when i increase the size of the screen to 25 & activate it's not getting completel