Friday, November 28, 2008

Blazeds Configuration under Http and Https

1. visitor --> Flex app on Apache/IIS (Https) --> Backend system on Tomcat/JBoss(Http)
service-config.xml:
<channel-definition 
id="my-amf-secure"
class="mx.messaging.channels.SecureAMFChannel">
<endpoint
uri="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure"
class="flex.messaging.endpoints.AMFEndpoint "/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>


2. visitor --> Flex app on Apache/IIS (Http) --> Backend system on Tomcat/JBoss(Https)
service-config.xml:
<channel-definition 
id="my-amf"
class="mx.messaging.channels.SecureAMFChannel">
<endpoint
uri="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure"
class="flex.messaging.endpoints.SecureAMFEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>

Tuesday, November 25, 2008

Bind Java Object to Flex Object

To represent a server-side Java object in a client application, you use the [RemoteClass(alias=" ")] metadata tag to create an ActionScript object that maps directly to the Java object. You specify the fully qualified class name of the Java class as the value of alias. This is the same technique that you use to map to Java objects when using RemoteObject components.

You can use the [RemoteClass] metadata tag without an alias if you do not map to a Java object on the server, but you do send back your object type from the server. Your ActionScript object is serialized to a Map object when it is sent to the server, but the object returned from the server to the clients is your original ActionScript type.

1. write a bindable class and attach the [RemoteClass] tag.
2. use this class in your main flex code.

sample code:
blazeds-rc-server-tutorial.rar and blazeds-rc-client-tutorial.rar , enjoy it.

Monday, November 17, 2008

Integrated BlazeDS with Spring Framework

Spring is one of the most popular Java frameworks. The foundation of the Spring framework is a lightweight component container that implements the Inversion of Control (IoC) pattern.
Using an IoC container, components don't instantiate or even look up their dependencies (the objects they work with). The container is responsible for injecting those dependencies when it creates the components (hence the term "Dependency Injection" also used to describe this pattern).
The result is looser coupling between components. The Spring IoC container has proven to be a solid foundation for building robust enterprise applications. The components managed by the Spring IoC container are called Spring beans.

step by step:

1. Follow this article to create a basic blazeds-based java project.
2. Download spring framework and put the spring.jar into the blazeds-based java project.
3. Download flex-spring.zip and unzip it and put the SpringFactory.java to your source code folder. don't fotget to adjust the package name according to your package path.
4. Register the Spring factory on your services-config.xml.
5. Create applicationContext.xml in /WEB-INF and register Spring beans.
6. Update your remoting-config.xml.
7. Update your web.xml.
8. Create your flex app and new remoteObject to call java module.

For another new way to integrate spring to blazeds, pls go to Using Spring BlazeDS Integration 1.0.0.M1 .

sample code:
blazeds-spring-server-tutorial.rar and blazeds-spring-client-tutorial.rar , enjoy it.

Sunday, November 9, 2008

Build a Java-Flex Application Based on BlazeDS

BlazeDS is the server-based Java remoting and web messaging technology that enables developers to easily connect to back-end distributed data and push data in real-time to Adobe® Flex® and Adobe AIR™ applications for more responsive rich Internet application (RIA) experiences.

Follow these steps to get started with BlazeDS:

1. Ensure any necessary software and configuration item work properly on your computer. For instance, jdk, a java application server( tomcat, jboss, weblogic... ) that BlazeDS support.
2. Download and save BlazeDS to your computer.
3. Create a new web-project in eclipse.
3. Unzip balzeds.war, and copy folder /WEB-INF to your /WEB-INF folder.
4. Create a balzeds remote call interface file, I create and name it WeatherService.
5. Edit remoteing-config.xml, add your destination item.
6. Create your flex application, and new a remoteObject to call java function above.

sample code:
blazeds-client-tutorial.rar and blazeds-server-tutorial.rar , enjoy it.