May 16, 2008

Pages


Search Site


Topics


Useful Links

Blogs I Read


Archives

Entries Tagged as 'Hessian'

My Google Code Site

March 12 2008 by Andrew Powell
After talking to Ben Stucki at 360|Flex, I decided that I should create a Google Code site for my code samples and preso posts. I am currently in the process of moving all my os code and preso samples into this repository for public consumption. Going forward, you will be able to find all my code samples there. It is released under the MIT License, which basically means, it's released "as is" and without warranty. Some things will be posted and never updated again. Other things will be updated and improved. There is no set schedule for projects to be updated, it's just a central point for you to find my code samples. My Google Code Site

Posted in Java | ColdFusion | Flex | Caching | General | Conferences | BlazeDS | Spry | JMS | ColdSpring | StockQuoter | Google | Spring | Adobe | Universal Mind | Hibernate | Air | Hessian | XML | Speaking | 0 comments

360Flex - Building Java Powered Flex Applications - Code

February 25 2008 by Andrew Powell
I had a good turnout today at my session - Building Java Powered Flex Apps. In retrospect, I really should have called it "Building BlazeDS Powered Flex Apps because I pretty much covered implementation of all of Blaze's functionality. Anyway, I promised people I would have the code up tonight, so here it is: The Code (Right Click and save) Tomorrow is a session on community open source projects (Flexlib, OpenFlux, Merapi, etc). Come on by and enjoy some open source goodness.

Posted in Java | Flex | General | Conferences | BlazeDS | Eclipse | JMS | Spring | Adobe | Universal Mind | Hibernate | Air | Hessian | Speaking | 0 comments

Hessian vs. BlazeDS: Caveat

February 01 2008 by Andrew Powell
When we talk about remoting with Hessian vs. remoting with BlazeDS, keep in mind, we are not comparing Hessian to the whole of BlazeDS, simply the Java remoting piece of the pie. The size of an application using BlazeDS will always be bigger than an application simply using Hessian because the dependencies for the other parts of BlazeDS (Messaging, etc) are much larger than the remoting piece alone.

Posted in Java | Flex | General | BlazeDS | JMS | Adobe | Universal Mind | Air | Hessian | 0 comments

Hessian: Flex Remoting Without AMF

January 30 2008 by Andrew Powell
For a while now, there has been a versatile remoting solution for Java applications called Hessian. It actually allows for binary transmission of data (much like AMF) between any of the following languages: Java, Flash/Flex, Python, C++, C#, D, Erlang, PHP, & Ruby. Pretty impressive, huh? Hessian is also much more lightweight than using BlazeDS for Java remoting. It is a bit trickier to setup though. Let's start with the servlet config: <web-app id="">
<!-- Configure the HelloWorld implementation -->
<servlet servlet-name="hello"
servlet-class="com.universalmind.helloWorld.HelloWorld"/>

<servlet-mapping url-pattern="/hello/*" servlet-name="hello"/>
</web-app>
This pushes any request coming to http://${servername}/${contextroot}/hello to our Hessian Service, defined here as: package com.universalmind.helloWorld;

import com.caucho.hessian.server.HessianServlet;

public class HelloWorld extends HessianServlet implements IHelloWorld {

   private static final long serialVersionUID = 1L;

   public String hello(String who) {
      if(who != null){
         return "Hello, " + who + "!";
      }
      else{
         return "Hello, nobody!";
      }
   }

}
Note: Notice that this extends HessianServlet. That's how simple the server-side is. With AMF, you have a simple destination to define in the remoting-config.xml file. Hessian remoting actually requires you to create a servlet definition in the web.xml file. The client (Flex) code is actually much simpler and straightforward: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:word="*">

<hessian:HessianService xmlns:hessian="hessian.mxml.*" id="service" destination="hello"/>

<mx:Panel title="Caucho Hessian Hello World"
      paddingTop="10"
      paddingBottom="10"
      paddingLeft="10"
      paddingRight="10">


<mx:HBox>
<mx:Label text='Whom do you want to say "Hello" to?'/>

<mx:TextInput id="who"
         maxChars="20"
         enter="service.hello.send(who.text)"/>


<mx:Button label="Say Hello" click="service.hello.send(who.text)"/>
</mx:HBox>

<mx:Label text='The server said: "{service.hello.lastResult}"'/>

</mx:Panel>
</mx:Application>
We define our service, and the destination (the servlet defined earlier). So all requests will go to: http://${servername}/${contextroot}/hello, the servlet defined in web.xml. Unlike BlazeDS, Hessian allows you to use not just Flex/AIR as your remoting client. It allows you to create one remoting solution for a variety of clients. If your app will have Swing, .Net, and Flex clients, then Hessian is something you should definitely look into. Compile Note: For this to work, you must make sure you include the SWC for Hessian remoting on the Flex side and the JAR for the server-side. Both are available at http://hessian.caucho.com. Deployment Note: A sample war file is attached to this post. It can be exploded using the "jar -xvf Hessian.war" command. The war contains all the source code needed to figure this out for yourself, and is ready to deploy to your application server to see Hessian in action.

Posted in Java | Flex | General | BlazeDS | Universal Mind | Air | Hessian | 5 comments