The Assembler implementation included with Tools and Frameworks is configured through Spring. The configuration in the Spring context file applies to both the in-process Assembler and the Assembler Service.
This guide assumes an application based around the included Assembler implementations. You can provide your own implementation if you need to use an alternate means of configuring the Assembler.
In the reference implementations, application-specific Assembler
		  configuration is specified in the Spring context file located in 
		  WEB-INF\assembler-context.xml. 
		
The 
		  AssemblerFactory is an interface for creating a new
		  Assembler. The reference implementation uses the 
		  SpringAssemblerFactory implementation and defines it
		  as follows: 
		
<bean id="assemblerFactory" class="com.endeca.infront.assembler.spring.SpringAssemblerFactory"
    scope="singleton">
    <constructor-arg>
        <bean class="com.endeca.infront.assembler.AssemblerSettings">
            <property name="previewEnabled" value="${preview.enabled}" />
            <property name="previewModuleUrl" value="http://${workbench.host}:${workbench.port}/ifcr" />
        </bean>
    </constructor-arg>
</bean>For details about the 
		  AssemblerFactory interface and the 
		  SpringAssemblerFactory implementation, see the 
		  Assembler API Reference (Javadoc). 
		             
A cartridge handler is an Assembler component that takes the configuration model for a specific cartridge and interacts with an external system to produce a response model. Cartridge handler configuration is a subset of Assembler configuration.
The 
	 httpServletRequest bean provides access to the 
	 HTTPServletRequest object for the current request. 
  
<bean id="httpServletRequest" scope="request"
          factory-bean="springUtility"
          factory-method="getHttpServletRequest" />Cartridge handlers that need access to the servlet request can specify a reference to this bean as follows:
<property name="httpServletRequest" ref="httpServletRequest" />
The Assembler provides several utilities for parsing incoming requests and forming MDEX Engine queries.
The MDEX resource provides access to the MDEX Engine and manages information about the MDEX Engine and its schema configuration. Cartridge handlers can request data from their MDEX resource during the course of processing a cartridge.
The MDEX resource has the following properties:
| 
                                     MDEX resource property  | 
                                     Description  | 
|---|---|
| 
                                     
                                         | 
                                     The name of the application that the MDEX instance is associated with. Typically there is at least one MDEX per application.  | 
| 
                                     
                                         | 
                                     The hostname or IP address of your MDEX Engine server.  | 
| 
                                     
                                         | 
                                     The port on which the MDEX Engine server listens.  | 
| 
                                     
                                         | 
                                     Enables SSL communication for the MDEX Engine.  | 
| 
                                     
                                         | 
                                     The name of the property that serves as the record spec in your data set.  | 
The navigation state builder is responsible for parsing the request
		  URL into a 
		  NavigationState object and for generating URLs based
		  on a 
		  NavigationState. 
		
| 
                                     Navigation state builder property  | 
                                     Description  | 
|---|---|
| 
                                     
                                         | 
                                     Specifies the 
					  NoteIn the Discover Electronics application, this bean is
						configured in 
						 
  | 
| 
                                     
                                         | 
                                     The 
					   | 
| 
                                     
                                         | 
                                     Specifies the 
					   | 
| 
                                     
                                         | 
                                     The name of a property, dimension, or search interface against which searches (using the Search Box cartridge) are performed.  | 
| 
                                     
                                         | 
                                     The match mode to use for text searches.
					 Valid values for this property follow the syntax of URL parameters for search
					 mode, without the 
					   | 
| 
                                     
                                         | 
                                     Identifies the current site using the 
					   | 
| 
                                     
                                         | 
                                     Reference to the 
					   | 
| 
                                     
                                        
                                        
                                         | 
                                     These properties configure which URL parameters from the request URL are preserved when generating action strings and which ones are removed, depending on the type of transition the action URL represents.  | 
| 
                                     
                                         | 
                                     A list of dimensions whose dimension values should be applied to the navigation state for a record query based on the values that are tagged on that record. This navigation state can be used for triggering configuration for the associated record detail page or for a spotlight cartridge that has the "restrict to refinement state" option enabled.  | 
| 
                                     Filter state property  | 
                                     Description  | 
|---|---|
| 
                                     
                                         | 
                                     A rollup key (used for aggregated records) to apply to all queries made with the default filter state.  | 
| 
                                     
                                         | 
                                     Specifies whether to apply automatic phrasing to text search queries. By default, automatic phrasing is enabled. For more information about automatic phrasing configuration, see "About implementing automatic phrasing" in this guide.  | 
| 
                                     
                                         | 
                                     A default record filter to apply to MDEX Engine queries. For information about the record filter syntax, refer to the MDEX Engine Development Guide.  | 
| 
                                     
                                         | 
                                     The language ID (as a valid RFC-3066 or ISO-639 code) to specify for MDEX Engine queries. For information about working with internationalized data, refer to the MDEX Engine Development Guide.  | 
The 
		  NavigationState object contains two filter states: 
		
For more information about filtering syntax, refer to the 
		  Assembler API Reference(Javadoc) content for the 
		  NavigationState interface. 
		
Using 
		  com.endeca.infront.navigation.NavigationState.getFilterState()
		  combines site-based filters and URL filters. 
		
| 
                                        FilterState feature  | 
                                        Filter results  | 
|---|---|
| 
                                        Search (Ntt, Ntk, Ntx)  | 
                                        Site and URL  | 
| 
                                        Security (Cannot be security filter with a URL)  | 
                                        Site  | 
| 
                                        Nav (N)  | 
                                        URL  | 
| 
                                        Record (Nr)  | 
                                        Site and URL  | 
| 
                                        Range (Nf)  | 
                                        Site and URL  | 
| 
                                        Geo (Nfg)  | 
                                        URL  | 
| 
                                        Featured Records (Rsel)  | 
                                        Site and URL  | 
| 
                                        EQL Filter (Nrs)  | 
                                        URL  | 
| 
                                        Rollup Key (Cannot be specified in a URL)  | 
                                        Site  | 
| 
                                        Language ID (Ntl)  | 
                                        URL  | 
| 
                                        Autophrase Enabled (Ntp)  | 
                                        URL  | 
The site state builder is responsible for identifying the current site
		  or 
		  SiteState object. The site state builder iterates
		  through all 
		  siteStateParsers and determines the current site or
		  site state. Site state is referenced in Assembler components that must know the
		  current site, for example, 
		  NavigationCartridgeHandler and 
		  NavigationStateBuilder. 
		
                        SiteStateBuilder has the following properties: 
		
| 
                                     Site state builder property  | 
                                     Descritption  | 
|---|---|
| 
                                     
                                         | 
                                     Retrieves site definitions.  | 
| 
                                     
                                         | 
                                     A list of site state parsers that are run
					 in the configured order to resolve 
					  
                                        
                                         | 
| 
                                     
                                         | 
                                     Returns the default site for an
					 application. This is only used if 
					   | 
| 
                                     
                                         | 
                                     Retrieves the page 
					   | 
Cartridge handlers that need to make MDEX Engine queries can reference the navigation state, record state, site state, user state, and MDEX request builder beans configured in the cartridge support section of the Spring context file.
The navigation state and record state represent the query parameters for each type of MDEX Engine query. The MDEX request builder consolidates requests from all the cartridge handlers in a single Assembler processing cycle into as few MDEX queries as possible. These beans are defined in terms of previously configured beans; their configuration should not need to vary between applications.
The 
		NavigationCartridgeHandler references the 
		navigationState, 
		mdexRequestBuilder and 
		siteState beans for making navigation queries. The 
		RecordDetailsHandler references the 
		recordState for record detail queries. Cartridge
		handlers (including many of the core cartridges) that need access to the
		navigation state, record state, site state or the MDEX request builder
		typically extend one of these handlers. Note that 
		RecordDetailsHandler itself extends 
		NavigationCartridgeHandler as shown below, thereby
		inheriting the references to the navigation state and MDEX request builder
		specified in the 
		NavigationCartridgeHandler bean. 
	 
<bean id="NavigationCartridgeHandler" abstract="true">
    <property name="navigationState" ref="navigationState" />
    <property name="mdexRequestBuilder" ref="mdexRequestBuilder" />
				<property name="mdexRequestBuilder" ref="mdexRequestBuilder" />
				<property name="actionPathProvider" ref="actionPathProvider"/>
    <property name="siteState" ref="siteState"/>
				<property name="userState" ref="${user.state.ref}"/>
</bean>
<bean id="CartridgeHandler_RecordDetails" 
  class="com.endeca.infront.cartridge.RecordDetailsHandler"
  parent="NavigationCartridgeHandler" scope="prototype" >
    <property name="recordState" ref="recordState" />
</bean>Cartridge handlers that retrieve dynamic content based on trigger criteria can reference the content manager bean configured in the cartridge support section of the Spring context file.
The content manager depends on the content trigger state builder and its associated content trigger state, which perform similar functions to the navigation state builder and navigation state, only for the trigger query that retrieves dynamic content configuration, rather than the main navigation query.
Application-specific configuration for these beans relates to preview and auditing functionality. For more information about configuring preview, see "Setting up the Preview Application for Workbench."
The 
		ContentSlotHandler references the content manager to
		make dynamic content queries. Other handlers that need to retrieve content
		items from a folder in Experience Manager should extend from this handler. 
	 
<bean id="CartridgeHandler_ContentSlot"
  class="com.endeca.infront.content.ContentSlotHandler"
  scope="prototype">
    <property name="contentManager" ref="contentManager" />
</bean>The Spring Assembler servlet extends the 
	 AbstractAssemblerServlet class, which requires a method
	 for retrieving an 
	 AssemblerFactory, and another for retrieving a 
	 ResponseWriter that processes Assembler output. 
  
The Assembler servlet references the same Spring configuration as the rest of the Assembler, with an additional dependency on response writer configuration.
The Assembler servlet uses JSON or XML response writers to serialize
		  the results of a query. The Assembler includes default implementations of a 
		  JSONResponseWriter and an 
		  XMLResponseWriter. You can provide your own
		  implementation if you need to output the Assembler response to a different
		  format (such as a different XML representation). 
		
<bean id="jsonResponseWriter" class="com.endeca.infront.assembler.servlet.JsonResponseWriter" scope="singleton"/> <bean id="xmlResponseWriter" class="com.endeca.infront.assembler.servlet.XmlResponseWriter" scope="singleton"/>

