[Flex]Flex Builder 3와 LCDS 연결하기 (톰켓이용)
============== 톰켓 설정 ==================================================
1. 일단 톰켓에 context를 하나 추가한다.
톰켓의 server.xml에 아래와 같이 추가하고 ROOT폴더를 복사하여 폴더명을 WidgetDemo와 같이 변경
<Context docBase="D:projectWidgetDemo" path="/WidgetDemo" reloadable="true"/>
자세한 설정 방법은 아래를 참조
=>
잘 뜨는지 테스트 하고 .. http://localhost:9090/WidgetDemo/
2. 연결 테스트를 확인하기 위한 자바파일을 생성해 보자. 이클립스를 이용해도 좋고..
난 그냥 손으로 집적 파일하나를 만들었다.ㅋㅋ;;
소스 : D:projectWidgetDemoWEB-INFsrcHelloWorld.java
클래스 : D:projectWidgetDemoWEB-INFclassesHelloWorld.class
| public class HelloWorld { public String my_func() { return "Hello World!!"; } } |
====== LCDS 설정 ============================================================
3. lcds가 설치되어 있다면 설정된 폴더로 이동하여보자
4. 복사했으면 이제 설정을 좀 수정해야 한다.
먼저, D:projectWidgetDemoWEB-INFflexservices-config.xml
| <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel"> <endpoint url="http://localhost:9090/WidgetDemo/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/> <properties> <polling-enabled>false</polling-enabled> </properties> </channel-definition> |
channel-definition 을 새로 추가해도 상관없지만 기존에 있는 my-amf의 정보를 그대로 이용하겠다. 이것을 나의 설정에 맞게 endpoint의 url 정보만 수정했다. => http://localhost:9090/WidgetDemo
그리거, D:projectWidgetDemoWEB-INFflexremoting-config.xml 파일의 수정
| <destination id="HelloRO" adapter="java-object"> <properties> <source>HelloWorld</source> </properties> </destination> |
> <source>HelloWorld</source>
여기서 HelloWorld는 자바소스의 클래스명과 일치!!
> id="HelloRO"
HelloRO는 Flex에서 연계시 사용하게 된다.
> 만약 services-config.xml에서 채널을 추가하여 사용할 경우 아래와 같이 remotin-config.xml 파일에 채널명을 추가해주고 할당해 주어야 하지만 여기서는 디폴트 my-amf를 사용하였으므로 불필요하다.
| <default-channels> <channel ref="added-amf"/> </default-channels> <destination id="AddedRO"> <properties> <source>AddedHelloWorld</source> </properties> <channels> <channel ref="added-amf" /> </channels> </destination> |
======== Flex Builder 3 설정 ====================================================
5. 이제 Flex Builder 3를 실행하여 프로젝트를 생성하자
아래와 같이 설정하면 생성한 프로젝트 WidgetDemo안에 Flex 프로젝트를 생성하게 된다.
중요한 것은 Application server type을 J2EE로 하는 것이다.
WidegetDemo.mxml을 아래와 같이 수정하자.
| <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; private function resultHandler(event:ResultEvent):void { txtResult.text = event.result.toString(); } private function faultHandler(event:FaultEvent):void { txtResult.text = event.toString(); } ]]> </mx:Script> <mx:RemoteObject id="test" destination="HelloRO" showBusyCursor="true" result="resultHandler(event)" fault="faultHandler(event)" > </mx:RemoteObject> <mx:Button x="19" y="10" label="RemoteObject호출" click="test.my_func()" /> <mx:TextArea id="txtResult" x="10" y="40" width="229" height="218" /> </mx:Application> |
7. 끝이다. WidegetDemo를 실행하여 연계가 올바른지 테스트만 하면된다.
http://localhost:9090/WidgetDemo/FlexProject/bin-debug/WidegetDemo.html
올바른 테스트 결과
http://blog.naver.com//
http://siking.tistory.com/139
미룸클리닉 딸기 style 아이베제 토이앤기프트 그분이 생각날땐 극심한 이기주의자 기다림 아침안개 데님파티 행복가득우리집
