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
    finally {

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 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