diff --git a/spring-social-showcase/src/main/java/org/springframework/social/showcase/twitter/TwitterFriendsController.java b/spring-social-showcase/src/main/java/org/springframework/social/showcase/twitter/TwitterFriendsController.java new file mode 100644 index 00000000..e169bd58 --- /dev/null +++ b/spring-social-showcase/src/main/java/org/springframework/social/showcase/twitter/TwitterFriendsController.java @@ -0,0 +1,48 @@ +/* + * Copyright 2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.social.showcase.twitter; + +import javax.inject.Inject; + +import org.springframework.social.twitter.api.TwitterApi; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +@Controller +public class TwitterFriendsController { + + private final TwitterApi twitterApi; + + @Inject + public TwitterFriendsController(TwitterApi twitterApi) { + this.twitterApi = twitterApi; + } + + @RequestMapping(value="/twitter/friends", method=RequestMethod.GET) + public String friends(Model model) { + model.addAttribute("profiles", twitterApi.friendOperations().getFriends()); + return "twitter/friends"; + } + + @RequestMapping(value="/twitter/followers", method=RequestMethod.GET) + public String followers(Model model) { + model.addAttribute("profiles", twitterApi.friendOperations().getFollowers()); + return "twitter/friends"; + } + +} \ No newline at end of file diff --git a/spring-social-showcase/src/main/webapp/WEB-INF/layouts/menu.jsp b/spring-social-showcase/src/main/webapp/WEB-INF/layouts/menu.jsp index a5b5800a..9d012b3b 100644 --- a/spring-social-showcase/src/main/webapp/WEB-INF/layouts/menu.jsp +++ b/spring-social-showcase/src/main/webapp/WEB-INF/layouts/menu.jsp @@ -6,6 +6,8 @@ diff --git a/spring-social-showcase/src/main/webapp/WEB-INF/views/twitter/friends.jsp b/spring-social-showcase/src/main/webapp/WEB-INF/views/twitter/friends.jsp new file mode 100644 index 00000000..95de0e9c --- /dev/null +++ b/spring-social-showcase/src/main/webapp/WEB-INF/views/twitter/friends.jsp @@ -0,0 +1,26 @@ +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="sf" %> +<%@ page session="false" %> + + + + +

Your Twitter Friends

+ + \ No newline at end of file diff --git a/spring-social-showcase/src/main/webapp/WEB-INF/views/twitter/messages.jsp b/spring-social-showcase/src/main/webapp/WEB-INF/views/twitter/messages.jsp index e2601b04..bbe88b98 100644 --- a/spring-social-showcase/src/main/webapp/WEB-INF/views/twitter/messages.jsp +++ b/spring-social-showcase/src/main/webapp/WEB-INF/views/twitter/messages.jsp @@ -29,13 +29,13 @@
-