I can get the response from Google API's via web browser. It is say,

Access to 

https://www.googleapis.com/blogger/v3/blogs/4871538073781423026?access_token=XXXXXXXX

by some web browser, and get response

{
 "kind": "blogger#blog",
 "id": "4871538073781423026",
 "name": "SoffeeShop",
 "description": "",
 "published": "2012-10-24T23:55:32+09:00",
 "updated": "2015-03-04T14:31:00+09:00",
 "url": "http://soffeeshop.blogspot.com/";,
 "selfLink": "https://www.googleapis.com/blogger/v3/blogs/4871538073781423026";,
 "posts": {
  "totalItems": 58,
  "selfLink": 
"https://www.googleapis.com/blogger/v3/blogs/4871538073781423026/posts";
 },
 "pages": {
  "totalItems": 0,
  "selfLink": 
"https://www.googleapis.com/blogger/v3/blogs/4871538073781423026/pages";
 },
 "locale": {
  "language": "en",
  "country": "",
  "variant": ""
 }
}


Although, when I do REST in the servlet in GAE, like


URL url = new 
URL("https://www.googleapis.com/blogger/v3/blogs/4871538073781423026?access_token=XXXXXXXXX";);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("X-Appengine-Inbound-Appid", "XXXXX");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Host", "googleapis.com");


or


URL url = new 
URL("https://www.googleapis.com/blogger/v3/blogs/4871538073781423026);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");

connection.setRequestProperty("Authorization", "Bearer " + access_token); 

connection.setRequestProperty("X-Appengine-Inbound-Appid", "XXXXX"); 
connection.setRequestProperty("Accept", "application/json"); 
connection.setRequestProperty("Host", "googleapis.com");


i just got "404 Not Found" Error. 


I could get access_token with OAuth2 using HttpURLConnection in the same 
servlet in GAE, just could not do access to google API's. So, it's mean Http 
Connections are working well to access to other servers.


Why I could not access only Google API's via servlet in GAE? Please help me...


-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/4cc66720-67fc-4789-ac77-841018066f47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to