Skip to content
Browse files

Merge branch 'master' of git://github.com/yusuke/twitter4j

  • Loading branch information...
2 parents 6537262 + 7a6084e commit fa4131458742e3b99823258c06e21c5c7784a6e7 @yusuke committed Jun 4, 2012
Showing with 855 additions and 1,234 deletions.
  1. +1 −0 .gitignore
  2. +1 −2 package.sh
  3. +3 −1 readme.txt
  4. +3 −2 twitter4j-appengine/src/main/java/twitter4j/internal/http/alternative/AppEngineHttpResponseImpl.java
  5. +0 −233 twitter4j-async/src/main/java/twitter4j/AsyncTwitterImpl.java
  6. +0 −14 twitter4j-async/src/main/java/twitter4j/TwitterAdapter.java
  7. +0 −20 twitter4j-async/src/main/java/twitter4j/TwitterListener.java
  8. +0 −14 twitter4j-async/src/main/java/twitter4j/TwitterMethod.java
  9. +0 −38 twitter4j-async/src/main/java/twitter4j/api/ListMembersMethodsAsync.java
  10. +0 −38 twitter4j-async/src/main/java/twitter4j/api/ListMethodsAsync.java
  11. +0 −50 twitter4j-async/src/main/java/twitter4j/api/ListSubscribersMethodsAsync.java
  12. +0 −28 twitter4j-async/src/main/java/twitter4j/api/TimelineMethodsAsync.java
  13. +0 −70 twitter4j-async/src/main/java/twitter4j/api/UserMethodsAsync.java
  14. +0 −38 twitter4j-async/src/test/java/twitter4j/AsyncTwitterTest.java
  15. +7 −1 twitter4j-core/pom.xml
  16. +5 −0 twitter4j-core/src/main/java/twitter4j/GeoLocation.java
  17. +1 −2 twitter4j-core/src/main/java/twitter4j/Status.java
  18. +24 −1 twitter4j-core/src/main/java/twitter4j/Tweet.java
  19. +5 −6 twitter4j-core/src/main/java/twitter4j/TwitterAPIMonitor.java
  20. +0 −167 twitter4j-core/src/main/java/twitter4j/TwitterImpl.java
  21. +73 −0 twitter4j-core/src/main/java/twitter4j/Twt.java
  22. +0 −49 twitter4j-core/src/main/java/twitter4j/api/ListMembersMethods.java
  23. +0 −47 twitter4j-core/src/main/java/twitter4j/api/ListMethods.java
  24. +0 −63 twitter4j-core/src/main/java/twitter4j/api/ListSubscribersMethods.java
  25. +0 −35 twitter4j-core/src/main/java/twitter4j/api/TimelineMethods.java
  26. +0 −88 twitter4j-core/src/main/java/twitter4j/api/UserMethods.java
  27. +2 −2 twitter4j-core/src/main/java/twitter4j/conf/ConfigurationBase.java
  28. +1 −1 twitter4j-core/src/main/java/twitter4j/internal/http/HttpClientImpl.java
  29. +6 −0 twitter4j-core/src/main/java/twitter4j/internal/http/HttpResponse.java
  30. +1 −1 twitter4j-core/src/main/java/twitter4j/internal/http/HttpResponseImpl.java
  31. +47 −0 twitter4j-core/src/main/java/twitter4j/internal/http/StreamingGZIPInputStream.java
  32. +12 −0 twitter4j-core/src/main/java/twitter4j/internal/json/HashtagEntityJSONImpl.java
  33. +0 −3 twitter4j-core/src/main/java/twitter4j/internal/json/IDsJSONImpl.java
  34. +5 −0 twitter4j-core/src/main/java/twitter4j/internal/json/MediaEntityJSONImpl.java
  35. +5 −0 twitter4j-core/src/main/java/twitter4j/internal/json/PlaceJSONImpl.java
  36. +5 −0 twitter4j-core/src/main/java/twitter4j/internal/json/StatusJSONImpl.java
  37. +34 −1 twitter4j-core/src/main/java/twitter4j/internal/json/TweetJSONImpl.java
  38. +27 −0 twitter4j-core/src/main/java/twitter4j/internal/json/URLEntityJSONImpl.java
  39. +5 −0 twitter4j-core/src/main/java/twitter4j/internal/json/UserJSONImpl.java
  40. +14 −0 twitter4j-core/src/main/java/twitter4j/internal/json/UserMentionEntityJSONImpl.java
  41. +28 −0 twitter4j-core/src/main/java/twitter4j/internal/json/z_T4JInternalJSONImplFactory.java
  42. +1 −1 twitter4j-core/src/test/java/twitter4j/FavoriteMethodsTest.java
  43. +1 −1 twitter4j-core/src/test/java/twitter4j/MBeansIntegrationTest.java
  44. +4 −2 twitter4j-core/src/test/java/twitter4j/SearchAPITest.java
  45. +2 −2 twitter4j-core/src/test/java/twitter4j/StatusMethodsTest.java
  46. +0 −11 twitter4j-core/src/test/java/twitter4j/TimelineMethodsTest.java
  47. +1 −16 twitter4j-core/src/test/java/twitter4j/TwitterTest.java
  48. +45 −0 twitter4j-core/src/test/java/twitter4j/internal/KryoSerializationTest.java
  49. +5 −0 twitter4j-core/src/test/java/twitter4j/internal/util/StringUtilTest.java
  50. +0 −9 twitter4j-examples/bin/timeline/getFriendsTimeline.cmd
  51. +0 −6 twitter4j-examples/bin/timeline/getFriendsTimeline.sh
  52. +0 −9 twitter4j-examples/bin/timeline/getPublicTimeline.cmd
  53. +0 −6 twitter4j-examples/bin/timeline/getPublicTimeline.sh
  54. +4 −2 twitter4j-examples/bin/twitter4j.properties
  55. +1 −1 twitter4j-examples/src/main/java/twitter4j/examples/json/SaveRawJSON.java
  56. +0 −53 twitter4j-examples/src/main/java/twitter4j/examples/timeline/GetFriendsTimeline.java
  57. +0 −53 twitter4j-examples/src/main/java/twitter4j/examples/timeline/GetPublicTimeline.java
  58. +1 −1 twitter4j-media-support/src/test/resources/twitter4j.properties-template
  59. +2 −2 twitter4j-stream/src/main/java/twitter4j/AbstractStreamImplementation.java
  60. +142 −0 twitter4j-stream/src/main/java/twitter4j/ControlStreamInfo.java
  61. +23 −6 twitter4j-stream/src/main/java/twitter4j/SiteStreamsImpl.java
  62. +271 −0 twitter4j-stream/src/main/java/twitter4j/StreamController.java
  63. +1 −1 twitter4j-stream/src/main/java/twitter4j/TwitterStream.java
  64. +12 −9 twitter4j-stream/src/main/java/twitter4j/TwitterStreamImpl.java
  65. +24 −28 twitter4j-stream/src/test/java/twitter4j/SiteStreamsTest.java
View
1 .gitignore
@@ -29,3 +29,4 @@ atlassian-ide-plugin.xml
*.iml
*.ipr
*.iws
+.idea/*
View
3 package.sh
@@ -1,8 +1,7 @@
#!/bin/sh
LANG=C
-export HASH=`git log|head -n 1|sed "s/^commit //g"`
-
+#export HASH=`git log|head -n 1|sed "s/^commit //g"`
sed -i '' "s/<url>http:\/\/oss.sonatype.org\/service\/local\/staging\/deploy\/maven2\//<url>file:\/Users\/yusukey\/maven2\//g" pom.xml
sed -i '' "s/<url>http:\/\/oss.sonatype.org\/service\/local\/staging\/deploy\/maven2\//<url>file:\/Users\/yusukey\/maven2\//g" twitter4j-core/pom.xml
sed -i '' "s/<url>http:\/\/oss.sonatype.org\/service\/local\/staging\/deploy\/maven2\//<url>file:\/Users\/yusukey\/maven2\//g" twitter4j-appengine/pom.xml
View
4 readme.txt
@@ -1,4 +1,4 @@
-Twittetr4J is a Twitter Aw binding library for the Java language licensed under Apache License 2.0.
+Twitter4J is a Twitter API binding library for the Java language licensed under Apache License 2.0.
Twitter4J includes software from JSON.org to parse JSON response from the Twitter API. You can see the license term at http://www.JSON.org/license.html
@@ -16,6 +16,7 @@ twitter4j-stream - Streaming API support : depending on twitter4j-core and twitt
Contributors
------------
Adam Samet <asamet at twitter.com> @damnitsamet
+Adrian Petrescu <apetresc at gmail.com> @apetresc
Alan Gutierrez <alan at blogometer.com>
Alessandro Bahgat <ale.bahgat at gmail.com> @abahgat
Anton Evane <antonevane at gmail.com> @anton_evane
@@ -26,6 +27,7 @@ Cole Wen <wennnnke at gmail.com> @Pigwen
Dan Checkoway <dcheckoway at gmail.com>
Dong Wang <dong at twitter.com> @dongwang218
Eric Jensen <ej at twitter.com> @ej
+Fiaz Hossain <fiaz at twitter.com> @fiazhossain
Hitoshi Kunimatsu <hkhumanoid at gmail.com>
Jacob S. Hoffman-Andrews <jsha at twitter.com> @j4cob
Jenny Loomis <jenny at rockmelt.com>
View
5 ...ppengine/src/main/java/twitter4j/internal/http/alternative/AppEngineHttpResponseImpl.java
@@ -37,6 +37,7 @@
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import java.util.Locale;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.zip.GZIPInputStream;
@@ -161,11 +162,11 @@ private void ensureResponseEvaluated() {
statusCode = r.getResponseCode();
headers = new HashMap<String, String>();
for (HTTPHeader h : r.getHeaders()) {
- headers.put(h.getName(), h.getValue());
+ headers.put(h.getName().toLowerCase(Locale.ENGLISH), h.getValue());
}
byte[] content = r.getContent();
is = new ByteArrayInputStream(content);
- if ("gzip".equals(headers.get("Content-Encoding"))) {
+ if ("gzip".equals(headers.get("content-encoding"))) {
// the response is gzipped
try {
is = new GZIPInputStream(is);
View
233 twitter4j-async/src/main/java/twitter4j/AsyncTwitterImpl.java
@@ -154,23 +154,6 @@ public void invoke(List<TwitterListener> listeners) throws
/**
* {@inheritDoc}
*/
- public void getPublicTimeline() {
- getDispatcher().invokeLater(new AsyncTask(PUBLIC_TIMELINE, listeners) {
- public void invoke(List<TwitterListener> listeners) throws TwitterException {
- ResponseList<Status> statuses = twitter.getPublicTimeline();
- for (TwitterListener listener : listeners) {
- try {
- listener.gotPublicTimeline(statuses);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
public void getHomeTimeline() {
getDispatcher().invokeLater(new AsyncTask(HOME_TIMELINE, listeners) {
public void invoke(List<TwitterListener> listeners) throws TwitterException {
@@ -205,40 +188,6 @@ public void invoke(List<TwitterListener> listeners) throws TwitterException {
/**
* {@inheritDoc}
*/
- public void getFriendsTimeline() {
- getDispatcher().invokeLater(new AsyncTask(FRIENDS_TIMELINE, listeners) {
- public void invoke(List<TwitterListener> listeners) throws TwitterException {
- ResponseList<Status> statuses = twitter.getFriendsTimeline();
- for (TwitterListener listener : listeners) {
- try {
- listener.gotFriendsTimeline(statuses);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void getFriendsTimeline(final Paging paging) {
- getDispatcher().invokeLater(new AsyncTask(FRIENDS_TIMELINE, listeners) {
- public void invoke(List<TwitterListener> listeners) throws TwitterException {
- ResponseList<Status> statuses = twitter.getFriendsTimeline(paging);
- for (TwitterListener listener : listeners) {
- try {
- listener.gotFriendsTimeline(statuses);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
public void getUserTimeline(final String screenName, final Paging paging) {
getDispatcher().invokeLater(new AsyncTask(USER_TIMELINE, listeners) {
public void invoke(List<TwitterListener> listeners)
@@ -882,108 +831,6 @@ public void invoke(List<TwitterListener> listeners) throws TwitterException {
});
}
- /**
- * {@inheritDoc}
- */
- public void getFriendsStatuses(final long cursor) {
- getDispatcher().invokeLater(new AsyncTask(FRIENDS_STATUSES, listeners) {
- public void invoke(List<TwitterListener> listeners) throws TwitterException {
- PagableResponseList<User> users = twitter.getFriendsStatuses(cursor);
- for (TwitterListener listener : listeners) {
- try {
- listener.gotFriendsStatuses(users);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void getFriendsStatuses(final String screenName, final long cursor) {
- getDispatcher().invokeLater(new AsyncTask(FRIENDS_STATUSES, listeners) {
- public void invoke(List<TwitterListener> listeners) throws TwitterException {
- PagableResponseList<User> users = twitter.getFriendsStatuses(screenName, cursor);
- for (TwitterListener listener : listeners) {
- try {
- listener.gotFriendsStatuses(users);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void getFriendsStatuses(final long userId, final long cursor) {
- getDispatcher().invokeLater(new AsyncTask(FRIENDS_STATUSES, listeners) {
- public void invoke(List<TwitterListener> listeners) throws TwitterException {
- PagableResponseList<User> users = twitter.getFriendsStatuses(userId, cursor);
- for (TwitterListener listener : listeners) {
- try {
- listener.gotFriendsStatuses(users);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void getFollowersStatuses(final long cursor) {
- getDispatcher().invokeLater(new AsyncTask(FOLLOWERS_STATUSES, listeners) {
- public void invoke(List<TwitterListener> listeners) throws TwitterException {
- PagableResponseList<User> users = twitter.getFollowersStatuses(cursor);
- for (TwitterListener listener : listeners) {
- try {
- listener.gotFollowersStatuses(users);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void getFollowersStatuses(final String screenName, final long cursor) {
- getDispatcher().invokeLater(new AsyncTask(FOLLOWERS_STATUSES, listeners) {
- public void invoke(List<TwitterListener> listeners) throws TwitterException {
- PagableResponseList<User> users = twitter.getFollowersStatuses(screenName, cursor);
- for (TwitterListener listener : listeners) {
- try {
- listener.gotFollowersStatuses(users);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void getFollowersStatuses(final long userId, final long cursor) {
- getDispatcher().invokeLater(new AsyncTask(FOLLOWERS_STATUSES, listeners) {
- public void invoke(List<TwitterListener> listeners) throws TwitterException {
- PagableResponseList<User> users = twitter.getFollowersStatuses(userId, cursor);
- for (TwitterListener listener : listeners) {
- try {
- listener.gotFollowersStatuses(users);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
/*List Methods*/
/**
@@ -1057,13 +904,6 @@ public void invoke(List<TwitterListener> listeners) throws TwitterException {
/**
* {@inheritDoc}
*/
- public void showUserList(final String listOwnerScreenName, final int listId) {
- showUserList(listId);
- }
-
- /**
- * {@inheritDoc}
- */
public void showUserList(final int listId) {
getDispatcher().invokeLater(new AsyncTask(UPDATE_USER_LIST, listeners) {
public void invoke(List<TwitterListener> listeners) throws TwitterException {
@@ -1098,20 +938,6 @@ public void invoke(List<TwitterListener> listeners) throws TwitterException {
/**
* {@inheritDoc}
*/
- public void getUserListStatuses(final String listOwnerScreenName, final int id, final Paging paging) {
- getUserListStatuses(id, paging);
- }
-
- /**
- * {@inheritDoc}
- */
- public void getUserListStatuses(final long listOwnerId, final int id, final Paging paging) {
- getUserListStatuses(id, paging);
- }
-
- /**
- * {@inheritDoc}
- */
public void getUserListStatuses(final int listId, final Paging paging) {
getDispatcher().invokeLater(new AsyncTask(USER_LIST_STATUSES, listeners) {
public void invoke(List<TwitterListener> listeners) throws TwitterException {
@@ -1247,30 +1073,6 @@ public void invoke(List<TwitterListener> listeners) throws TwitterException {
/**
* {@inheritDoc}
*/
- public void getUserListMembers(final String listOwnerScreenName, final int listId, final long cursor) {
- getDispatcher().invokeLater(new AsyncTask(LIST_MEMBERS, listeners) {
- public void invoke(List<TwitterListener> listeners) throws TwitterException {
- PagableResponseList<User> users = twitter.getUserListMembers(listOwnerScreenName, listId, cursor);
- for (TwitterListener listener : listeners) {
- try {
- listener.gotUserListMembers(users);
- } catch (Exception ignore) {
- }
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- public void getUserListMembers(final long listOwnerId, final int listId, final long cursor) {
- getUserListMembers(listId, cursor);
- }
-
- /**
- * {@inheritDoc}
- */
public void getUserListMembers(final int listId, final long cursor) {
getDispatcher().invokeLater(new AsyncTask(LIST_MEMBERS, listeners) {
public void invoke(List<TwitterListener> listeners) throws TwitterException {
@@ -1356,13 +1158,6 @@ public void invoke(List<TwitterListener> listeners) throws TwitterException {
/**
* {@inheritDoc}
*/
- public void checkUserListMembership(final String listOwnerScreenName, final int listId, final long userId) {
- showUserListMembership(listId, userId);
- }
-
- /**
- * {@inheritDoc}
- */
public void showUserListMembership(final int listId, final long userId) {
getDispatcher().invokeLater(new AsyncTask(CHECK_LIST_MEMBERSHIP, listeners) {
public void invoke(List<TwitterListener> listeners) throws TwitterException {
@@ -1382,13 +1177,6 @@ public void invoke(List<TwitterListener> listeners) throws TwitterException {
/**
* {@inheritDoc}
*/
- public void getUserListSubscribers(final String listOwnerScreenName, final int listId, final long cursor) {
- getUserListSubscribers(listId, cursor);
- }
-
- /**
- * {@inheritDoc}
- */
public void getUserListSubscribers(final int listId, final long cursor) {
getDispatcher().invokeLater(new AsyncTask(LIST_SUBSCRIBERS, listeners) {
public void invoke(List<TwitterListener> listeners) throws TwitterException {
@@ -1406,13 +1194,6 @@ public void invoke(List<TwitterListener> listeners) throws TwitterException {
/**
* {@inheritDoc}
*/
- public void subscribeUserList(final String listOwnerScreenName, final int listId) {
- createUserListSubscription(listId);
- }
-
- /**
- * {@inheritDoc}
- */
public void createUserListSubscription(final int listId) {
getDispatcher().invokeLater(new AsyncTask(SUBSCRIBE_LIST, listeners) {
public void invoke(List<TwitterListener> listeners) throws TwitterException {
@@ -1430,13 +1211,6 @@ public void invoke(List<TwitterListener> listeners) throws TwitterException {
/**
* {@inheritDoc}
*/
- public void unsubscribeUserList(final String listOwnerScreenName, final int listId) {
- destroyUserListSubscription(listId);
- }
-
- /**
- * {@inheritDoc}
- */
public void destroyUserListSubscription(final int listId) {
getDispatcher().invokeLater(new AsyncTask(UNSUBSCRIBE_LIST, listeners) {
public void invoke(List<TwitterListener> listeners) throws TwitterException {
@@ -1454,13 +1228,6 @@ public void invoke(List<TwitterListener> listeners) throws TwitterException {
/**
* {@inheritDoc}
*/
- public void checkUserListSubscription(final String listOwnerScreenName, final int listId, final long userId) {
- showUserListSubscription(listId, userId);
- }
-
- /**
- * {@inheritDoc}
- */
public void showUserListSubscription(final int listId, final long userId) {
getDispatcher().invokeLater(new AsyncTask(CHECK_LIST_SUBSCRIPTION, listeners) {
public void invoke(List<TwitterListener> listeners) throws TwitterException {
View
14 twitter4j-async/src/main/java/twitter4j/TwitterAdapter.java
@@ -53,18 +53,12 @@ public void gotWeeklyTrends(ResponseList<Trends> trendsList) {
}
/*Timeline Methods*/
- public void gotPublicTimeline(ResponseList<Status> statuses) {
- }
-
/**
* @since Twitter4J 2.0.10
*/
public void gotHomeTimeline(ResponseList<Status> statuses) {
}
- public void gotFriendsTimeline(ResponseList<Status> statuses) {
- }
-
public void gotUserTimeline(ResponseList<Status> statuses) {
}
@@ -184,11 +178,6 @@ public void gotMemberSuggestions(ResponseList<User> users) {
public void gotProfileImage(ProfileImage image) {
}
- public void gotFriendsStatuses(PagableResponseList<User> users) {
- }
-
- public void gotFollowersStatuses(PagableResponseList<User> users) {
- }
/*List Methods*/
/**
@@ -532,9 +521,6 @@ public void searchedPlaces(ResponseList<Place> places) {
public void gotSimilarPlaces(SimilarPlaces places) {
}
- public void gotNearByPlaces(ResponseList<Place> places) {
- }
-
public void gotReverseGeoCode(ResponseList<Place> places) {
}
View
20 twitter4j-async/src/main/java/twitter4j/TwitterListener.java
@@ -45,16 +45,11 @@
*/
void gotWeeklyTrends(ResponseList<Trends> trendsList);
- /*Timeline Methods*/
- void gotPublicTimeline(ResponseList<Status> statuses);
-
/**
* @since Twitter4J 2.0.10
*/
void gotHomeTimeline(ResponseList<Status> statuses);
- void gotFriendsTimeline(ResponseList<Status> statuses);
-
void gotUserTimeline(ResponseList<Status> statuses);
/**
@@ -151,11 +146,6 @@
*/
void gotProfileImage(ProfileImage image);
-
- void gotFriendsStatuses(PagableResponseList<User> users);
-
- void gotFollowersStatuses(PagableResponseList<User> users);
-
/*List Methods*/
/**
@@ -436,8 +426,6 @@
void gotSimilarPlaces(SimilarPlaces places);
- void gotNearByPlaces(ResponseList<Place> places);
-
void gotReverseGeoCode(ResponseList<Place> places);
void gotGeoDetails(Place place);
@@ -480,12 +468,7 @@
TwitterMethod WEEKLY_TRENDS = TwitterMethod.WEEKLY_TRENDS;
/*Timeline Methods*/
- TwitterMethod PUBLIC_TIMELINE = TwitterMethod.PUBLIC_TIMELINE;
TwitterMethod HOME_TIMELINE = TwitterMethod.HOME_TIMELINE;
- /**
- * @deprecated use {@link #HOME_TIMELINE} instead
- */
- TwitterMethod FRIENDS_TIMELINE = TwitterMethod.FRIENDS_TIMELINE;
TwitterMethod USER_TIMELINE = TwitterMethod.USER_TIMELINE;
TwitterMethod MENTIONS = TwitterMethod.MENTIONS;
TwitterMethod RETWEETED_BY_ME = TwitterMethod.RETWEETED_BY_ME;
@@ -512,8 +495,6 @@
TwitterMethod USER_SUGGESTIONS = TwitterMethod.USER_SUGGESTIONS;
TwitterMethod MEMBER_SUGGESTIONS = TwitterMethod.MEMBER_SUGGESTIONS;
TwitterMethod PROFILE_IMAGE = TwitterMethod.PROFILE_IMAGE;
- TwitterMethod FRIENDS_STATUSES = TwitterMethod.FRIENDS_STATUSES;
- TwitterMethod FOLLOWERS_STATUSES = TwitterMethod.FOLLOWERS_STATUSES;
/*List Methods*/
TwitterMethod CREATE_USER_LIST = TwitterMethod.CREATE_USER_LIST;
@@ -602,7 +583,6 @@
/*Geo Methods*/
TwitterMethod SEARCH_PLACES = TwitterMethod.SEARCH_PLACES;
TwitterMethod SIMILAR_PLACES = TwitterMethod.SIMILAR_PLACES;
- TwitterMethod NEAR_BY_PLACES = TwitterMethod.NEAR_BY_PLACES;
TwitterMethod REVERSE_GEO_CODE = TwitterMethod.REVERSE_GEO_CODE;
TwitterMethod GEO_DETAILS = TwitterMethod.GEO_DETAILS;
TwitterMethod CREATE_PLACE = TwitterMethod.CREATE_PLACE;
View
14 twitter4j-async/src/main/java/twitter4j/TwitterMethod.java
@@ -83,12 +83,7 @@ private Object readResolve() throws ObjectStreamException {
public static final TwitterMethod WEEKLY_TRENDS = new TwitterMethod("WEEKLY_TRENDS");
/*Timeline Methods*/
- public static final TwitterMethod PUBLIC_TIMELINE = new TwitterMethod("PUBLIC_TIMELINE");
public static final TwitterMethod HOME_TIMELINE = new TwitterMethod("HOME_TIMELINE");
- /**
- * @deprecated use {@link #HOME_TIMELINE} instead
- */
- public static final TwitterMethod FRIENDS_TIMELINE = new TwitterMethod("FRIENDS_TIMELINE");
public static final TwitterMethod USER_TIMELINE = new TwitterMethod("USER_TIMELINE");
public static final TwitterMethod MENTIONS = new TwitterMethod("MENTIONS");
public static final TwitterMethod RETWEETED_BY_ME = new TwitterMethod("RETWEETED_BY_ME");
@@ -114,14 +109,6 @@ private Object readResolve() throws ObjectStreamException {
public static final TwitterMethod PROFILE_IMAGE = new TwitterMethod("PROFILE_IMAGE");
public static final TwitterMethod USER_SUGGESTIONS = new TwitterMethod("USER_SUGGESTIONS");
public static final TwitterMethod MEMBER_SUGGESTIONS = new TwitterMethod("MEMBER_SUGGESTIONS");
- /**
- * @deprecated use {@link #FRIENDS_IDS} and {@link #LOOKUP_USERS} instead
- */
- public static final TwitterMethod FRIENDS_STATUSES = new TwitterMethod("FRIENDS_STATUSES");
- /**
- * @deprecated use {@link #FOLLOWERS_IDS} and {@link #LOOKUP_USERS} instead
- */
- public static final TwitterMethod FOLLOWERS_STATUSES = new TwitterMethod("FOLLOWERS_STATUSES");
/*List Methods*/
public static final TwitterMethod CREATE_USER_LIST = new TwitterMethod("CREATE_USER_LIST");
@@ -212,7 +199,6 @@ private Object readResolve() throws ObjectStreamException {
/*Geo Methods*/
public static final TwitterMethod SEARCH_PLACES = new TwitterMethod("SEARCH_PLACES");
public static final TwitterMethod SIMILAR_PLACES = new TwitterMethod("SIMILAR_PLACES");
- public static final TwitterMethod NEAR_BY_PLACES = new TwitterMethod("NEAR_BY_PLACES");
public static final TwitterMethod REVERSE_GEO_CODE = new TwitterMethod("REVERSE_GEO_CODE");
public static final TwitterMethod GEO_DETAILS = new TwitterMethod("GEO_DETAILS");
public static final TwitterMethod CREATE_PLACE = new TwitterMethod("CREATE_PLACE");
View
38 twitter4j-async/src/main/java/twitter4j/api/ListMembersMethodsAsync.java
@@ -20,31 +20,6 @@
* @author Joern Huxhorn - jhuxhorn at googlemail.com
*/
public interface ListMembersMethodsAsync {
- /**
- * Returns the members of the specified list.
- * <br>This method calls http://api.twitter.com/1/lists/members.json
- *
- * @param listOwnerScreenName The screen name of the list owner
- * @param listId The id of the list
- * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/members">GET lists/members | Twitter Developers</a>
- * @since Twitter4J 2.1.1
- * @deprecated use {@link #getUserListMembers(int, long)} instead
- */
- void getUserListMembers(String listOwnerScreenName, int listId, long cursor);
-
- /**
- * Returns the members of the specified list.
- * <br>This method calls http://api.twitter.com/1/lists/members.json
- *
- * @param listOwnerId The id of the list owner
- * @param listId The id of the list
- * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/members">GET lists/members | Twitter Developers</a>
- * @since Twitter4J 2.1.1
- * @deprecated use {@link #getUserListMembers(int, long)} instead
- */
- void getUserListMembers(long listOwnerId, int listId, long cursor);
/**
* Returns the members of the specified list.
@@ -105,19 +80,6 @@
* Check if a user is a member of the specified list.<br>
* <br>This method calls http://api.twitter.com/1/lists/members/show.json
*
- * @param listOwnerScreenName The screen name of the list owner
- * @param listId The id of the list.
- * @param userId The id of the user who you want to know is a member or not of the specified list.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/members/show">GET lists/members/show | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link #showUserListMembership(int, long)} instead
- */
- void checkUserListMembership(String listOwnerScreenName, int listId, long userId);
-
- /**
- * Check if a user is a member of the specified list.<br>
- * <br>This method calls http://api.twitter.com/1/lists/members/show.json
- *
* @param listId The id of the list.
* @param userId The id of the user who you want to know is a member or not of the specified list.
* @see <a href="https://dev.twitter.com/docs/api/1/get/lists/members/show">GET lists/members/show | Twitter Developers</a>
View
38 twitter4j-async/src/main/java/twitter4j/api/ListMethodsAsync.java
@@ -73,18 +73,6 @@
* Show the specified list. Private lists will only be shown if the authenticated user owns the specified list.
* <br>This method calls http://api.twitter.com/1/lists/show.json
*
- * @param listOwnerScreenName The screen name of the list owner
- * @param id The id of the list to show
- * @see <a href="https://dev.twitter.com/docs/api/1/get/:user/lists/:id">GET :user/lists/:id | Twitter Developers</a>
- * @since Twitter4J 2.1.1
- * @deprecated use {@link #showUserList(int)} instead
- */
- void showUserList(String listOwnerScreenName, int id);
-
- /**
- * Show the specified list. Private lists will only be shown if the authenticated user owns the specified list.
- * <br>This method calls http://api.twitter.com/1/lists/show.json
- *
* @param listId The id of the list to show
* @see <a href="https://dev.twitter.com/docs/api/1/get/lists/show">https://dev.twitter.com/docs/api/1/get/lists/show | Twitter Developers</a>
* @since Twitter4J 2.2.3
@@ -105,32 +93,6 @@
* Show tweet timeline for members of the specified list.
* <br>http://api.twitter.com/1/user/lists/list_id/statuses.json
*
- * @param listOwnerScreenName The screen name of the list owner
- * @param id The id of the list to delete
- * @param paging controls pagination. Supports since_id, max_id, count and page parameters.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/statuses">GET lists/statuses | Twitter Developers</a>
- * @since Twitter4J 2.1.1
- * @deprecated use {@link #getUserListStatuses(int, twitter4j.Paging)} instead
- */
- void getUserListStatuses(String listOwnerScreenName, int id, Paging paging);
-
- /**
- * Show tweet timeline for members of the specified list.
- * <br>http://api.twitter.com/1/user/lists/list_id/statuses.json
- *
- * @param listOwnerId The screen name of the list owner
- * @param id The id of the list to delete
- * @param paging controls pagination. Supports since_id, max_id, count and page parameters.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/statuses">GET lists/statuses | Twitter Developers</a>
- * @since Twitter4J 2.1.1
- * @deprecated use {@link #getUserListStatuses(int, twitter4j.Paging)} instead
- */
- void getUserListStatuses(long listOwnerId, int id, Paging paging);
-
- /**
- * Show tweet timeline for members of the specified list.
- * <br>http://api.twitter.com/1/user/lists/list_id/statuses.json
- *
* @param listId The id of the list
* @param paging controls pagination. Supports since_id, max_id, count and page parameters.
* @see <a href="https://dev.twitter.com/docs/api/1/get/lists/statuses">GET lists/statuses | Twitter Developers</a>
View
50 twitter4j-async/src/main/java/twitter4j/api/ListSubscribersMethodsAsync.java
@@ -21,18 +21,6 @@
* @author Joern Huxhorn - jhuxhorn at googlemail.com
*/
public interface ListSubscribersMethodsAsync {
- /**
- * Returns the subscribers of the specified list.
- * <br>This method calls http://api.twitter.com/1/lists/subscribers.json
- *
- * @param listOwnerScreenName The screen name of the list owner
- * @param listId The id of the list
- * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/subscribers">GET lists/subscribers | Twitter Developers</a>
- * @since Twitter4J 2.1.1
- * @deprecated use {@link #getUserListSubscribers(int, long)} instead
- */
- void getUserListSubscribers(String listOwnerScreenName, int listId, long cursor);
/**
* Returns the subscribers of the specified list.
@@ -49,18 +37,6 @@
* Make the authenticated user follow the specified list.
* <br>This method calls http://api.twitter.com/1/list/subscribers/create.json
*
- * @param listOwnerScreenName The screen name of the list owner
- * @param listId The id of the list.
- * @see <a href="https://dev.twitter.com/docs/api/1/post/lists/subscribers/create">POST lists/subscribers/create | Twitter Developers</a>
- * @since Twitter4J 2.1.1
- * @deprecated use {@link #createUserListSubscription(int)} instead
- */
- void subscribeUserList(String listOwnerScreenName, int listId);
-
- /**
- * Make the authenticated user follow the specified list.
- * <br>This method calls http://api.twitter.com/1/list/subscribers/create.json
- *
* @param listId The id of the list.
* @see <a href="https://dev.twitter.com/docs/api/1/post/lists/subscribers/create">POST lists/subscribers/create | Twitter Developers</a>
* @since Twitter4J 2.2.3
@@ -69,18 +45,6 @@
/**
* Unsubscribes the authenticated user form the specified list.
- * <br>This method calls http://api.twitter.com/1/:listOwner/:listId/subscribers.json
- *
- * @param listOwnerScreenName The screen name of the list owner
- * @param listId The id of the list.
- * @see <a href="https://dev.twitter.com/docs/api/1/post/lists/subscribers/destroy">POST lists/subscribers/destroy | Twitter Developers</a>
- * @since Twitter4J 2.1.1
- * @deprecated use {@link #destroyUserListSubscription(int)} instead
- */
- void unsubscribeUserList(String listOwnerScreenName, int listId);
-
- /**
- * Unsubscribes the authenticated user form the specified list.
* <br>This method calls http://api.twitter.com/1/subscribers/destroy.json
*
* @param listId The id of the list.
@@ -93,20 +57,6 @@
* Check if the specified user is a subscriber of the specified list.
* <br>This method calls http://api.twitter.com/1/lists/subscribers/show.json
*
- * @param listOwnerScreenName The screen name of the list owner
- * @param listId The id of the list.
- * @param userId The id of the user who you want to know is a member or not of the specified list.
- * , or the user is not a member of the specified list(TwitterException.getStatusCode() returns 404 in that case.)
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/subscribers/show">GET lists/subscribers/show | Twitter Developers</a>
- * @since Twitter4J 2.1.1
- * @deprecated use {@link #showUserListSubscription(int, long)} instead
- */
- void checkUserListSubscription(String listOwnerScreenName, int listId, long userId);
-
- /**
- * Check if the specified user is a subscriber of the specified list.
- * <br>This method calls http://api.twitter.com/1/lists/subscribers/show.json
- *
* @param listId The id of the list.
* @param userId The id of the user who you want to know is a member or not of the specified list.
* , or the user is not a member of the specified list(TwitterException.getStatusCode() returns 404 in that case.)
View
28 twitter4j-async/src/main/java/twitter4j/api/TimelineMethodsAsync.java
@@ -23,14 +23,6 @@
*/
public interface TimelineMethodsAsync {
/**
- * Returns the 20 most recent statuses from non-protected users who have set a custom user icon. The public timeline is cached for 60 seconds and requesting it more often than that is unproductive and a waste of resources.
- * <br>This method calls http://api.twitter.com/1/statuses/public_timeline
- *
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/public_timeline">GET statuses/public_timeline | Twitter Developers</a>
- */
- void getPublicTimeline();
-
- /**
* Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends. This is the equivalent of /timeline/home on the Web.<br>
* Usage note: This home_timeline call is identical to statuses/friends_timeline, except that home_timeline also contains retweets, while statuses/friends_timeline does not for backwards compatibility reasons. In a future version of the API, statuses/friends_timeline will be deprected and replaced by home_timeline.
* <br>This method calls http://api.twitter.com/1/statuses/home_timeline
@@ -51,26 +43,6 @@
*/
void getHomeTimeline(Paging paging);
-
- /**
- * Returns the 20 most recent statuses posted by the authenticating user and that user's friends. This is the equivalent of /timeline/home on the Web.
- *
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/friends_timeline">GET statuses/friends_timeline | Twitter Developers</a>
- * @deprecated use {@link #getHomeTimeline()} instead
- */
- void getFriendsTimeline();
-
- /**
- * Returns the 20 most recent statuses posted by the authenticating user and that user's friends. This is the equivalent of /timeline/home on the Web.
- * <br>This method calls http://api.twitter.com/1/statuses/friends_timeline
- *
- * @param paging controls pagination
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/friends_timeline">GET statuses/friends_timeline | Twitter Developers</a>
- * @since Twitter4J 2.0.1
- * @deprecated use {@link #getHomeTimeline(Paging)} instead
- */
- void getFriendsTimeline(Paging paging);
-
/**
* Returns the 20 most recent statuses posted from the authenticating user. It's also possible to request another user's timeline via the id parameter.<br>
* This is the equivalent of the Web / page for your own user, or the profile page for a third party.<br>
View
70 twitter4j-async/src/main/java/twitter4j/api/UserMethodsAsync.java
@@ -116,74 +116,4 @@
* @since Twitter4J 2.1.7
*/
void getProfileImage(String screenName, ProfileImage.ImageSize size);
-
- /**
- * Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.)
- * <br>This method calls http://api.twitter.com/1/statuses/friends
- *
- * @param cursor Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/friends">GET statuses/friends | Twitter Developers</a>
- * @since Twitter4J 2.0.9
- * @deprecated use {@link FriendsFollowersMethodsAsync#getFriendsIDs(long)} and {@link UserMethodsAsync#lookupUsers(long[])} instead
- */
- void getFriendsStatuses(long cursor);
-
- /**
- * Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.)
- * <br>This method calls http://api.twitter.com/1/statuses/friends
- *
- * @param screenName the screen name of the user for whom to request a list of friends
- * @param cursor Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/friends">GET statuses/friends | Twitter Developers</a>
- * @since Twitter4J 2.0.9
- * @deprecated use {@link FriendsFollowersMethodsAsync#getFriendsIDs(String, long)} and {@link UserMethodsAsync#lookupUsers(long[])} instead
- */
- void getFriendsStatuses(String screenName, long cursor);
-
- /**
- * Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.)
- * <br>This method calls http://api.twitter.com/1/statuses/friends
- *
- * @param userId the screen name of the user for whom to request a list of friends
- * @param cursor Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/friends">GET statuses/friends | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link FriendsFollowersMethodsAsync#getFriendsIDs(long, long)} and {@link UserMethodsAsync#lookupUsers(long[])} instead
- */
- void getFriendsStatuses(long userId, long cursor);
-
- /**
- * Returns the authenticating user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed).
- * <br>This method calls http://api.twitter.com/1/statuses/followers.json
- *
- * @param cursor Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/followers">GET statuses/followers | Twitter Developers</a>
- * @since Twitter4J 2.0.9
- * @deprecated use {@link FriendsFollowersMethodsAsync#getFollowersIDs(long)} and {@link UserMethodsAsync#lookupUsers(long[])} instead
- */
- void getFollowersStatuses(long cursor);
-
- /**
- * Returns the specified user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed).
- * <br>This method calls http://api.twitter.com/1/statuses/followers.json
- *
- * @param screenName The screen name of the user for whom to request a list of followers.
- * @param cursor Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/followers">GET statuses/followers | Twitter Developers</a>
- * @since Twitter4J 2.0.9
- * @deprecated use {@link FriendsFollowersMethodsAsync#getFollowersIDs(String, long)} and {@link UserMethodsAsync#lookupUsers(long[])} instead
- */
- void getFollowersStatuses(String screenName, long cursor);
-
- /**
- * Returns the specified user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed).
- * <br>This method calls http://api.twitter.com/1/statuses/followers.json
- *
- * @param userId The ID of the user for whom to request a list of followers.
- * @param cursor Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/followers">GET statuses/followers | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link FriendsFollowersMethodsAsync#getFollowersIDs(long, long)} and {@link UserMethodsAsync#lookupUsers(long[])} instead
- */
- void getFollowersStatuses(long userId, long cursor);
}
View
38 twitter4j-async/src/test/java/twitter4j/AsyncTwitterTest.java
@@ -77,13 +77,6 @@ protected void tearDown() throws Exception {
super.tearDown();
}
- public void testGetPublicTimeline() throws Exception {
- async1.getPublicTimeline();
- waitForResponse();
- Assert.assertTrue("size", 0 < statuses.size());
- assertDeserializedFormIsEqual(statuses);
- }
-
public void testShowUser() throws Exception {
async1.showUser(id1.screenName);
waitForResponse();
@@ -418,11 +411,6 @@ public void searched(QueryResult result) {
notifyResponse();
}
- public void gotTrends(Trends trends) {
- this.trends = trends;
- notifyResponse();
- }
-
public void gotCurrentTrends(Trends trends) {
this.trends = trends;
notifyResponse();
@@ -439,21 +427,11 @@ public void gotWeeklyTrends(ResponseList<Trends> trendsList) {
}
/*Timeline Methods*/
- public void gotPublicTimeline(ResponseList<Status> statuses) {
- this.statuses = statuses;
- notifyResponse();
- }
-
public void gotHomeTimeline(ResponseList<Status> statuses) {
this.statuses = statuses;
notifyResponse();
}
- public void gotFriendsTimeline(ResponseList<Status> statuses) {
- this.statuses = statuses;
- notifyResponse();
- }
-
public void gotUserTimeline(ResponseList<Status> statuses) {
this.statuses = statuses;
notifyResponse();
@@ -584,16 +562,6 @@ public void gotProfileImage(ProfileImage image) {
notifyResponse();
}
- public void gotFriendsStatuses(PagableResponseList<User> users) {
- this.users = users;
- notifyResponse();
- }
-
- public void gotFollowersStatuses(PagableResponseList<User> users) {
- this.users = users;
- notifyResponse();
- }
-
/*List Methods*/
public void createdUserList(UserList userList) {
@@ -931,12 +899,6 @@ public void gotSimilarPlaces(SimilarPlaces places) {
notifyResponse();
}
-
- public void gotNearByPlaces(ResponseList<Place> places) {
- this.places = places;
- notifyResponse();
- }
-
public void gotReverseGeoCode(ResponseList<Place> places) {
this.places = places;
notifyResponse();
View
8 twitter4j-core/pom.xml
@@ -100,6 +100,12 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>com.googlecode</groupId>
+ <artifactId>kryo</artifactId>
+ <version>1.04</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.8</version>
@@ -116,7 +122,7 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <version>1.2.9</version>
+ <version>[1.2.9,)</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
View
5 twitter4j-core/src/main/java/twitter4j/GeoLocation.java
@@ -37,6 +37,11 @@ public GeoLocation(double latitude, double longitude) {
this.latitude = latitude;
this.longitude = longitude;
}
+
+ /* For serialization purposes only. */
+ /* package */ GeoLocation() {
+
+ }
/**
* returns the latitude of the geo location
View
3 twitter4j-core/src/main/java/twitter4j/Status.java
@@ -24,14 +24,13 @@
* @author Yusuke Yamamoto - yusuke at mac.com
*/
public interface Status extends Comparable<Status>, TwitterResponse,
- EntitySupport, java.io.Serializable {
+ EntitySupport, Twt, java.io.Serializable {
/**
* Return the created_at
*
* @return created_at
* @since Twitter4J 1.1.0
*/
-
Date getCreatedAt();
/**
View
25 twitter4j-core/src/main/java/twitter4j/Tweet.java
@@ -23,7 +23,7 @@
*
* @author Yusuke Yamamoto - yusuke at mac.com
*/
-public interface Tweet extends Comparable<Tweet>, EntitySupport,
+public interface Tweet extends Comparable<Tweet>, EntitySupport, Twt,
java.io.Serializable {
/**
* returns the text
@@ -47,13 +47,28 @@
String getToUser();
/**
+ * returns the to_user_name
+ *
+ * @return the to_user_name value or null if to_user is not specified by the tweet
+ */
+ String getToUserName();
+
+ /**
* returns the from_user
*
* @return the from_user
*/
String getFromUser();
/**
+ * returns the from_user_name
+ *
+ * @return the from_user_name
+ * @since Twitter4J 2.2.6
+ */
+ String getFromUserName();
+
+ /**
* returns the status id of the tweet
*
* @return the status id
@@ -84,6 +99,14 @@
String getSource();
/**
+ * Returns the in_reply_tostatus_id
+ *
+ * @return the in_reply_tostatus_id
+ * @since Twitter4J 2.2.6
+ */
+ long getInReplyToStatusId();
+
+ /**
* returns the profile_image_url
*
* @return the profile_image_url
View
11 twitter4j-core/src/main/java/twitter4j/TwitterAPIMonitor.java
@@ -44,11 +44,11 @@
// https?:\/\/[^\/]+\/([a-zA-Z_\.]*).*
// finds the "method" part a Twitter REST API url, ignoring member-specific resource names
private static final Pattern pattern =
- Pattern.compile("https?:\\/\\/[^\\/]+\\/([a-zA-Z_\\.]*).*");
+ Pattern.compile("https?:\\/\\/[^\\/]+\\/\\d+\\/([a-zA-Z_\\.]*).*");
private static final TwitterAPIMonitor SINGLETON = new TwitterAPIMonitor();
- private final APIStatistics STATISTICS = new APIStatistics(100);
+ private static final APIStatistics STATISTICS = new APIStatistics(100);
static {
@@ -70,13 +70,12 @@
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
- APIStatistics statsMBean = new APIStatistics(100);
if (isJDK14orEarlier) {
ObjectName oName = new ObjectName("twitter4j.mbean:type=APIStatistics");
- mbs.registerMBean(statsMBean, oName);
+ mbs.registerMBean(STATISTICS, oName);
} else {
ObjectName oName = new ObjectName("twitter4j.mbean:type=APIStatisticsOpenMBean");
- APIStatisticsOpenMBean openMBean = new APIStatisticsOpenMBean(statsMBean);
+ APIStatisticsOpenMBean openMBean = new APIStatisticsOpenMBean(STATISTICS);
mbs.registerMBean(openMBean, oName);
}
} catch (InstanceAlreadyExistsException e) {
@@ -111,7 +110,7 @@ public APIStatisticsMBean getStatistics() {
void methodCalled(String twitterUrl, long elapsedTime, boolean success) {
Matcher matcher = pattern.matcher(twitterUrl);
if (matcher.matches() && matcher.groupCount() > 0) {
- String method = matcher.group();
+ String method = matcher.group(1);
STATISTICS.methodCalled(method, elapsedTime, success);
}
}
View
167 twitter4j-core/src/main/java/twitter4j/TwitterImpl.java
@@ -145,15 +145,6 @@ private String toDateStr(Date date) {
/**
* {@inheritDoc}
*/
- public ResponseList<Status> getPublicTimeline() throws
- TwitterException {
- return factory.createStatusList(get(conf.getRestBaseURL() +
- "statuses/public_timeline.json?include_my_retweet=1&include_entities=" + conf.isIncludeEntitiesEnabled() + "&include_rts=" + conf.isIncludeRTsEnabled()));
- }
-
- /**
- * {@inheritDoc}
- */
public ResponseList<Status> getHomeTimeline() throws
TwitterException {
ensureAuthorizationEnabled();
@@ -173,31 +164,6 @@ private String toDateStr(Date date) {
/**
* {@inheritDoc}
*/
- public ResponseList<Status> getFriendsTimeline() throws
- TwitterException {
- ensureAuthorizationEnabled();
- return factory.createStatusList(get(conf.getRestBaseURL()
- + "statuses/friends_timeline.json?include_my_retweet=1&include_entities="
- + conf.isIncludeEntitiesEnabled() + "&include_rts=" + conf.isIncludeRTsEnabled()));
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("deprecation")
- public ResponseList<Status> getFriendsTimeline(Paging paging) throws
- TwitterException {
- ensureAuthorizationEnabled();
- return factory.createStatusList(get(conf.getRestBaseURL()
- + "statuses/friends_timeline.json",
- mergeParameters(new HttpParameter[]{INCLUDE_RTS, INCLUDE_ENTITIES, INCLUDE_MY_RETWEET}
- , paging.asPostParameterArray())));
- }
-
-
- /**
- * {@inheritDoc}
- */
public ResponseList<Status> getUserTimeline(String screenName, Paging paging)
throws TwitterException {
return factory.createStatusList(get(conf.getRestBaseURL()
@@ -499,7 +465,6 @@ public User showUser(long userId) throws TwitterException {
* {@inheritDoc}
*/
public ResponseList<User> lookupUsers(String[] screenNames) throws TwitterException {
- ensureAuthorizationEnabled();
return factory.createUserList(get(conf.getRestBaseURL() +
"users/lookup.json", new HttpParameter[]{
new HttpParameter("screen_name", z_T4JInternalStringUtil.join(screenNames))
@@ -510,7 +475,6 @@ public User showUser(long userId) throws TwitterException {
* {@inheritDoc}
*/
public ResponseList<User> lookupUsers(long[] ids) throws TwitterException {
- ensureAuthorizationEnabled();
return factory.createUserList(get(conf.getRestBaseURL() +
"users/lookup.json", new HttpParameter[]{
new HttpParameter("user_id", z_T4JInternalStringUtil.join(ids))
@@ -564,62 +528,6 @@ public ProfileImage getProfileImage(String screenName, ProfileImage.ImageSize si
+ screenName + ".json?size=" + size.getName()));
}
- /**
- * {@inheritDoc}
- */
- public PagableResponseList<User> getFriendsStatuses(long cursor) throws TwitterException {
- return factory.createPagableUserList(get(conf.getRestBaseURL()
- + "statuses/friends.json?include_entities="
- + conf.isIncludeEntitiesEnabled() + "&cursor=" + cursor));
- }
-
- /**
- * {@inheritDoc}
- */
- public PagableResponseList<User> getFriendsStatuses(String screenName, long cursor) throws TwitterException {
- return factory.createPagableUserList(get(conf.getRestBaseURL()
- + "statuses/friends.json?include_entities="
- + conf.isIncludeEntitiesEnabled() + "&screen_name=" + screenName + "&cursor="
- + cursor));
- }
-
- /**
- * {@inheritDoc}
- */
- public PagableResponseList<User> getFriendsStatuses(long userId, long cursor) throws TwitterException {
- return factory.createPagableUserList(get(conf.getRestBaseURL()
- + "statuses/friends.json?include_entities="
- + conf.isIncludeEntitiesEnabled() + "&user_id=" + userId
- + "&cursor=" + cursor));
- }
-
- /**
- * {@inheritDoc}
- */
- public PagableResponseList<User> getFollowersStatuses(long cursor) throws TwitterException {
- return factory.createPagableUserList(get(conf.getRestBaseURL()
- + "statuses/followers.json?include_entities="
- + conf.isIncludeEntitiesEnabled() + "&cursor=" + cursor));
- }
-
- /**
- * {@inheritDoc}
- */
- public PagableResponseList<User> getFollowersStatuses(String screenName, long cursor) throws TwitterException {
- return factory.createPagableUserList(get(conf.getRestBaseURL()
- + "statuses/followers.json?include_entities="
- + conf.isIncludeEntitiesEnabled() + "&screen_name=" + screenName + "&cursor=" + cursor));
- }
-
- /**
- * {@inheritDoc}
- */
- public PagableResponseList<User> getFollowersStatuses(long userId, long cursor) throws TwitterException {
- return factory.createPagableUserList(get(conf.getRestBaseURL()
- + "statuses/followers.json?include_entities="
- + conf.isIncludeEntitiesEnabled() + "&user_id=" + userId + "&cursor=" + cursor));
- }
-
/*List Methods*/
/**
@@ -671,13 +579,6 @@ public UserList updateUserList(int listId, String newListName, boolean isPublicL
/**
* {@inheritDoc}
*/
- public UserList showUserList(String listOwnerScreenName, int id) throws TwitterException {
- return showUserList(id);
- }
-
- /**
- * {@inheritDoc}
- */
public UserList showUserList(int listId) throws TwitterException {
return factory.createAUserList(get(conf.getRestBaseURL() + "lists/show.json?list_id="
+ listId));
@@ -696,20 +597,6 @@ public UserList destroyUserList(int listId) throws TwitterException {
/**
* {@inheritDoc}
*/
- public ResponseList<Status> getUserListStatuses(String listOwnerScreenName, int id, Paging paging) throws TwitterException {
- return getUserListStatuses(id, paging);
- }
-
- /**
- * {@inheritDoc}
- */
- public ResponseList<Status> getUserListStatuses(long listOwnerId, int id, Paging paging) throws TwitterException {
- return getUserListStatuses(id, paging);
- }
-
- /**
- * {@inheritDoc}
- */
public ResponseList<Status> getUserListStatuses(int listId, Paging paging) throws TwitterException {
return factory.createStatusList(get(conf.getRestBaseURL() + "lists/statuses.json", mergeParameters(paging.asPostParameterArray(Paging.SMCP, Paging.PER_PAGE)
, new HttpParameter[]{new HttpParameter("list_id", listId),
@@ -795,22 +682,6 @@ public UserList destroyUserList(int listId) throws TwitterException {
/**
* {@inheritDoc}
*/
- public PagableResponseList<User> getUserListMembers(String listOwnerScreenName, int listId
- , long cursor) throws TwitterException {
- return getUserListMembers(listId, cursor);
- }
-
- /**
- * {@inheritDoc}
- */
- public PagableResponseList<User> getUserListMembers(long listOwnerId, int listId
- , long cursor) throws TwitterException {
- return getUserListMembers(listId, cursor);
- }
-
- /**
- * {@inheritDoc}
- */
public PagableResponseList<User> getUserListMembers(int listId
, long cursor) throws TwitterException {
return factory.createPagableUserList(get(conf.getRestBaseURL() +
@@ -869,13 +740,6 @@ public UserList deleteUserListMember(int listId, long userId) throws TwitterExce
/**
* {@inheritDoc}
*/
- public User checkUserListMembership(String listOwnerScreenName, int listId, long userId) throws TwitterException {
- return showUserListMembership(listId, userId);
- }
-
- /**
- * {@inheritDoc}
- */
public User showUserListMembership(int listId, long userId) throws TwitterException {
ensureAuthorizationEnabled();
return factory.createUser(get(conf.getRestBaseURL() +
@@ -889,14 +753,6 @@ public User showUserListMembership(int listId, long userId) throws TwitterExcept
/**
* {@inheritDoc}
*/
- public PagableResponseList<User> getUserListSubscribers(String listOwnerScreenName
- , int listId, long cursor) throws TwitterException {
- return getUserListSubscribers(listId, cursor);
- }
-
- /**
- * {@inheritDoc}
- */
public PagableResponseList<User> getUserListSubscribers(int listId, long cursor) throws TwitterException {
return factory.createPagableUserList(get(conf.getRestBaseURL() +
"lists/subscribers.json?list_id=" + listId + "&include_entities="
@@ -906,15 +762,6 @@ public User showUserListMembership(int listId, long userId) throws TwitterExcept
/**
* {@inheritDoc}
*/
- public UserList subscribeUserList(String listOwnerScreenName, int listId) throws TwitterException {
- ensureAuthorizationEnabled();
- return factory.createAUserList(post(conf.getRestBaseURL() + listOwnerScreenName +
- "/" + listId + "/subscribers.json"));
- }
-
- /**
- * {@inheritDoc}
- */
public UserList createUserListSubscription(int listId) throws TwitterException {
ensureAuthorizationEnabled();
return factory.createAUserList(post(conf.getRestBaseURL() +
@@ -925,13 +772,6 @@ public UserList createUserListSubscription(int listId) throws TwitterException {
/**
* {@inheritDoc}
*/
- public UserList unsubscribeUserList(String listOwnerScreenName, int listId) throws TwitterException {
- return destroyUserListSubscription(listId);
- }
-
- /**
- * {@inheritDoc}
- */
public UserList destroyUserListSubscription(int listId) throws TwitterException {
ensureAuthorizationEnabled();
return factory.createAUserList(post(conf.getRestBaseURL() +
@@ -942,13 +782,6 @@ public UserList destroyUserListSubscription(int listId) throws TwitterException
/**
* {@inheritDoc}
*/
- public User checkUserListSubscription(String listOwnerScreenName, int listId, long userId) throws TwitterException {
- return showUserListSubscription(listId, userId);
- }
-
- /**
- * {@inheritDoc}
- */
public User showUserListSubscription(int listId, long userId) throws TwitterException {
ensureAuthorizationEnabled();
return factory.createUser(get(conf.getRestBaseURL() +
View
73 twitter4j-core/src/main/java/twitter4j/Twt.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2007 Yusuke Yamamoto
+ *
+ * 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 twitter4j;
+
+import java.util.Date;
+
+/**
+ * @author Yusuke Yamamoto - yusuke at mac.com
+ * @since Twitter4J 2.2.6
+ */
+public interface Twt {
+ /**
+ * returns the created_at
+ *
+ * @return the created_at
+ */
+ Date getCreatedAt();
+
+ /**
+ * returns the status id of the tweet
+ *
+ * @return the status id
+ */
+ long getId();
+
+ /**
+ * returns the text
+ *
+ * @return the text
+ */
+ String getText();
+
+ /**
+ * returns the source of the tweet
+ *
+ * @return the source of the tweet
+ */
+ String getSource();
+
+ /**
+ * Returns the in_reply_tostatus_id
+ *
+ * @return the in_reply_tostatus_id
+ */
+ long getInReplyToStatusId();
+
+ /**
+ * Returns the place associated with the Tweet.
+ *
+ * @return The place associated with the Tweet
+ */
+ Place getPlace();
+
+ /**
+ * Returns The location that this tweet refers to if available.
+ *
+ * @return returns The location that this tweet refers to if available (can be null)
+ */
+ GeoLocation getGeoLocation();
+}
View
49 twitter4j-core/src/main/java/twitter4j/api/ListMembersMethods.java
@@ -29,38 +29,6 @@
* Returns the members of the specified list.
* <br>This method calls http://api.twitter.com/1/lists/members.json
*
- * @param listOwnerScreenName The screen name of the list owner
- * @param listId The id of the list
- * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @return the members of the specified list.
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/members">GET lists/members | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link #getUserListMembers(int, long)} instead
- */
- PagableResponseList<User> getUserListMembers(String listOwnerScreenName, int listId, long cursor)
- throws TwitterException;
-
- /**
- * Returns the members of the specified list.
- * <br>This method calls http://api.twitter.com/1/lists/members.json
- *
- * @param listOwnerId The id of the list owner
- * @param listId The id of the list
- * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @return the members of the specified list.
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/:user/:list_id/members">GET :user/:list_id/members | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link #getUserListMembers(int, long)} instead
- */
- PagableResponseList<User> getUserListMembers(long listOwnerId, int listId, long cursor)
- throws TwitterException;
-
- /**
- * Returns the members of the specified list.
- * <br>This method calls http://api.twitter.com/1/lists/members.json
- *
* @param listId The id of the list
* @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
* @return the members of the specified list.
@@ -124,23 +92,6 @@ UserList deleteUserListMember(int listId, long userId)
* Check if a user is a member of the specified list.<br>
* <br>This method calls http://api.twitter.com/1/lists/members/show.json
*
- * @param listOwnerScreenName The screen name of the list owner
- * @param listId The id of the list.
- * @param userId The id of the user who you want to know is a member or not of the specified list.
- * @return the updated list
- * @throws TwitterException when Twitter service or network is unavailable
- * , or the user is not a member of the specified list(TwitterException.getStatusCode() returns 404 in that case.)
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/members/show">GET lists/members/show | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link #showUserListMembership(int, long)} instead
- */
- User checkUserListMembership(String listOwnerScreenName, int listId, long userId)
- throws TwitterException;
-
- /**
- * Check if a user is a member of the specified list.<br>
- * <br>This method calls http://api.twitter.com/1/lists/members/show.json
- *
* @param listId The id of the list.
* @param userId The id of the user who you want to know is a member or not of the specified list.
* @return the updated list
View
47 twitter4j-core/src/main/java/twitter4j/api/ListMethods.java
@@ -90,21 +90,6 @@ UserList updateUserList(int listId, String newListName, boolean isPublicList, St
* Show the specified list. Private lists will only be shown if the authenticated user owns the specified list.
* <br>This method calls http://api.twitter.com/1/lists/show.json
*
- * @param listOwnerScreenName The screen name of the list owner
- * @param id The id of the list to show
- * @return the specified list
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/show">https://dev.twitter.com/docs/api/1/get/lists/show | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link #showUserList(int)} instead
- */
- UserList showUserList(String listOwnerScreenName, int id)
- throws TwitterException;
-
- /**
- * Show the specified list. Private lists will only be shown if the authenticated user owns the specified list.
- * <br>This method calls http://api.twitter.com/1/lists/show.json
- *
* @param listId The id of the list to show
* @return the specified list
* @throws TwitterException when Twitter service or network is unavailable
@@ -129,38 +114,6 @@ UserList showUserList(String listOwnerScreenName, int id)
* Show tweet timeline for members of the specified list.
* <br>http://api.twitter.com/1/user/lists/list_id/statuses.json
*
- * @param listOwnerScreenName The screen name of the list owner
- * @param id The id of the list
- * @param paging controls pagination. Supports since_id, max_id, count and page parameters.
- * @return list of statuses for members of the specified list
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/statuses">GET lists/statuses | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link #getUserListStatuses(int, twitter4j.Paging)} instead
- */
- ResponseList<Status> getUserListStatuses(String listOwnerScreenName, int id, Paging paging)
- throws TwitterException;
-
- /**
- * Show tweet timeline for members of the specified list.
- * <br>http://api.twitter.com/1/user/lists/list_id/statuses.json
- *
- * @param listOwnerId The id of the list owner
- * @param id The id of the list
- * @param paging controls pagination. Supports since_id, max_id, count and page parameters.
- * @return list of statuses for members of the specified list
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/statuses">GET lists/statuses | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link #getUserListStatuses(int, twitter4j.Paging)} instead
- */
- ResponseList<Status> getUserListStatuses(long listOwnerId, int id, Paging paging)
- throws TwitterException;
-
- /**
- * Show tweet timeline for members of the specified list.
- * <br>http://api.twitter.com/1/user/lists/list_id/statuses.json
- *
* @param listId The id of the list
* @param paging controls pagination. Supports since_id, max_id, count and page parameters.
* @return list of statuses for members of the specified list
View
63 twitter4j-core/src/main/java/twitter4j/api/ListSubscribersMethods.java
@@ -29,22 +29,6 @@
* Returns the subscribers of the specified list.
* <br>This method calls http://api.twitter.com/1/lists/subscribers.json
*
- * @param listOwnerScreenName The screen name of the list owner
- * @param listId The id of the list
- * @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @return the members of the specified list.
- * @throws twitter4j.TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/subscribers">GET lists/subscribers | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link #getUserListSubscribers(int, long)} instead
- */
- PagableResponseList<User> getUserListSubscribers(String listOwnerScreenName, int listId, long cursor)
- throws TwitterException;
-
- /**
- * Returns the subscribers of the specified list.
- * <br>This method calls http://api.twitter.com/1/lists/subscribers.json
- *
* @param listId The id of the list
* @param cursor Breaks the results into pages. A single page contains 20 lists. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
* @return the members of the specified list.
@@ -59,21 +43,6 @@
* Make the authenticated user follow the specified list.
* <br>This method calls http://api.twitter.com/1/list/subscribers/create.json
*
- * @param listOwnerScreenName The screen name of the list owner
- * @param listId The id of the list.
- * @return the updated list
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/post/lists/subscribers/create">POST lists/subscribers/create | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link #createUserListSubscription(int)} instead
- */
- UserList subscribeUserList(String listOwnerScreenName, int listId)
- throws TwitterException;
-
- /**
- * Make the authenticated user follow the specified list.
- * <br>This method calls http://api.twitter.com/1/list/subscribers/create.json
- *
* @param listId The id of the list.
* @return the updated list
* @throws TwitterException when Twitter service or network is unavailable
@@ -84,21 +53,6 @@ UserList subscribeUserList(String listOwnerScreenName, int listId)
/**
* Unsubscribes the authenticated user form the specified list.
- * <br>This method calls http://api.twitter.com/1/:listOwner/:listId/subscribers.json
- *
- * @param listOwnerScreenName The screen name of the list owner
- * @param listId The id of the list.
- * @return the updated list
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/post/lists/subscribers/destroy">POST lists/subscribers/destroy | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated user {@link #destroyUserListSubscription(int)} instead
- */
- UserList unsubscribeUserList(String listOwnerScreenName, int listId)
- throws TwitterException;
-
- /**
- * Unsubscribes the authenticated user form the specified list.
* <br>This method calls http://api.twitter.com/1/subscribers/destroy.json
*
* @param listId The id of the list.
@@ -113,23 +67,6 @@ UserList unsubscribeUserList(String listOwnerScreenName, int listId)
* Check if the specified user is a subscriber of the specified list.
* <br>This method calls http://api.twitter.com/1/lists/subscribers/show.json
*
- * @param listOwnerScreenName The screen name of the list owner
- * @param listId The id of the list.
- * @param userId The id of the user who you want to know is a member or not of the specified list.
- * @return the updated list
- * @throws TwitterException when Twitter service or network is unavailable
- * , or the user is not a member of the specified list(TwitterException.getStatusCode() returns 404 in that case.)
- * @see <a href="https://dev.twitter.com/docs/api/1/get/lists/subscribers/show">GET lists/subscribers/show | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link #showUserListSubscription(int, long)} instead
- */
- User checkUserListSubscription(String listOwnerScreenName, int listId, long userId)
- throws TwitterException;
-
- /**
- * Check if the specified user is a subscriber of the specified list.
- * <br>This method calls http://api.twitter.com/1/lists/subscribers/show.json
- *
* @param listId The id of the list.
* @param userId The id of the user who you want to know is a member or not of the specified list.
* @return the updated list
View
35 twitter4j-core/src/main/java/twitter4j/api/TimelineMethods.java
@@ -26,16 +26,6 @@
*/
public interface TimelineMethods {
/**
- * Returns the 20 most recent statuses from non-protected users who have set a custom user icon. The public timeline is cached for 60 seconds and requesting it more often than that is unproductive and a waste of resources.
- * <br>This method calls http://api.twitter.com/1/statuses/public_timeline
- *
- * @return list of statuses of the Public Timeline
- * @throws twitter4j.TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/public_timeline">GET statuses/public_timeline | Twitter Developers</a>
- */
- ResponseList<Status> getPublicTimeline() throws TwitterException;
-
- /**
* Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends. This is the equivalent of /timeline/home on the Web.<br>
* Usage note: This home_timeline call is identical to statuses/friends_timeline, except that home_timeline also contains retweets, while statuses/friends_timeline does not for backwards compatibility reasons. In a future version of the API, statuses/friends_timeline will be deprected and replaced by home_timeline.
* <br>This method calls http://api.twitter.com/1/statuses/home_timeline
@@ -62,31 +52,6 @@
ResponseList<Status> getHomeTimeline(Paging paging) throws TwitterException;
/**
- * Returns the 20 most recent statuses posted by the authenticating user and that user's friends. This is the equivalent of /timeline/home on the Web.
- * <br>This method calls http://api.twitter.com/1/statuses/friends_timeline
- *
- * @return list of the Friends Timeline
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/friends_timeline">GET statuses/friends_timeline | Twitter Developers</a>
- * @deprecated use {@link #getHomeTimeline()} instead
- */
- ResponseList<Status> getFriendsTimeline() throws TwitterException;
-
- /**
- * Returns the 20 most recent statuses posted by the authenticating user and that user's friends. This is the equivalent of /timeline/home on the Web.
- * <br>This method calls http://api.twitter.com/1/statuses/friends_timeline
- *
- * @param paging controls pagination. Supports since_id, max_id, count and page parameters.
- * @return list of the Friends Timeline
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/friends_timeline">GET statuses/friends_timeline | Twitter Developers</a>
- * @since Twitter4J 2.0.1
- * @deprecated use {@link #getHomeTimeline(twitter4j.Paging)} instead
- */
- ResponseList<Status> getFriendsTimeline(Paging paging) throws TwitterException;
-
-
- /**
* Returns the 20 most recent statuses posted from the authenticating user. It's also possible to request another user's timeline via the id parameter.<br>
* This is the equivalent of the Web / page for your own user, or the profile page for a third party.<br>
* For backwards compatibility reasons, retweets are stripped out of the user_timeline when calling in XML or JSON (they appear with 'RT' in RSS and Atom). If you'd like them included, you can merge them in from statuses retweeted_by_me.<br>
View
88 twitter4j-core/src/main/java/twitter4j/api/UserMethods.java
@@ -137,92 +137,4 @@
* @since Twitter4J 2.1.7
*/
ProfileImage getProfileImage(String screenName, ProfileImage.ImageSize size) throws TwitterException;
-
- /**
- * Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.)
- * <br>This method calls http://api.twitter.com/1/statuses/friends.json
- *
- * @param cursor Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @return the list of friends
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/friends">GET statuses/friends | Twitter Developers</a>
- * @since Twitter4J 2.0.9
- * @deprecated use {@link FriendsFollowersMethods#getFriendsIDs(long)} and {@link UserMethods#lookupUsers(long[])} instead
- */
- PagableResponseList<User> getFriendsStatuses(long cursor)
- throws TwitterException;
-
- /**
- * Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.)
- * <br>This method calls http://api.twitter.com/1/statuses/friends.json
- *
- * @param screenName the screen name of the user for whom to request a list of friends
- * @param cursor Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @return the list of friends
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/friends">GET statuses/friends | Twitter Developers</a>
- * @since Twitter4J 2.0.9
- * @deprecated use {@link FriendsFollowersMethods#getFriendsIDs(String, long)} and {@link UserMethods#lookupUsers(long[])} instead
- */
- PagableResponseList<User> getFriendsStatuses(String screenName, long cursor)
- throws TwitterException;
-
- /**
- * Returns a user's friends, each with current status inline. They are ordered by the order in which the user followed them, most recently followed first, 100 at a time. (Please note that the result set isn't guaranteed to be 100 every time as suspended users will be filtered out.)
- * <br>This method calls http://api.twitter.com/1/statuses/friends.json
- *
- * @param userId the ID of the user for whom to request a list of friends
- * @param cursor Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @return the list of friends
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/friends">GET statuses/friends | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link FriendsFollowersMethods#getFriendsIDs(long, long)} and {@link UserMethods#lookupUsers(long[])} instead
- */
- PagableResponseList<User> getFriendsStatuses(long userId, long cursor)
- throws TwitterException;
-
- /**
- * Returns the authenticating user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed).
- * <br>This method calls http://api.twitter.com/1/statuses/followers.json
- *
- * @param cursor Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @return List
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/followers">GET statuses/followers | Twitter Developers</a>
- * @since Twitter4J 2.0.9
- * @deprecated use {@link FriendsFollowersMethods#getFollowersIDs(long)} and {@link UserMethods#lookupUsers(long[])} instead
- */
- PagableResponseList<User> getFollowersStatuses(long cursor)
- throws TwitterException;
-
- /**
- * Returns the specified user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed).
- * <br>This method calls http://api.twitter.com/1/statuses/followers.json
- *
- * @param screenName The screen name of the user for whom to request a list of followers.
- * @param cursor Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @return List
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/followers">GET statuses/followers | Twitter Developers</a>
- * @since Twitter4J 2.0.9
- * @deprecated use {@link FriendsFollowersMethods#getFollowersIDs(String, long)} and {@link UserMethods#lookupUsers(long[])} instead
- */
- PagableResponseList<User> getFollowersStatuses(String screenName, long cursor)
- throws TwitterException;
-
- /**
- * Returns the specified user's followers, each with current status inline. They are ordered by the order in which they joined Twitter (this is going to be changed).
- * <br>This method calls http://api.twitter.com/1/statuses/followers.json
- *
- * @param userId The ID of the user for whom to request a list of followers.
- * @param cursor Breaks the results into pages. A single page contains 100 users. This is recommended for users who are followed by many other users. Provide a value of -1 to begin paging. Provide values as returned to in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
- * @return List
- * @throws TwitterException when Twitter service or network is unavailable
- * @see <a href="https://dev.twitter.com/docs/api/1/get/statuses/followers">GET statuses/followers | Twitter Developers</a>
- * @since Twitter4J 2.1.0
- * @deprecated use {@link FriendsFollowersMethods#getFollowersIDs(long, long)} and {@link UserMethods#lookupUsers(long[])} instead
- */
- PagableResponseList<User> getFollowersStatuses(long userId, long cursor)
- throws TwitterException;
}
View
4 twitter4j-core/src/main/java/twitter4j/conf/ConfigurationBase.java 100644 → 100755
@@ -98,7 +98,7 @@
private static final String DEFAULT_SEARCH_BASE_URL = "http://search.twitter.com/";
private static final String DEFAULT_STREAM_BASE_URL = "https://stream.twitter.com/1/";
private static final String DEFAULT_USER_STREAM_BASE_URL = "https://userstream.twitter.com/2/";
- private static final String DEFAULT_SITE_STREAM_BASE_URL = "https://sitestream.twitter.com/2b/";
+ private static final String DEFAULT_SITE_STREAM_BASE_URL = "https://sitestream.twitter.com";
private static final String DEFAULT_UPLOAD_BASE_URL = "http://upload.twitter.com/1/";
private boolean IS_DALVIK;
@@ -182,7 +182,7 @@ protected ConfigurationBase() {
setDispatcherImpl("twitter4j.internal.async.DispatcherImpl");
setIncludeRTsEnbled(true);
- setUserStreamRepliesAllEnabled(true);
+ setUserStreamRepliesAllEnabled(false);
String isDalvik;
try {
isDalvik = System.getProperty(DALVIK, dalvikDetected);
View
2 twitter4j-core/src/main/java/twitter4j/internal/http/HttpClientImpl.java
@@ -248,7 +248,7 @@ private void setHeaders(HttpRequest req, HttpURLConnection connection) {
}
}
- private HttpURLConnection getConnection(String url) throws IOException {
+ protected HttpURLConnection getConnection(String url) throws IOException {
HttpURLConnection con;
if (isProxyConfigured() && !isJDK14orEarlier) {
if (CONF.getHttpProxyUser() != null && !CONF.getHttpProxyUser().equals("")) {
View
6 twitter4j-core/src/main/java/twitter4j/internal/http/HttpResponse.java
@@ -148,6 +148,9 @@ public JSONObject asJSONObject() throws TwitterException {
}
if (CONF.isPrettyDebugEnabled()) {
logger.debug(json.toString(1));
+ } else {
+ logger.debug(responseAsString != null ? responseAsString :
+ json.toString());
}
} catch (JSONException jsone) {
if (responseAsString == null) {
@@ -189,6 +192,9 @@ public JSONArray asJSONArray() throws TwitterException {
}
if (CONF.isPrettyDebugEnabled()) {
logger.debug(jsonArray.toString(1));
+ } else {
+ logger.debug(responseAsString != null ? responseAsString :
+ jsonArray.toString());
}
} catch (JSONException jsone) {
if (logger.isDebugEnabled()) {
View
2 twitter4j-core/src/main/java/twitter4j/internal/http/HttpResponseImpl.java
@@ -38,7 +38,7 @@
}
if (is != null && "gzip".equals(con.getContentEncoding())) {
// the response is gzipped
- is = new GZIPInputStream(is);
+ is = new StreamingGZIPInputStream(is);
}
}
View
47 twitter4j-core/src/main/java/twitter4j/internal/http/StreamingGZIPInputStream.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2007 Yusuke Yamamoto
+ * Copyright 2012 Twitter, Inc.
+ *
+ * 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 twitter4j.internal.http;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.GZIPInputStream;
+
+final class StreamingGZIPInputStream extends GZIPInputStream {
+
+ private final InputStream wrapped;
+
+ public StreamingGZIPInputStream(InputStream is) throws IOException {
+ super(is);
+ wrapped = is;
+ }
+
+ /**
+ * Overrides behavior of GZIPInputStream which assumes we have all the data available
+ * which is not true for streaming. We instead rely on the underlying stream to tell us
+ * how much data is available.
+ * <p>