Hi all,
Today Saul came across the issue with mapping urls in a spring context.
Currently in the wms module the following mappings are used to have a
request processed by the dispatcher:
<bean id="wmsURLMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/wms">dispatcher</prop>
<prop key="/wms/*">dispatcher</prop>
</props>
</property>
</bean>
Now one would think that this should match both of the following requests:
http://…/geoserver/wms?request=GetCapabilities
http://…/geoserver/wms/GetCapabilities
However there is some trickery at play here. In the first case the
spring DispatcherServlet uses the path "/wms" against all the handler
mappings, so it works. But in the second case it uses the path
"/GetCapabilities" against all the handler mappings. The reason being
the servlet mapping in web.xml of "/wms/*". In the second case spring
will strip this off the beginning of the context path.
However luckily you can configure this behavior by setting the property
"alwaysUseFullPath" on the urlmapping. So specifying:
<bean id="wmsURLMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="alwaysUseFullPath" value="true"/>
<property name="mappings">
<props>
<prop key="/wms">dispatcher</prop>
<prop key="/wms/*">dispatcher</prop>
</props>
</property>
</bean>
results in the desired behavior. I have committed this change to the
wms, wcs, and wfs url mappings. Something to note for people setting up
mappings for their services. We need to document this when we finalize
the "how to write a service" tutorial for 1.6.x.
-Justin
--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com