javaguy44
Mar 29th, 2009, 06:38 AM
Hi,
I'm currently doing a proof of concept converting my BlazeDS + Spring app(using Christophe's SpringFactory) into the spring-flex module. In this existing app, I access + use Spring Controller's using the ControllerClassNameHandlerMapping convention.
I've been following reference guide and have a couple issues / questions relating to this.
1. I tried to use the convention stated in ref guide, however this notation didn't receive request's from my Flex Client. See "doesn't work" below.
<flex:message-broker>
<flex:mapping pattern="/messagebroker/*" /> - ref guide ex doesn't work
<flex:mapping pattern="/amf" />
</flex:message-broker>
I did some debugging of the DispatcherServlet request, and the culprit was
UrlPathHelper.getPathWithinServletMapping(httpserv letrequest)
my web.xml servlet-mapping
<url-pattern>/messagebroker/*</url-pattern>
my channel definition in remoting-config.xml
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
It appears the ref guide is incorrect but perhaps I am doing something wrong?
2. After integrating springflex, my Spring Controller's initially didn't receive requests. I got the following stacktrace:
javax.servlet.ServletException: No adapter for handler [webapp.controller.FileUploadController@135c592]: Does your handler implement a supported interface like Controller?
org.springframework.web.servlet.DispatcherServlet. getHandlerAdapter(DispatcherServlet.java:1100)
org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:874)
org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:807)
org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:571)
org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:511)
javax.servlet.http.HttpServlet.service(HttpServlet .java:710)
javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
After debugging, I've found that:
a. when DispatcherServlet and invokes initHandlerAdapters, the MessageBrokerHandlerAdapter is detected. Consequently, none of the default HandlerAdapter's get loaded
b. My controller worked once I declared in dispatcher-servlet.xml <bean class="org.springframework.web.servlet.mvc. SimpleControllerHandlerAdapter"/ >
Will this always be required? It would be nice if:
- the default HandlerAdapter's in DispatcherServlet.properties were also loaded by default + the Framework were responsible as opposed to the developer user like myself having to declare all of them.
- Would also make things simpler for users when upgrading Spring in future releases.
- Also, I can't extend DispatcherServlet + override initHandlerAdapter in a nice way since it's private.
I can raise a jira issue for this if you wish / agree
I am using:
- BlazeDS turnkey 3.2.0.3978
- Spring 2.5.6
- SpringFlex 1.0.0 M2
- JDK 1.6.0_04
- XP
- FlexBuilder / SDK 3.2
Many thanks
I'm currently doing a proof of concept converting my BlazeDS + Spring app(using Christophe's SpringFactory) into the spring-flex module. In this existing app, I access + use Spring Controller's using the ControllerClassNameHandlerMapping convention.
I've been following reference guide and have a couple issues / questions relating to this.
1. I tried to use the convention stated in ref guide, however this notation didn't receive request's from my Flex Client. See "doesn't work" below.
<flex:message-broker>
<flex:mapping pattern="/messagebroker/*" /> - ref guide ex doesn't work
<flex:mapping pattern="/amf" />
</flex:message-broker>
I did some debugging of the DispatcherServlet request, and the culprit was
UrlPathHelper.getPathWithinServletMapping(httpserv letrequest)
my web.xml servlet-mapping
<url-pattern>/messagebroker/*</url-pattern>
my channel definition in remoting-config.xml
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
It appears the ref guide is incorrect but perhaps I am doing something wrong?
2. After integrating springflex, my Spring Controller's initially didn't receive requests. I got the following stacktrace:
javax.servlet.ServletException: No adapter for handler [webapp.controller.FileUploadController@135c592]: Does your handler implement a supported interface like Controller?
org.springframework.web.servlet.DispatcherServlet. getHandlerAdapter(DispatcherServlet.java:1100)
org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:874)
org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:807)
org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:571)
org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:511)
javax.servlet.http.HttpServlet.service(HttpServlet .java:710)
javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
After debugging, I've found that:
a. when DispatcherServlet and invokes initHandlerAdapters, the MessageBrokerHandlerAdapter is detected. Consequently, none of the default HandlerAdapter's get loaded
b. My controller worked once I declared in dispatcher-servlet.xml <bean class="org.springframework.web.servlet.mvc. SimpleControllerHandlerAdapter"/ >
Will this always be required? It would be nice if:
- the default HandlerAdapter's in DispatcherServlet.properties were also loaded by default + the Framework were responsible as opposed to the developer user like myself having to declare all of them.
- Would also make things simpler for users when upgrading Spring in future releases.
- Also, I can't extend DispatcherServlet + override initHandlerAdapter in a nice way since it's private.
I can raise a jira issue for this if you wish / agree
I am using:
- BlazeDS turnkey 3.2.0.3978
- Spring 2.5.6
- SpringFlex 1.0.0 M2
- JDK 1.6.0_04
- XP
- FlexBuilder / SDK 3.2
Many thanks