JCA Configurations for MVC
All the JCA specific Spring configurations are available in <Windchill>\codebase\config\mvc\jca-mvc.xml. The below snippet shows the configuration of url handler mapping. All the url pattern ptc1/comp/* are mapped to a bean with id componentController and the pattern ptc1/tcomp/* are mapped to a bean with id typeBasedComponentController.
<bean id="abstractComponentHandlerMapping" abstract="true"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
-----
</bean>
<bean id="componentHandlerMapping" parent="abstractComponentHandlerMapping">
<property name="mappings" ref="componentHandlerMappings" />
-----
</bean>
<bean id="componentHandlerMappings"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties"><props>
<prop key="/comp/**">componentController</prop>
<prop key="/tcomp/**">typeBasedComponentController</prop>
</props></property>
</bean>
Below snippet shows the definition of the bean with componentController id.
• jcaComponentBuilderResolver is injected as theComponentBuilderResolver
• defaultViewMappings property is defined to map the default views
<bean id="componentController"
class="com.ptc.mvc.components.ComponentController">
<property name="componentBuilderResolver"
ref="jcaComponentBuilderResolver" />
<property name="defaultViewMappings">
<map>
<entry key="com.ptc.mvc.components.TreeConfig"
value="/components/tree.jsp" />
<entry key="com.ptc.mvc.components.TableConfig"
value="/components/table.jsp" />
<entry key="com.ptc.mvc.components.AttributesTableConfig“
value="/components/table.jsp" />
<entry key="com.ptc.mvc.components.AttributePanelConfig”
value="/components/attributePanel.jsp" />
</map>
</property>
-----------
</bean>
Below snippet shows the definition of the bean with typeBasedComponentController id.
• typeBasedComponentBuilderResolver is injected as the ComponentBuilderResolver. It respects the Windchill Type of the context object also while finding the best matched builder.
<bean id="typeBasedComponentController"
class="com.ptc.mvc.components.ComponentController“
parent="componentController“>
<property name="componentBuilderResolver"
ref="typeBasedComponentBuilderResolver" />
</bean>
The default handler specified will handle all the MVC url patterns that doesn’t have a mapping.
<bean id="componentHandlerMapping" parent="abstractComponentHandlerMapping">
<property name="defaultHandler" ref="netmarketsController" />
-----
</bean>
<bean id="netmarketsController"
class="com.ptc.jca.mvc.controllers.LegacyController" />