views:

70

answers:

0

Hi all,

I create a Controller bean to map a dedicated URI.

My web.xml file :

<!-- Spring MVC Servlet (that will route HTTP requests to BlazeDS) -->
<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/spring-main-config.xml</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
</servlet>

<!-- We are only using BlazeDS AMF channels to communicate with FlexClient, so let's map  URLs accordingly. -->
<servlet-mapping>
  <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <url-pattern>/messagebroker/*</url-pattern>        
  </servlet-mapping>   

My spring-main-config.xml file :

<!-- Use annotations for Spring configuration -->
<context:annotation-config />
<context:component-scan base-package="com.myapp" /> 

<!-- Flex integration within Spring. -->
<flex:message-broker services-config-path="/WEB-INF/flex-services-config.xml">
  <flex:remoting-service />
</flex:message-broker>

<!-- Session-scoped bean for User Info -->
<bean class="com.myapp.businessservices.common.UserSessionInfo" scope="session">
  <aop:scoped-proxy proxy-target-class="false"/>
</bean>

<!-- Mapping request URL to controller bean -->
<!-- no 'id' required, HandlerMapping beans are automatically detected by the DispatcherServlet --> 
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">  
    <property name="mappings">
        <value>
            /fbauth=FacebookOAuthHandler
        </value>
    </property>     
</bean>

<bean id="FacebookOAuthHandler" class="com.myapp.businessservices.common.facebook.FacebookOAuthHandler" />  

My bean controller file :

package myapp.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

public class MyController extends AbstractController{

@Autowired
UserSesson userSession;

@Autowired
BusinessLogger logger;

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
   HttpServletResponse response) throws Exception {

      // TO DO - Facebook authentication
      return null;
 }
}

My controller is never handled when i used http://xx.xx.xx.xx:8080/myapp/fbauth, and error HTTP 404 is appears.

fbauth is just an URL suffix. Nothing fbauth folder, or file, etc.. exists. This URL is just used to be handle by my controller (for the specific Facebook Authentication).

Thnaks a lot for your help,

regards,

Anthony

related questions