http://www.google.com/support/forum/p/apps-apis/thread?tid=4bb738c51e61e3ba&hl=en
Steps to reproduce issue:
Steps to reproduce issue:
1. Using the following Code:
package test;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.lang.String;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.gdata.data.spreadsheet.*;
import com.google.gdata.client.authn.oauth.*;
import com.google.gdata.client.spreadsheet.SpreadsheetService;
@SuppressWarnings("serial")
public class GetDataAsXML extends HttpServlet
{
/**
*
*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException
{
getDataAsXML(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
{
getDataAsXML(request, response);
}
public void getDataAsXML(HttpServletRequest request, HttpServletResponse response) throws IOException
{
/** Variable declaration */
StringBuffer xml = new StringBuffer();
/** Pass credentials to use the service */
try
{
String CONSUMER_KEY = "example.com";
String CONSUMER_SECRET = "abc123doremi";
GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
oauthParameters.setOAuthConsumerKey(CONSUMER_KEY);
oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET);
/** Pass credentials to use the service */
SpreadsheetService myService = new SpreadsheetService("test-application-1");
myService.setOAuthCredentials(oauthParameters, new OAuthHmacSha1Signer());
String user = "test.user@" + CONSUMER_KEY;
URL metafeedUrl = new URL("http://spreadsheets.google.com/feeds/spreadsheets/private/full?xoauth_requestor_id=" + user);
SpreadsheetFeed feed = myService.getFeed(metafeedUrl, SpreadsheetFeed.class);
List<SpreadsheetEntry> spreadsheets = feed.getEntries();
for (int i = 0; i < spreadsheets.size(); i++) {
SpreadsheetEntry entry = spreadsheets.get(i);
System.out.println("\t" + entry.getTitle().getPlainText());
}
}
catch (Exception e)
{
System.out.println("Exception while running Google query: " + e);
return;
}
}
}
Expected output:
List of spreadsheets
Actual results:
Receiving an HTTP 404 Error
Комментариев нет:
Отправить комментарий