Permalink
Browse files

issue# (TFJ-737)

Using API1.1 verify credentials URL if possible.
  • Loading branch information...
1 parent 94d89b0 commit 8f9774394b2cbc565e910bda7cd4800afcabce04 @ApplePedlar ApplePedlar committed Dec 20, 2012
@@ -35,8 +35,12 @@
* @since Twitter4J 2.1.8
*/
abstract class AbstractImageUploadImpl implements ImageUpload {
- public static final String TWITTER_VERIFY_CREDENTIALS_JSON = "https://api.twitter.com/1/account/verify_credentials.json";
- public static final String TWITTER_VERIFY_CREDENTIALS_XML = "https://api.twitter.com/1/account/verify_credentials.xml";
+ @Deprecated
+ public static final String TWITTER_VERIFY_CREDENTIALS_JSON_V1 = "https://api.twitter.com/1/account/verify_credentials.json";
+ @Deprecated
+ public static final String TWITTER_VERIFY_CREDENTIALS_XML_V1 = "https://api.twitter.com/1/account/verify_credentials.xml";
+
+ public static final String TWITTER_VERIFY_CREDENTIALS_JSON_V1_1 = "https://api.twitter.com/1.1/account/verify_credentials.json";
private HttpClientWrapper client;
@@ -56,9 +56,9 @@ protected String postUpload() throws TwitterException {
@Override
protected void preUpload() throws TwitterException {
uploadUrl = "http://img.ly/api/2/upload.json";
- String verifyCredentialsAuthorizationHeader = generateVerifyCredentialsAuthorizationHeader(TWITTER_VERIFY_CREDENTIALS_JSON);
+ String verifyCredentialsAuthorizationHeader = generateVerifyCredentialsAuthorizationHeader(TWITTER_VERIFY_CREDENTIALS_JSON_V1_1);
- headers.put("X-Auth-Service-Provider", TWITTER_VERIFY_CREDENTIALS_JSON);
+ headers.put("X-Auth-Service-Provider", TWITTER_VERIFY_CREDENTIALS_JSON_V1_1);
headers.put("X-Verify-Credentials-Authorization", verifyCredentialsAuthorizationHeader);
HttpParameter[] params = {this.image};
@@ -57,9 +57,9 @@ protected String postUpload() throws TwitterException {
@Override
protected void preUpload() throws TwitterException {
uploadUrl = "https://api.mobypicture.com/2.0/upload.json";
- String verifyCredentialsAuthorizationHeader = generateVerifyCredentialsAuthorizationHeader(TWITTER_VERIFY_CREDENTIALS_JSON);
+ String verifyCredentialsAuthorizationHeader = generateVerifyCredentialsAuthorizationHeader(TWITTER_VERIFY_CREDENTIALS_JSON_V1_1);
- headers.put("X-Auth-Service-Provider", TWITTER_VERIFY_CREDENTIALS_JSON);
+ headers.put("X-Auth-Service-Provider", TWITTER_VERIFY_CREDENTIALS_JSON_V1_1);
headers.put("X-Verify-Credentials-Authorization", verifyCredentialsAuthorizationHeader);
if (null == apiKey) {
@@ -56,9 +56,9 @@ protected String postUpload() throws TwitterException {
@Override
protected void preUpload() throws TwitterException {
- String verifyCredentialsAuthorizationHeader = generateVerifyCredentialsAuthorizationHeader(TWITTER_VERIFY_CREDENTIALS_XML);
+ String verifyCredentialsAuthorizationHeader = generateVerifyCredentialsAuthorizationHeader(TWITTER_VERIFY_CREDENTIALS_XML_V1);
- headers.put("X-Auth-Service-Provider", TWITTER_VERIFY_CREDENTIALS_XML);
+ headers.put("X-Auth-Service-Provider", TWITTER_VERIFY_CREDENTIALS_XML_V1);
headers.put("X-Verify-Credentials-Authorization", verifyCredentialsAuthorizationHeader);
if (null == apiKey) {
@@ -57,9 +57,9 @@ protected String postUpload() throws TwitterException {
@Override
protected void preUpload() throws TwitterException {
uploadUrl = "http://posterous.com/api2/upload.json";
- String verifyCredentialsAuthorizationHeader = generateVerifyCredentialsAuthorizationHeader(TWITTER_VERIFY_CREDENTIALS_JSON);
+ String verifyCredentialsAuthorizationHeader = generateVerifyCredentialsAuthorizationHeader(TWITTER_VERIFY_CREDENTIALS_JSON_V1);
- headers.put("X-Auth-Service-Provider", TWITTER_VERIFY_CREDENTIALS_JSON);
+ headers.put("X-Auth-Service-Provider", TWITTER_VERIFY_CREDENTIALS_JSON_V1);
headers.put("X-Verify-Credentials-Authorization", verifyCredentialsAuthorizationHeader);
HttpParameter[] params = {this.image};
@@ -53,7 +53,7 @@ protected String postUpload() throws TwitterException {
@Override
protected void preUpload() throws TwitterException {
uploadUrl = "http://p.twipple.jp/api/upload";
- String signedVerifyCredentialsURL = generateVerifyCredentialsAuthorizationURL(TWITTER_VERIFY_CREDENTIALS_XML);
+ String signedVerifyCredentialsURL = generateVerifyCredentialsAuthorizationURL(TWITTER_VERIFY_CREDENTIALS_JSON_V1_1);
this.postParameter = new HttpParameter[]{
new HttpParameter("verify_url", signedVerifyCredentialsURL),
@@ -67,9 +67,9 @@ protected String postUpload() throws TwitterException {
@Override
protected void preUpload() throws TwitterException {
uploadUrl = "http://twitgoo.com/api/uploadAndPost";
- String verifyCredentialsAuthorizationHeader = generateVerifyCredentialsAuthorizationHeader(TWITTER_VERIFY_CREDENTIALS_JSON);
+ String verifyCredentialsAuthorizationHeader = generateVerifyCredentialsAuthorizationHeader(TWITTER_VERIFY_CREDENTIALS_JSON_V1);
- headers.put("X-Auth-Service-Provider", TWITTER_VERIFY_CREDENTIALS_JSON);
+ headers.put("X-Auth-Service-Provider", TWITTER_VERIFY_CREDENTIALS_JSON_V1);
headers.put("X-Verify-Credentials-Authorization", verifyCredentialsAuthorizationHeader);
HttpParameter[] params = {
@@ -58,9 +58,9 @@ protected String postUpload() throws TwitterException {
@Override
protected void preUpload() throws TwitterException {
uploadUrl = "https://twitpic.com/api/2/upload.json";
- String verifyCredentialsAuthorizationHeader = generateVerifyCredentialsAuthorizationHeader(TWITTER_VERIFY_CREDENTIALS_JSON);
+ String verifyCredentialsAuthorizationHeader = generateVerifyCredentialsAuthorizationHeader(TWITTER_VERIFY_CREDENTIALS_JSON_V1_1);
- headers.put("X-Auth-Service-Provider", TWITTER_VERIFY_CREDENTIALS_JSON);
+ headers.put("X-Auth-Service-Provider", TWITTER_VERIFY_CREDENTIALS_JSON_V1_1);
headers.put("X-Verify-Credentials-Authorization", verifyCredentialsAuthorizationHeader);
if (null == apiKey) {
@@ -57,7 +57,7 @@ protected String postUpload() throws TwitterException {
@Override
protected void preUpload() throws TwitterException {
uploadUrl = "https://yfrog.com/api/upload";
- String signedVerifyCredentialsURL = generateVerifyCredentialsAuthorizationURL(TWITTER_VERIFY_CREDENTIALS_XML);
+ String signedVerifyCredentialsURL = generateVerifyCredentialsAuthorizationURL(TWITTER_VERIFY_CREDENTIALS_XML_V1);
Twitter tw = new TwitterFactory().getInstance(this.oauth);
HttpParameter[] params = {

0 comments on commit 8f97743

Please sign in to comment.