My favorites | Sign in
t-2
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
LegacyIntegration  

en, ja
Updated Aug 20, 2009 by c95...@gmail.com

Tips for legacy integration with T2.

Migration and integration with legacy environment

Migration and integration with/from legacy environment is always painfull. With T2 framework, we give you much more easiness than other framework because we keep configuration as small as possible, and as simple as possible, and is beeing at one-point configuration, web.xml
These are sample co-existing integration case with Struts2 mail reader application and T2.
<?xml version="1.0"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
	<display-name>Struts 2 Mailreader</display-name>
	<context-param>
		<param-name>t2.encoding</param-name>
		<param-value>UTF-8</param-value>
	</context-param>
	
	<filter>
		<filter-name>t2</filter-name>
		<filter-class>org.t2framework.t2.filter.T2Filter</filter-class>
		<init-param>
			<param-name>t2.rootpackage</param-name>
			<param-value>mailreader2.page</param-value>
		</init-param>
		<init-param>
			<param-name>t2.exclude-resources</param-name>
			<param-value>css, js, png, gif, jsp, do</param-value>
		</init-param>
	</filter>
	<filter>
		<filter-name>Struts2</filter-name>
		<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
	</filter>
	
	<filter-mapping>
		<filter-name>t2</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>

	<filter-mapping>
		<filter-name>Struts2</filter-name>
		<url-pattern>*.do</url-pattern>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
	</filter-mapping>
	
	<!-- Application Listener for Mailreader database -->
	<listener>
		<listener-class>mailreader2.ApplicationListener</listener-class>
	</listener>

	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
	</welcome-file-list>

</web-app>
The points are:
  1. T2 begins to work from T2Filter, which is Servlet Filter.So order all filters correctly with filter-mapping.
  2. Set url-mapping correctly for T2Filter so that you will not confuse which Filter works.
  3. You can even set extension for T2Filter using filter init-param tag which the key is t2.exclude-resources.
  4. Set dispatcher tag for your filters: does it work with REQUEST, FORWARD, INCLUDE, ERROR?

Back to TOP

Powered by Google Project Hosting