PDA

View Full Version : Output html page



pulse00
Apr 22nd, 2009, 08:25 AM
I'm trying to add a SimpleUrlHandlerMapping to my spring - blazeDS configuration to output a dynamically generated html page for a specific url.

This is the current mapping for the spring DispatcherServlet:


<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/config/web-application-config.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>


I've tried to add a SimpleUrlHandlerMapping as a bean in the applicationContext.xml like this:


<bean id="publicUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlH andlerMapping">
<property name="mappings">
<value>
/messagebroker/index.html=indexController
</value>
</property>
</bean>


But when a request comes in at /messageBroker/index.html, it's handled like this:


DEBUG SimpleUrlHandlerMapping - Mapping [/index.html] to handler 'flex.messaging.MessageBroker@9292ece'

So it's being handled by the flex MessageBroker, but what i'm trying to do is to map this request directly to my Controller, without any blazeds interaction.


Anyone knows if this is possible somehow ?

jeremyg484
Apr 22nd, 2009, 09:05 AM
Set the order property on your additional handler mapping so that it comes first in the chain.

jeremyg484
Apr 22nd, 2009, 09:09 AM
Btw, it's worth noting that in M2 you cannot control the order of the handler mapping that is installed by the namespace config tags, but this has been fixed in trunk and will be available in the impending RC1.

Either way, for your case, setting the order of your custom mapping to a lower value such as 0 should get the job done.

pulse00
Apr 22nd, 2009, 09:25 AM
thanks for the hint, my controller seems to kick in now, but i get a ServletException:


No adapter for handler [net.dubture.controller.IndexController@60d7c9e6]: Does your handler implement a supported interface like Controller?

It implements org.springframework.web.servlet.mvc.Controller. I've tested the controller before with a non spring-flex servlet and it worked fine.

thomasvst
May 6th, 2009, 01:52 AM
have you try this : http://forum.springsource.org/showthread.php?t=66278

This fix the problem for me.