Integrate Flex With Spring Framework

Preview:

Citation preview

Integrate Flex with Spring Framework

Albert Guojunyuo@gmail.com

2

Pre-requisite Download BlazeDS Create a Dynamic Web Project Integrate Flex with Spring Framework Create a Flex Project Reference

Agenda

3

Eclipse3.4(J2EE Version):◦ http://www.eclipse.org/downloads/

Flex Builder3◦ http://www.adobe.com/cfusion/entitlement/index.cfm?e=flex3email&sdid=EOZPI

Tomcat 6◦ http://tomcat.apache.org/

BlazeDS◦ http://opensource.adobe.com/wiki/display/blazeds/BlazeDS/

Spring Framework◦ http://www.springsource.org/download

Spring BlazeDS Integration◦ http://www.springsource.org/spring-flex

ANTLR3.0◦ http://www.antlr.org/download.html

AOPAlliance◦ http://mirrors.ibiblio.org/pub/mirrors/maven2/aopalliance/aopalliance/1.0/

Jackson◦ http://snapshots.repository.codehaus.org/org/codehaus/jackson/jackson-core-lgpl/1.1.0/ ◦ http://snapshots.repository.codehaus.org/org/codehaus/jackson/jackson-mapper-lgpl/1.1.0-SN

APSHOT/

Pre-requisite

Download BlazeDS

5

download BlazeDS from http://opensource.adobe.com/wiki/display/blazeds/BlazeDS/

unzip file and extract BlazeDS.war

Download BlazeDS

6

BlazeDS role

7

The Architecture of a BlazeDS Server

Create a Dynamic Web Project

9

Create a Dynamic Web Project

10

Create a Dynamic Web Project – cont.

Assign project name, called flex-test-server

Click Next

11

Create a Dynamic Web Project – cont.

Assign context root, called “flex-test”

Click Finish

12

Create a Dynamic Web Project – cont.

You can see this project structure as you finished the project creation process

13

Create a Dynamic Web Project – cont.Import configuration files and jar files from BlazeDS.war

14

Create a Dynamic Web Project – cont.

Assign the directory which extract from blazeds.war

Select the two directories

Click Finish

15

Create a Dynamic Web Project – cont.

Click “Yes To All”

16

Create a Dynamic Web Project – cont.

Configure endpont url in services-config.xml

Set defualt channel in services-config.xml

17

Create a Dynamic Web Project – cont.Deploy and startup Tomcat server

Connect to http://localhost:8080/flex-test/messagebroker/amf, you will see a blank page if correct

Integrate Flex with Spring Framework

19

Integrate Flex with Spring Framework

Create a spring folder which is under WEB-INF

20

Integrate Flex with Spring Framework – cont.

Create application-config.xml in /WEB-INF/spring

21

Integrate Flex with Spring Framework – cont.

Click HelloFlex class in exmaple package

Click FInsih

22

Integrate Flex with Spring Framework – cont.

① Define a simple business method to say hello② Utizile annotation to define service name and remoting

destination channels③ Use @RemotingInculde or @RemotingExclude to define the

method can be access or not

You don’t need to define anything in remoting-config.xml

23

Integrate Flex with Spring Framework – cont.

① Define HelloFlex bean into application-config.xml② Define message borker into application-config.xml

24

Integrate Flex with Spring Framework – cont.

Define spring Dispather Servlet into web.xml

Define servet mapping into web.xml

25

Integrate Flex with Spring Framework – cont.

Connect to http://localhost:8080/flex-test/spring/messagebroker/amf, you will see a blank page if correct

Deploy and startup Tomcat server

Create a Flex Project

27

Create a Flex Project

Define a Flex Project name, which called “flex-test-client”

Click Next

28

Create a Flex Project – cont.

① Define root folder to flex-test-server/WebContent② Define root url③ Define context root④ Click Validate Configuration

Click Next

29

Create a Flex Project – cont.

Click Finish

30

Create a Flex Project – cont.

31

Create a Flex Project – cont.

32

Create a Flex Project – cont.

Add one more method in HelloFlex class

33

Create a Flex Project – cont.

Add one more button in mxml file

34

Create a Flex Project – cont.

35

Create a Flex Project – cont.Create a calculation service to provide add service

36

Create a Flex Project – cont.

Register service bean into application-config.xml

37

Create a Flex Project – cont.

38

Create a Flex Project – cont.

39

An Introduction to Spring BlazeDS Integration◦ http://ria.dzone.com/articles/introduction-spring-bl

azeds?page=0,0

Flex Spring整合◦ http://www.javaeye.com/topic/392836

Spring BlazeDS Integration Reference Guide ◦ http://static.springsource.org/spring-flex/docs/1.0.x

/reference/htmlsingle/spring-flex-reference.html

3.4. Exporting Beans for Remoting with @RemotingDestination◦ http://static.springsource.org/spring-flex/docs/1.0.x

/reference/html/ch03s04.html

Reference

Recommended