Activate your free membership today | Log-in

Monday, January 5th, 2009

Special Offer for Ajaxian Readers: TheServerSide Java Symposium

Category: Conferences, Java

Hello Ajaxians!

We’re inviting all of the Java developers out there to an event organized by our sister site, TheServerSide.com, the Web’s largest enterprise Java community. As a member of Ajaxian, you save an extra $100 off the registration fee with the code AJAXIAN. (Register before January 16 to save a total of $400 and get a free book!)

TheServerSide Java Symposium explores current and emerging trends in enterprise Java and how they apply to your daily work. Choose from over 45 technical sessions on new technologies, best practices and practical tips from some of the brightest minds in the industry, including Rod Johnson, Neal Ford, Scott Davis and 35 Java experts.

Tracks include Frameworks, Architecture, SOA, Language, Tools and Techniques.

Project and spec leads dive into:

  • The latest features of Spring, JSF, Wicket, Tapestry, Google Web Toolkit and more frameworks.
  • New Java language features, such as EJB 3.1, Glassfish and JavaFX
  • Popular open source tools, including Eclipse, Maven, Lucene, soapUI, HtmlUnit for testing SOA, Ajax and RIAs.
  • Expert recommendations on the use of Groovy, Scala and JRuby
  • Building and maintaining a large-scale SOA
  • How to create and consume RESTful Web Services.
  • How and when to use an ESB.
  • Best practices and tools for optimizing performance and scalability.
  • And much more!

View TheServerSide Java Symposium agenda to see all of the sessions being presented. Register now with the code AJAXIAN to save an extra $100 and to get a free book while supplies last.

Posted by tberardi at 3:46 pm
Comment here

+++--
3.4 rating from 8 votes

Friday, December 19th, 2008

DWR 3.0 near final release with RC

Category: Java, JavaScript, Library

Joe Walker and team have announced the first RC for DWR 3.0. We asked Joe to tell us what is new:

DWR now supports:

  • varargs
  • method overloading
  • typed parameters
  • binary file upload/download
  • it has a set of new types it can marshall

DWR will let you use JavaScript to implement Java interfaces (e.g. to register a Listener interface to publish changes to waiting browsers using Reverse Ajax), we now have 3 modes to control resource usage and there is a more scalable Reverse Ajax layer.

There are new integrations with Dojo, TIBCO GI and Aptana Jaxer, and a new DOM manipulation library.

We have special asynchronous servlet support for Tomcat and Glassfish, and our Spring and Guice integrations have been beefed up.

We now support JSONP and JSON-RPC, and there’s a whole bunch of etc thrown in for good measure too.

There is a more complete list at Joe’s blog, or you can just skip straight to the download page.

Posted by Dion Almaer at 6:02 am
Comment here

++++-
4.5 rating from 17 votes

Wednesday, December 17th, 2008

OilCan: Grease up your Android browser

Category: Java, JavaScript, Mobile

Jeffrey Sharkey has created OilCan a thin wrapper on top of the WebKit shipping on Android that allows you to install userscripts that allow you to access to Android "Intents".

Intents are very nice abstractions that allow you to access large components and reuse them in different ways. Romain Guy has a nice post on them.

OilCan lets you customize any website by inserting JavaScript to change the website and help it reach into the Android world using intents.

OilCan inserts some powerful buttons into normal websites, and that power comes from Android intents. We didn't write a barcode scanner or the radar app into OilCan, but using intents we can launch those apps with parameters. We can request the Barcode Scanner app to scan something and return the code to us, or launch the Radar app with a specific lat/lon.

Userscripts can do other cool stuff, like hide the navigation columns in Wikipedia to make it easier to view on small screens. This is a proof-of-concept for now, and will probably turn into a binary plugin for the default Browser in the future.

A nice piece from an example shows the intent call out:

JAVASCRIPT:
  1.  
  2. function generate(item) { 
  3.     var helper = document.createElement('input')
  4.     helper.type = 'button'
  5.     helper.value = 'Scan barcode...'
  6.     helper.addEventListener('click', function(event) { 
  7.         // use the intentHelper bridge to fire an intent to Barcode Scanner 
  8.         // it's available in Market, or from http://code.google.com/p/zxing/ 
  9.         var result = window.intentHelper.startActivityForResult(JSON.stringify({ 
  10.             action:'com.google.zxing.client.android.SCAN'
  11.             category:['CATEGORY_DEFAULT'] 
  12.         }))
  13.  
  14.         // parse the result we get back, and read the barcode from the extras 
  15.         result = JSON.parse(result)
  16.         item.value = result['extras']['SCAN_RESULT']
  17.     }, false)
  18.     return helper; 
  19. } 
  20.  

Very cool!

Posted by Dion Almaer at 6:13 am
2 Comments

++++-
4 rating from 5 votes

Tuesday, December 16th, 2008

Interfaces in JavaScript

Category: Java, JavaScript

The UML diagram above is from Matt Prokes as he creates Java-like interfaces for JavaScript.

He has a full example:

An example of an object which requires an implementation of the interface.

JAVASCRIPT:
  1.  
  2. //This code is valid, and the execution will be successful.
  3. function executeInterface1(executeThis){
  4.   var castedIface = executeThis.cast('TestInterface');
  5.   castedIface.testMethod1(1,2,3);
  6. }
  7.  
  8. //This code is valid, but the execution will not be successful.
  9. function executeInterface2(executeThis){
  10.   var castedIface = executeThis.cast('TestInterface');
  11.   castedIface.testMethod2(4,5,6);
  12. }
  13.  

Alright, lets instanciate, the objects and set them to variables. Feel free to type in the variables and take a look, on the firebug window!

JAVASCRIPT:
  1.  
  2. InitedTestObject = new TestObject();
  3. //variable not used in this example, but I thought I would still make it available!
  4. CastedTestInterface = InitedTestObject.cast('TestInterface');
  5.  

Ok, so lets try it out! We wrap it all up in some simple div tags with onclick events.

HTML:
  1.  
  2. onclick="executeInterface1(InitedTestObject)"
  3. onclick="executeInterface2(InitedTestObject)"
  4.  

Posted by Dion Almaer at 12:51 pm
9 Comments

+----
1.8 rating from 21 votes

Monday, December 1st, 2008

AbstractCanvas: HTML Canvas and Java2D in one fell swoop

Category: Canvas, GWT, Java

Rodrigo Reyes has announced a new project called AbstractCanvas, a GWT project that sits on top of HTML Canvas and Java2D.

The same code can thus run in the browser, or on the server.

You can then write code such as:

JAVA:
  1.  
  2.  VerticalPanel vPanel = new VerticalPanel();
  3.  
  4.  CanvasPanelExt canvas1 = new CanvasPanelExt(300,150);
  5.  
  6.  canvas1.setFillStyle(Color.WHITE);
  7.  canvas1.setGlobalAlpha(1.0);
  8.  canvas1.fillRect(0, 0, canvas1.getCoordWidth(), canvas1.getCoordHeight());
  9.        
  10.  canvas1.addCanvasPainter(new ColorTest()); // <- Note the use of CanvasPainter here
  11.  canvas1.addCanvasPainter(new PathTest());     <- and here
  12.  
  13.  vPanel.add(canvas1);
  14.  

Posted by Dion Almaer at 7:09 am
Comment here

+++--
3.8 rating from 13 votes

Friday, October 17th, 2008

Java Plugin 6 Update 10 Production Release

Category: Java

It really is plugin week isn't it. We had Flash and Silverlight, so it was time for Java to pop its head up from the shadows, and that is what happened with the production release of Java 6 Update 10. It has to be one of the worst version names, but a solid plugin release it is! We originally sat down with Ken Russell to talk about this version on October 18th, 2007.

Cote has some nice coverage via his interview with Danny Coward:

When I was in his neck of the woods last, I got the chance to talk with Sun’s Danny Coward, the Chief Architect of Sun’s Client Software (that is, Java SE, Java ME, JavaFX and JavaCard), about Java 6 Update 10. That seems like kind of a narrow topic to speak to, but as Danny and I discuss, it’s a big release for Sun’s RIA and client-side (re-)push.

Along those lines, we spend a lot of time detailing the re-written plugin that’s used for Java applets and JavaFX, the improved installer and update experience, and other client side features like one of the new GUI look-n-feels, Nimbus.

Update 10 is available now.

I have to admit to not "getting" JavaFX, but the Java plugin features are great to see, and it is nice to see the final release.

Posted by Dion Almaer at 12:01 am
5 Comments

++++-
4 rating from 36 votes

Friday, August 29th, 2008

GWT 1.5 final release is shipped and out the door

Category: GWT, Google, Java, Library

I have seen the GWT team working very hard indeed on GWT 1.5, and they must be very happy to see the final release shipped and complete:

GWT 1.5 delivers what we think are an impressive number of improvements, about four hundred issues if you're counting. We're also happy that one of those is issue 168, our most-requested feature, Support for Java 5.

The high level new feature sets are:

  • Java 5 language support and enhanced JRE emulation
  • Performance optimizations and easier JavaScript interop
  • Prettier widgets, better DOM, accessibility, and bi-di

You can see a lot of this at work in the showcase area. There you will see all of the widgets and examples that come out of the box, and the community has developed even more for you. In particular, Ray Cromwell has some great real world examples that he shares in his book and talk.

Download GWT and take a look.

Posted by Dion Almaer at 10:51 am
2 Comments

++++-
4 rating from 25 votes

Monday, August 25th, 2008

Putting together GWT and Spring

Category: Java

Dave Kuhn has put together a comprehensive guide to piecing together GWT and Spring, a nice recipe for the Java heads among you.

Dave starts out by detailing why you would want to do this, and how it changes the architecture of your application.

He then gets to a tutorial that has you creating the project correctly, and configuring an actual service. Once you are done with the code, you need to setup hosted mode to point to a nice external tom cat via:

-out www GwtWisdom/GwtWisdom.html
-noserver
-port 8080

Posted by Dion Almaer at 7:51 am
1 Comment

++++-
4.1 rating from 21 votes

Wednesday, July 2nd, 2008

Loom: Annotation based Java framework

Category: Framework, Java

Ignacio Coloma has announced Loom 1.0 RC 1. Loom is an annotation-based java web framework that includes a ton of new features in this release. After some selective process, these are the bits that could be of most interest for Ajax developers:

  • Generates HTML 5 markup (with data-* fields), including CSS classes
    with the property type.
  • Based on prototype
  • An ever-growing list of (progressive-enhancement) web components,
    including: multiple file upload, tabs, menus...
  • Dead-simple javascript validation library with i18n support.
  • ...which mimics the process at the server, in case javascript is disabled.

Just give it a try at the demo. Try introducing invalid input, and check the sources by clicking the "View source" link at the top right of the page. Everything in the demo should work with javascript disabled, including multiple file upload.

The framework also includes a libraries repository which pulls debug/optimized javascript from the google CDN:

HTML:
  1.  
  2. <l :script resource="prototype"/>
  3. <l :script resource="scriptaculous">
  4.  <l :param name="load" value="builder,effects"/>
  5. </l>
  6.  

This snippet of code would translate into this, if development is disabled:

HTML:
  1.  
  2. <script type="text/javascript"
  3. src="//ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js">
  4. </script>
  5. <script type="text/javascript"
  6. src="//ajax.googleapis.com/ajax/libs/scriptaculous/1.8.1/scriptaculous.js?load=builder,effects">
  7. </script>
  8.  

Or this if not:

HTML:
  1.  
  2. <script src="/js/prototype-1.6.0/prototype-1.6.0.2-shrinkvars.js"
  3. type="text/javascript"></script>
  4. <script type="text/javascript"
  5. src="//ajax.googleapis.com/ajax/libs/scriptaculous/1.8.1/scriptaculous.js?load=builder,effects">
  6. </script>
  7.  

More details about the framework are at the reference guide. Ignacio would be grateful for any feedback!

Posted by Dion Almaer at 10:28 am
1 Comment

+++--
3.8 rating from 16 votes

Friday, June 13th, 2008

Pivot: Swing++ as New Java-based RIA Platform?

Category: Java, UI

And now for something a little bit different on a Friday. Greg Brown from VMWare pointed us to the fruition of nearly a year's worth of R&D: Pivot, a new GUI toolkit for Java.

While traditionally Java Applets and the Web have mixed together about as well as concrete and peanut butter, the upcoming revised Java plug-in might give a window for Java-based GUI toolkits to be of interest to Web folks.

While Pivot's source code is still forthcoming, a quick glance at its classes shows an architecture with a strong resemblance to Java's built-in Swing GUI toolkit, but with many of Swing's rough edges smoothed out. As a long-time Swing developer, I'd characterize it as attempt to create Swing++.

Similarities to Swing include a light-weight rendering model (i.e., it doesn't wrap native components), a nearly identical component contract, a very similar system of UI delegates, and a very similar event model. Differences include a cleaner API (by virtue of nixing direct interoperability with Java's ancient AWT toolkit), different approach to layout, fresh implementations of common GUI components, and a new collections framework (inspired by Java's collections framework but... different).

Thinlet is another, older alternate GUI toolkit for Java that draws its own components and targets Applet developers (though a new version is under development).

Posted by Ben Galbraith at 7:05 am
9 Comments

+++--
3.8 rating from 28 votes

Tuesday, June 3rd, 2008

crossdomain.xml, Java, and JNLP

Category: Java

Joshua Marinacci has detailed how Java SE 6 update 10 supports the same crossdomain.xml that Flash supports, and how you can marry it with JNLP to allow you to do Applet mashups without permission dialogs.

The applet security model, known as the sandbox, only lets applets connect to the webserver they were loaded from. They cannot connect to anywhere else unless they are signed. Signing is great when you need access to more than what is allowed inside the sandbox, but it has two problems: the user will receive an ugly warning dialog about the applet, and the applet will have full access to the user's computer. Full access is overkill when all you want to do is talk to a webservice on another server. Surely there is some middle ground between the sandbox and full access? Well now there is.

The key is supplying a backwards compatible way of tying to the new JNLP version:

HTML:
  1.  
  2.     <applet code="photostrip.Applet"
  3.             archive="http://projects.joshy.org/demos/PhotoStrip/webstart/PhotoStrip.jar"
  4.             width="400" height="200"
  5.            >
  6.         <param name="jnlp_href" value="http://projects.joshy.org/demos/PhotoStrip/photostrip.jnlp">
  7.         <param name="flickruser" value="31706743@N00"/>
  8.         <param name="size" value="100"/>
  9.         <param name="cols" value="4"/>
  10.         <param name="rows" value="2"/>
  11.     </param></applet>
  12.  

Now the JNLP file points to the the unsigned jar:

XML:
  1.  
  2. <jnlp spec="1.0+" codebase="" href="">
  3.     <information>
  4.         <title>PhotoStrip</title>
  5.         <vendor>Joshua Marinacci</vendor>
  6.         <offline -allowed />
  7.     </information>
  8.     <resources>
  9.         <j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se" />
  10.         <jar href="unsigned/PhotoStrip.jar" main="true" />
  11.         <!-- Application Resources -->
  12.     </resources>
  13.   <applet -desc
  14.       name="PhotoStrip"
  15.       main-class="photostrip.Applet"
  16.       width="400"
  17.       height="200">
  18.   </applet>
  19. </jnlp>
  20.  

Note: you should be aware of security issues with open cross domain files.

Posted by Dion Almaer at 8:19 am
2 Comments

++---
2.7 rating from 10 votes

Tuesday, May 27th, 2008

SoundManager 2 Updates: Speed and Demos

Category: Java, Sound

SoundManager 2 update</