Announcement Announcement Module
Collapse
No announcement yet.
Make ConnectController#redirectToProviderConnect() configurable Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Make ConnectController#redirectToProviderConnect() configurable

    Currently (M3) ConnectController's redirectToProviderConnect() method is private:

    Code:
    private String redirectToProviderConnect(String providerId) {
    		return "redirect:/connect/" + providerId;
    	}
    The problem is we can't override or set a custom redirect URL. The default method implementation assumes that after the domain we have a URL with a request mapping to /connect/{providerId}.

    For example, if my domain is http://mydomain.com and I'm trying to connect to Facebook, redirectToProvider() will redirect to http://mydomain.com/connect/facebook. This will work if you have a RequestMapping that matches such. However if in your web.xml you declared a different URL hierarchy for DispatcherServlet , then you'll run to HTTP status 404.

    Assuming you have the following DispatcherServlet declaration:
    Code:
    <servlet-mapping>
    		<servlet-name>spring</servlet-name>
    		<url-pattern>/myapp/*</url-pattern>
    	</servlet-mapping>
    When you allow the app to have access to your Facebook account, it will redirect back to http://mydomain.com/connect/facebook which doesn't exist. The right path is http://mydomain.com/myapp/connect/facebook

    This problem is similar to the following post http://forum.springsource.org/showth...rl()-protected

  • #2
    Sounds like an oversight on our part. Would you mind opening a JIRA at jira.springsource.org/browse/SOCIAL. We need to take into account the servlet path in our redirect URL generation.

    Comment


    • #3
      Keith, I have filed a JIRA for this issue:

      Servlet path must be configurable in the redirect URL generation of ConnectController

      Comment


      • #4
        A change has been applied to do a relative redirect instead of an absolute redirect. This should address this problem without requiring any special config or override of redirectToProvider(). Let me know if this works for you. Thanks!

        Comment


        • #5
          Tested with latest snapshot...and it works! Thanks for the update

          Comment


          • #6
            What should be the maven dependecy

            Can someone tell me what should be the maven dependency that points to the nightly build that has the above mentioned fix? In the sense what is the version number i will have to use in maven.

            Comment


            • #7
              Answering my own question

              http://static.springsource.org/sprin...rview-howtoget

              Comment

              Working...
              X