Announcement Announcement Module
Collapse
No announcement yet.
ConnectController - 404 on /connect/facebook Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ConnectController - 404 on /connect/facebook

    Hi,

    Just trying to integrate spring social into my project but can't seem to get around the ConnectController not redirecting me onto the facebook

    1 - I load ConnectController using the same pattern in the showcase application. This loads as I have put a breakpoint there and see it in the logs.
    2 - I have a jsp page called facebookConnect.jsp
    3 - When the user click the button withing facebookConnected.jsp - it redirecteds to <form action="<c:url value="/connect/facebook"/>" method="POST">
    4 - Click the button - 404

    I have read another post (see below) but this did not solve my problem. I am not using MVC in the traditional sense (no mvc configurations) as my front end is GWT. I am NOT seeing /connect/* appear in the logs when is the Url mappings take place.

    So; who's responsibility is it in the flow to create the urlMappings for ConnectController (i.e. what part of the showcase codebase does that)?

    I'm stuck - any advise would be greatly appreciated?

    Thanks,

    Ian.


    **Other Post http://forum.springsource.org/showth...nectController

  • #2
    You say you're not using MVC and have no MVC configuration because you're using GWT. But ConnectController is a Spring MVC controller and for it to work you'll need just enough Spring MVC configured for it to do its job. The showcase uses Java-based configuration and sets that stuff up in WebMvcConfig.java. It can also be done in XML config, as in servlet-context.xml in some of the other samples.

    Optionally, it may be possible to recreate ConnectController's functionality in a pure-GWT implementation. Admittedly, I'm not much of a GWT expert, so I don't know for sure how it would be done. Have a look at ConnectController.java to see how it works and if you come up with a GWT-equivalent, be sure to share it with us...I'm sure there are others who'd like to do the same thing.

    Comment


    • #3
      Many Thanks for the response Craig - not being an expert at MVC, you say " you'll need just enough Spring MVC configured for it to do its job"; this is what i'm interested in exporing

      I tried putting the mvc annotation driven line in my servlet-context (i got this from the 3.0 showcase in the samples) believe that it would scan for MVC controllers and that would have picked up ConnectController url mappings but this did not?

      So my confusion is with what feature in spring says "ConnectController in the spring-social-web module has a requestMapping so lets scan map "/connect/*" to this class as normally I have done this mapping in the past (for the restful service controllers) using the component scan feature within my project package - ConnectController is not in my package?

      Thanks,

      Ian

      Comment


      • #4
        OK - I think I understand the issue(s) - it was to do with the root-application-context.xml loading the SocialConfig spring java config file but the dispatch servlet's doing the mvcannotation-scanning (my understanding is that is won't scan ConnectController as it was loading in another application context) .

        I could not move the loading of the SocialConfig into the dispatch-servlet's application context as I have a number of services loaded in root-application-context relying on the beans created in SocialConfig.

        Looking at Craigs code (showcase) that uses Java configurations; he doesn't have a separate Application-context for the dispatch servlet so I moved the dispatch servlet application-context loading into the root-application-context (an import) & removed the loading from the servlet documentation in the web.xml..

        Doesn't feel pretty but it works & 1 more reason for me to move to Java based configuration...

        Thanks,

        Ian.

        Comment


        • #5
          The other option, which the spring-social-quickstart-30x sample shows, is to declare the ConnectController bean in the DispatcherServlet context. However, this splits up the SocialConfig, which isn't very object-oriented.

          In general, context hierarchies are overrated and promote technical layering over function layering. I much prefer functional layering, which in this case means keeping the SocialConfig in one place rather than spreading it around by "technical layer" such as dao/service/web.

          FYI in Spring 3.1 ancestor contexts are scanned for Controllers by default.

          Keith

          Comment

          Working...
          X