Skip to main content

That's How You Know

Posted by editor on February 18, 2009 at 8:25 AM PST


Figuring out web services with JavaFX's I/O and data packages

OK, OK, lots of the JavaFX stuff out there has been about graphics and tooling, to say nothing of improvements to the underlying SE platform to improve deployment and graphics performance. But it's a safe bet that many of these JavaFX applications are going to have some sort of network presence: there are only so many self-contained apps you can write (calculators and reversi games, anyone?) before you're going to want to make your app a client to some kind of network service.

So how do you do this in the context of JavaFX. Of course, since you can call Java from JavaFX, there's always the option of going with the frameworks you've used before. But they don't necessarily suit the declarative nature of JavaFX code. As it turns out, JavaFX includes its own HTTP and XML parsing packages, and they suit JavaFX's event-driven programming idioms nicely. Here's an interesting snippet of parsing XML coming off an HTTP connection:

  onInput: function(is: InputStream) {
    try {             
      PullParser {
        input: is;
        onEvent: function (event : Event) {                    
                  // We handle the event
                }
          }.parse();
    }
    finally {
      is.close();
    }  
  }    

From a Java point-of-view, that's probably completely alien, but take a step back and consider how concise this is: when you get data (onInput) on an input stream, throw it to an XML parser and get callbacks on parsing events. Maybe a little interesting as a new way to think about common client-side tasks?

Well, this block of code is from today's Feature Article, in which Francesco Azzola introduces
JavaFX HTTP Networking and XML Parsing. In it, he walks through a basic example of reading data from an HTTP connection, parsing XML data, and the very common task of doing the two together. Combined, these tasks are the building blocks of all web service clients, and it's nice to see JavaFX offering an approach that suits its programming concepts and styles.


You've probably heard that JSR 292's support for dynamic languages proposes add a new Java bytecode, invokedynamic. But what does that mean, how does it work, and what good is it? In Java Today, John Rose offers an overview in the blog Simple Java Linkage: An invokedynamic Apértif. "For today, here is a light aperitif showing how invokedynamic could be used to simulate the other invocation instructions. This of course is relatively useless as-is, but it is an apt demonstration that invokedynamic can be used as a building block for more complicated call sites that include the standard JVM invocation behaviors as special cases. (Caution: This blog post is for people who enjoy their bytecodes full strength and without mixers.)"

"Quality is indisputably the number-one requirement for any product or service. It's been rightly said that when you're out of quality, you're out of business. Superior quality, however, is never an accident and achieving it takes the concerted efforts of creative, competent, and dedicated professionals in both the development and testing arenas." In Perspectives on Quality Assurance for OpenDS, Gary Williams, lead test engineer for OpenDS shares ideas and experiences with testing open-source software, and OpenDS in particular.

Former java.net blogger Chet Haase offers a Java-tinted introduction to Flash and Flex's programming language in ActionScript for Java developers, Part 1. "So while I'm not a language expert [...] I thought that it would be useful to take a step back from both languages and compare them from this programmer's point of view. I'll compare various aspects of the languages to see what ActionScript 3 looks like to a Java developer. In so doing, I hope to help you avoid some of the pitfalls and misconceptions I encountered in my own migration to the Flex SDK."


In today's Weblogs, James Gosling reports that he's
At TechDays in Hyderabad. "I'll be spending this week at Tech Days in Hyderabad. It'll be a grand geekfest with lots of educational sessions. If you're anywhere near by, come join in. It promises to be a lot of fun."

John O'Conner complains that
NetBeans 6.5 still coughs on spaces. "I've praised NetBeans 6.5 enough that my colleagues would probably adopt it as their IDE, but NetBeans still won't make it easy for us."

Finally, in Introducing Sun GlassFishâ„¢ Mobiliity Platform v1.1, Ryan Shoemaker writes, "I'm pleased to announce the general availability of the Sun GlassFishâ„¢ Mobility Platform v1.1 (SGMP). We've improved many things in this release (including the product name) which we will explore over the next several weeks."


In today's Forums, steven_reynolds explains Java versus JavaFX design philosophies in Re: scenario vs scenegraph and SG* vs FX*? "FX* take the philosophy of wrapping a lot of functionality into a single class. These are easier for the end user to program with. SG* take the philosophy of keeping the Single Responsibilty Principle (SRP). Each class or node does only a single thing. These are easier to extend, but more verbose for the end user to program with. The SG* and FX* play nice with each other, so you can mix and match. If you want more background, you can look at my slides http://www.int.com/presentations/scenegraph."

Speaking of JavaFX, brandonroubi would like to
Call javafx function from javascript. "I look for an example of communication between javascript and javafx. How to call javafx function from javascript ? I find the follow package com.sun.javafx.runtime.liveconnect, but I don't know how to use it."

Platform hacks concern davyp in
Re: MIDP on WindowsCE 4.2 core. "The binaries you downloaded probably contained the old hacks where I swapped the two 4-byte words of each double and that for each function. While I found how to solve the issue, I still had to recompile the CLDC and MIDP sources for the various platforms. So the new binaries with the generic fix were only available on my website from this morning on around 11:30 CET (or 10:30 GMT). The nice thing with this fix is that it immediately solves some issues I had with JSR 226 (SVG support) on WinCE where certain SVG animations did not work correctly."

bbk explains BD-J timer services and their limitations and difficulties in

Re: [BD-J-DEV] What thread does javax.tv.util.TVTimer run on? "Both issue would appear for you as soon as you will need to measure time interval very accurately and precise if you used java.util.Timer. But don't believe they shall automatically disappear when using TVTimer: while accuracy can be roughly approximated, keep in mind that events may happen later than expected since runtime environment is real-time. But I would also suggest to avoid using TVTimer unless you have a real need in it: it's using is quite complex."


Current and upcoming Java
Events
:

Registered users can submit event listings for the href="http://www.java.net/events">java.net Events Page using our href="http://today.java.net/cs/user/create/e">events submission form.
All submissions go through an editorial review before being posted to the
site.


Archives and Subscriptions: This blog is delivered weekdays as
the Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the href="http://today.java.net/today/archive/">java.net Archive.

Figuring out web services with JavaFX's I/O and data packages