3

これが私の機能です:

public String uploadImage(URL image,String message) throws Exception{
    HashMap<String,String> paramArgs=new HashMap<String,String>();
    paramArgs.put("fbImgPostURL","https://graph.facebook.com/me/photos");
    paramArgs.put("accessToken",accessGrant.getKey());
    paramArgs.put("imageURL",image.toString());
    paramArgs.put("message",message);
    return HttpPictureUpload.uploadImageViaHttpPost(paramArgs);
}

そして、intelliJデバッガーからデバッグしている間、奇妙なことに

paramArgs.put("accessToken",accessGrant.getKey());

明らかに鍵はaccessToken. しかし、デバッガーは次のように表示します。 スクリーンショット

access_token=CAACKan8suD0BAKUZAyxLinmXw2PZAkmkhIhVZCojG1sE2QsW60CfQjZAJWyMbqc1Lxy1JmVmSyAU4eHOGSkHhqJSQE6tcORuXAkyFbok7WGyysgJYZC6QF6KZBPRwDwbPCE6JUJgKIGyXzZCfzVgnjHHuoZBLZBt2xXgZD

明らかに問題は、別のキー名を設定していることですが、ハッシュマップでは、実際に渡される別のキー名が設定されています

HttpPictureUpload.uploadImageViaHttpPost(paramArgs);

ここにいる誰でも、何が起こっているのか推測できますか?

編集: ここに私のuploadImageViaHttpPost()機能があります:

public static String uploadImageViaHttpPost(HashMap<String,String> keyParams){

    String in="Image Uploaded Successfully!!";
    try {
        HttpClient client = new HttpClient();
        PostMethod method = new PostMethod(keyParams.get("fbImgPostURL"));

        //Add any parameter if u want to send it with Post req.
        method.addParameter("accessToken", keyParams.get("accessToken"));
        method.addParameter("url",keyParams.get("imageURL"));
        method.addParameter("message",keyParams.get("message"));

        int statusCode = client.executeMethod(method);

        if (statusCode != -1) {
            in = method.getResponseBodyAsString();
        }

        System.out.println(in);

    } catch (Exception e) {
        e.printStackTrace();
    }
    return in;
}
4

0 に答える 0