I've got the follow class, pretty much chapter and book from the Spring Social how-to's. Anyhow, I create a Facebook connection - all goes well, the db records are created, etc. However, the connect interceptor pre and post connect methods don't seem to fire as indicated either by print/logging statements or by debug breakpoints. Our spring core is 3.1.
Any help on this would be appreciated. It is such a simple scenario, I'm completely baffled at the moment.
Code:@Configuration public class SocialConfig { @Value("${facebook.clientId}") private String facebookClientId; @Value("${facebook.clientSecret}") private String facebookClientSecret; @Inject private DataSource dataSource; @Inject private TextEncryptor textEncryptor; @Bean public ConnectionFactoryLocator connectionFactoryLocator() { ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry(); registry.addConnectionFactory(new FacebookConnectionFactory(facebookClientId,facebookClientSecret)); return registry; } @Bean @Scope(value="request", proxyMode=ScopedProxyMode.INTERFACES) public ConnectionRepository connectionRepository(){ Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { throw new IllegalStateException("Unable to get a ConnectionRepository: no user signed in"); } return usersConnectionRepository().createConnectionRepository(authentication.getName()); } @Bean public UsersConnectionRepository usersConnectionRepository() { return new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator(), textEncryptor); } @Bean public ConnectController connectController() { System.out.println("creating connectController bean "); ConnectController controller = new ConnectController(connectionFactoryLocator(), connectionRepository()); //controller.setApplicationUrl("http://localhost:8080/sigkat/"); controller.addInterceptor(new FacebookConnectInterceptor()); return controller; } protected static class FacebookConnectInterceptor implements ConnectInterceptor<Facebook>{ @Override public void postConnect(Connection<Facebook> arg0, WebRequest arg1) { System.out.println("FacebookConnectInterceptor.postConnect webrequest="+arg1); } @Override public void preConnect(ConnectionFactory<Facebook> arg0, MultiValueMap<String, String> arg1, WebRequest arg2) { System.out.println("FacebookConnectInterceptor.preConnect MultiValueMap="+arg1); } } }


Reply With Quote