use of com.google.gdata.util.AuthenticationException in project OpenRefine by OpenRefine.
the class GDataImportingController method doListDocuments.
private void doListDocuments(HttpServletRequest request, HttpServletResponse response, Properties parameters) throws ServletException, IOException {
String token = TokenCookie.getToken(request);
if (token == null) {
HttpUtilities.respond(response, "error", "Not authorized");
return;
}
Writer w = response.getWriter();
JSONWriter writer = new JSONWriter(w);
try {
writer.object();
writer.key("documents");
writer.array();
try {
listSpreadsheets(GDataExtension.getDocsService(token), writer);
listFusionTables(FusionTableHandler.getFusionTablesService(token), writer);
} catch (AuthenticationException e) {
TokenCookie.deleteToken(request, response);
} catch (ServiceException e) {
e.printStackTrace();
} finally {
writer.endArray();
writer.endObject();
}
} catch (JSONException e) {
throw new ServletException(e);
} finally {
w.flush();
w.close();
}
}
Aggregations