integrate flex with spring framework

39
Integrate Flex with Spring Framework Albert Guo [email protected]

Upload: guo-albert

Post on 19-May-2015

5.666 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: Integrate Flex With Spring Framework

Integrate Flex with Spring Framework

Albert [email protected]

Page 2: Integrate Flex With Spring Framework

2

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

Agenda

Page 3: Integrate Flex With Spring Framework

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

Page 4: Integrate Flex With Spring Framework

Download BlazeDS

Page 5: Integrate Flex With Spring Framework

5

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

unzip file and extract BlazeDS.war

Download BlazeDS

Page 6: Integrate Flex With Spring Framework

6

BlazeDS role

Page 7: Integrate Flex With Spring Framework

7

The Architecture of a BlazeDS Server

Page 8: Integrate Flex With Spring Framework

Create a Dynamic Web Project

Page 9: Integrate Flex With Spring Framework

9

Create a Dynamic Web Project

Page 10: Integrate Flex With Spring Framework

10

Create a Dynamic Web Project – cont.

Assign project name, called flex-test-server

Click Next

Page 11: Integrate Flex With Spring Framework

11

Create a Dynamic Web Project – cont.

Assign context root, called “flex-test”

Click Finish

Page 12: Integrate Flex With Spring Framework

12

Create a Dynamic Web Project – cont.

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

Page 13: Integrate Flex With Spring Framework

13

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

Page 14: Integrate Flex With Spring Framework

14

Create a Dynamic Web Project – cont.

Assign the directory which extract from blazeds.war

Select the two directories

Click Finish

Page 15: Integrate Flex With Spring Framework

15

Create a Dynamic Web Project – cont.

Click “Yes To All”

Page 16: Integrate Flex With Spring Framework

16

Create a Dynamic Web Project – cont.

Configure endpont url in services-config.xml

Set defualt channel in services-config.xml

Page 17: Integrate Flex With Spring Framework

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

Page 18: Integrate Flex With Spring Framework

Integrate Flex with Spring Framework

Page 19: Integrate Flex With Spring Framework

19

Integrate Flex with Spring Framework

Create a spring folder which is under WEB-INF

Page 20: Integrate Flex With Spring Framework

20

Integrate Flex with Spring Framework – cont.

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

Page 21: Integrate Flex With Spring Framework

21

Integrate Flex with Spring Framework – cont.

Click HelloFlex class in exmaple package

Click FInsih

Page 22: Integrate Flex With Spring Framework

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

Page 23: Integrate Flex With Spring Framework

23

Integrate Flex with Spring Framework – cont.

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

Page 24: Integrate Flex With Spring Framework

24

Integrate Flex with Spring Framework – cont.

Define spring Dispather Servlet into web.xml

Define servet mapping into web.xml

Page 25: Integrate Flex With Spring Framework

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

Page 26: Integrate Flex With Spring Framework

Create a Flex Project

Page 27: Integrate Flex With Spring Framework

27

Create a Flex Project

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

Click Next

Page 28: Integrate Flex With Spring Framework

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

Page 29: Integrate Flex With Spring Framework

29

Create a Flex Project – cont.

Click Finish

Page 30: Integrate Flex With Spring Framework

30

Create a Flex Project – cont.

Page 31: Integrate Flex With Spring Framework

31

Create a Flex Project – cont.

Page 32: Integrate Flex With Spring Framework

32

Create a Flex Project – cont.

Add one more method in HelloFlex class

Page 33: Integrate Flex With Spring Framework

33

Create a Flex Project – cont.

Add one more button in mxml file

Page 34: Integrate Flex With Spring Framework

34

Create a Flex Project – cont.

Page 35: Integrate Flex With Spring Framework

35

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

Page 36: Integrate Flex With Spring Framework

36

Create a Flex Project – cont.

Register service bean into application-config.xml

Page 37: Integrate Flex With Spring Framework

37

Create a Flex Project – cont.

Page 38: Integrate Flex With Spring Framework

38

Create a Flex Project – cont.

Page 39: Integrate Flex With Spring Framework

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