•  
Main
About Hippo Site Toolkit 1
Technical Documentation
Expression Language
Other

URL matcher

To resolve links to documents in the repository URL-mapping is used. This URL-mapping makes sure that links in the application are resolved to the right documents. This resolving is based on a mapping, which is defined/determined in a file in your web-application.

Every incoming URL made into a URLElements object. This object is able to break the incoming URL down to a contextPath, documentPath and a documentType.

The mapping of URL's to specific files is configured in the applicationContext.xml file, found under /WEB-INF/applicationContext.xml. In this file you are able to specify which incoming URL's map to which files. For example, you might want all URL's that start with "/news" to map to "/news.jsp".

The applicationContext.xml file contains a list of URLMappingRule objects. These are the placeholders for URLElements objects that contain information about the incoming URL itself. The URLMappingRule objects hold the rules to which an URL (an URLElements object) must comply.

The applicationContext.xml file makes use of its list of URLMappingRule objects and to find out where there's a match for an URLMappingRule and the URLElementsObject it contains. It looks at all the URLMappingRule objects it has, and tries to find a match for the incoming URL. It searches from top to bottom, and dispatches the request to the first match it finds.

This is how part of an applicationContext.xml file might look like:

<bean id="URLMapping" class="nl.hippo.client.el.ext.urlmapping.bean.URLMapping">   
<property name="mapping">
	<list>
	    <bean class="nl.hippo.client.el.ext.urlmapping.bean.URLMappingRule">		        		
			<property name="documentType" value="news" />
			<property name="forwardPage" value="/news.jsp" />		             			
		</bean> 
		
		 <bean class="nl.hippo.client.el.ext.urlmapping.bean.URLMappingRule">		        			
			<property name="documentType" value="event" />
			<property name="forwardPage" value="/event.jsp" />		             			
		</bean> 
		
	    <bean class="nl.hippo.client.el.ext.urlmapping.bean.URLMappingRule">		        			
				<property name="documentPath" value="/paging" />
			<property name="forwardPage" value="/list.jsp" />		             			
		</bean> 
		
		<bean class="nl.hippo.client.el.ext.urlmapping.bean.URLMappingRule">		        			
				<property name="documentPath" value="/query" />
			<property name="forwardPage" value="/query.jsp" />		             			
		</bean> 
		
		<bean class="nl.hippo.client.el.ext.urlmapping.bean.URLMappingRule">		        			
				<property name="documentPath" value="/dictionary" />
			<property name="forwardPage" value="/dictionary.jsp" />		             			
		</bean>
		
		<bean class="nl.hippo.client.el.ext.urlmapping.bean.URLMappingRule">		        			
			<property name="forwardPage" value="/home.jsp" />		             			
		</bean> 
		
		<bean class="nl.hippo.client.el.ext.urlmapping.bean.URLMappingRule">
			<property name="contextPath" value="" />
			<property name="documentPath" value="" />
			<property name="documentType" value="" />
			<property name="forwardPage" value="/news.jsp" />		             			
		</bean> 
	</list>
</property>        
</bean>

In this excerpt from the HST demo site we can see that the first rule maps all incoming URL's which contain documents of type "news" to "news.jsp".