1 / 8

Tuscany/Spring web application integration

Tuscany/Spring web application integration. Raymond Feng. Overview. Spring has a convenient way for a web application to initialize the ApplicationContext when the web application starts.

halil
Download Presentation

Tuscany/Spring web application integration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tuscany/Spring web application integration Raymond Feng

  2. Overview • Spring has a convenient way for a web application to initialize the ApplicationContext when the web application starts. • http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#context-create • Tuscany creates a Node for a web application when it starts. If the deployable composites contain SCA spring components, Tuscany tries to build an ApplicationContext too. • We should allow the two containers to coexist and collaborate within the web application. The ApplicationContext created by Tuscany should be able to see the “global” WebApplicationContext. This way, we don’t have to load the Spring context twice and duplicate the definitions.

  3. Runtime architecture Component (implementation.spring) Tuscany TuscanyContextListener/TuscanyServletFilter Spring ApplicationContext ServletContext Spring ContextLoaderListener Spring WebApplicationContext XML

  4. A sample web application SCA composite HelloworldClientComponent (implementation.spring) DateServiceComponent (implementation.java) Tuscany TuscanyContextListener/TuscanyServletFilter Spring ApplicationContext (HelloworldClientBean) ServletContext Spring WebApplicationContext (HelloworldBean) Spring ContextLoaderListener helloworld-client-context.xml helloworld-context.xml

  5. Spring MVC support • http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html

  6. Servlet-scoped Tuscany Node TuyscanyContextListener/TuscanyServletFilter (Middleware-tier) Tuscany Node Spring Web Application Context parent Spring MVC Servlet Tuscany Node TuyscanyDispatcherServlet extends DispatcherServlet (Spring MVC) Spring MVC Application Context

  7. Sample application • https://svn.apache.org/repos/asf/tuscany/sandbox/rfeng/sca-java-2.x/implementation-spring/helloworld-spring-webapp/ <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.apache.tuscany.sca.host.webapp.spring.TuscanyDispatcherServlet</servlet-class> <!-- Spring MVC DispatcherServletconfig --> <init-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/spring/appServlet/servlet-context.xml </param-value> </init-param> <!-- SCA contribution --> <init-param> <param-name>contribution</param-name> <param-value> /WEB-INF/sca </param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/mvc/*</url-pattern> </servlet-mapping>

  8. Sample composite helloworld-client-context.xml helloworld-context.xml HelloworldClient Bean Helloworld Bean DateService Component (SCA Java) Helloworld Client Component (SCA Spring) WebApp Greeting Component (SCA Spring) Servlet sca-context.xml servlet-context.xml Spring MVC Beans Message Service Bean Spring MVC Beans Greeting Service Bean Spring MVC Beans

More Related