3 Replies Latest reply on Aug 31, 2011 3:00 AM by salinijoby

    Spring BlazeDS Integration

    snkd Level 1

      Spring BlazeDS Integration

       

      this is the best tutorial for Spring BlazeDS Integration go to  http://codexamples.blogspot.com

       

      http://dl.dropbox.com/u/7375335/architechture.gif

      1. Configuring and Using the BlazeDS

       

      MessageBroker with Spring

       

      MessageBroker is the heart of the Spring BlazeDS Integration.

       

      When HTTP messages come from Flex client will be routed through the

       

      Spring DispatcherServlet to the Spring-managed MessageBroker.

       

      There is no need to configure the BlazeDS MessageBrokerServlet when using the

       

      Spring-managed MessageBroker.

       

       

      2. Configuring the Spring DispatcherServlet

       

      web.xml is the heart of the j2ee web project.So we have to configure it because

       

      each an every request is map to web.xml.

       

      The DispatcherServlet must be configured  in web.xml to bootstrap a Spring

       

      WebApplicationContext. For example:

       

      <!-- The front controller of this Spring Web application, responsible for handling all application requests -->

       

      <servlet>

       

      <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>

       

      <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

       

      <init-param>

       

      <param-name>contextConfigLocation</param-name>

       

      <param-value>/WEB-INF/config/web-application-config.xml</param-value>

       

      </init-param>

       

      <load-on-startup>1</load-on-startup>

       

      </servlet>

       

      3. Configuring the MessageBroker in Spring

       

      A simplified Spring XML config namespace is provided for configuring the MessageBroker in

       

      your WebApplicationContext. To use the namespace support you must add the schema location

       

      in your Spring XML config files. A typical config will look something like the following:

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <beans xmlns="http://www.springframework.org/schema/beans"

       

      xmlns:flex="http://www.springframework.org/schema/flex"

       

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       

      xsi:schemaLocation="

       

      http://www.springframework.org/schema/beans

       

      http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

       

      http://www.springframework.org/schema/flex

       

      http://www.springframework.org/schema/flex/spring-flex-1.0.xsd">

       

      ...

       

      </beans>

       

       

      Following XML config namespace tags makes the Spring BlazeDS Integration configuration tags available under the flex

       

      namespace in your configuration files. The above setup will be assumed for the rest of the

       

      configuration examples to follow. For the full detail of every attribute and tag available in the

       

      config namespace, be sure to refer to the spring-flex-1.0.xsd as every element and attribute is

       

      fully documented there. Using an XSD-aware XML editor such as the one in Eclipse should

       

      bring up the documentation automatically as you type.

       

      At a minimum, the MessageBrokerFactoryBean must be configured as a bean in your

       

      Spring WebApplicationContext in order to bootstrap the MessageBroker, along with a

       

      MessageBrokerHandlerAdapter and an appropriate HandlerMapping (usually a

       

      SimpleUrlHandlerMapping) to route incoming requests to the Spring-managed

       

      MessageBroker.

       

      These beans will be registered automatically by using the provided message-broker tag in

       

      your bean definition file. For example, in its simplest form:

       

       

      <flex:message-broker/>

       

       

      This will set up the MessageBroker and necessary supporting infrastructure using sensible

       

      defaults. The defaults can be overriden using the provided attributes of the message-broker

       

      tag and its associated child elements. For example, the default location of the BlazeDS XML

       

      configuration file (/WEB-INF/flex/services-config.xml) can be overridden using the

       

      services-config-path attribute. The MessageBrokerFactoryBean uses Spring's

       

      ResourceLoader abstraction, so that typical Spring resource paths may be used. For

       

      example, to load the configuration from the application's classpath:

       

      <flex:message-broker services-config-path="classpath*:services-config.xml"

       

      The equivalent MessageBrokerFactoryBean definition using vanilla Spring configuration

       

      would be:

       

       

      <!-- Bootstraps and exposes the BlazeDS MessageBroker -->

       

      <bean id="_messageBroker" class="org.springframework.flex.core.MessageBrokerFactoryBean" >

       

      <property name="servicesConfigPath" value="classpath*:services-config.xml" />

       

      </bean>

       

      Note especially that with the message-broker tag, it is not necessary to assign a custom id to


      the MessageBroker, and it is in fact discouraged so that you won't have to continually reference
      it later. The only reason you would ever need to provide a custom id is if you were bootstrapping
      more than one MessageBroker in the same WebApplicationContext.
        • 1. Re: Spring BlazeDS Integration
          kiran7881 Level 1

          this is the best tutorial  

           

          Is it because you have made the site ??

           

          To be frank , there is nothing special or great  in that materail .

           

          Try to make a nice and simple  copy of working example like roseindia or Abhi on java  and post it .People like me definately want them .

          • 2. Re: Spring BlazeDS Integration
            snkd Level 1

            I am just shairing my knowledge with others.I am not gaining anything from it.Only thing I am getting is Your comments.I beleve that,Shairing knowledge is open source concept...I am shairing my knowlegd in my best..

             

            what I feel is, If you say "there is nothing special or great  in that materail" that mean you know than me and you are not shairing your knowlegde.If you know verry well please shair it.There is no prohibition or ban for it.

            I was really heart from your comments...

            • 3. Re: Spring BlazeDS Integration
              salinijoby

              Hi,

               

              I am planning to intgrate flex and sprin in my project work.

              Can you please help me in that?

               

              I am beginner to flex.

              But I know Spring.

              Let me know what and all softwares I need to download and the IDE i need to use.

              And I am planning to use weblogic as AS.

               

              Thanks in advance for your help.

               

              Regards,

              Salini