Search in sources :

Example 1 with AuthenticationException

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();
    }
}
Also used : JSONWriter(org.json.JSONWriter) ServletException(javax.servlet.ServletException) ServiceException(com.google.gdata.util.ServiceException) AuthenticationException(com.google.gdata.util.AuthenticationException) JSONException(org.json.JSONException) JSONWriter(org.json.JSONWriter) Writer(java.io.Writer)

Aggregations

AuthenticationException (com.google.gdata.util.AuthenticationException)1 ServiceException (com.google.gdata.util.ServiceException)1 Writer (java.io.Writer)1 ServletException (javax.servlet.ServletException)1 JSONException (org.json.JSONException)1 JSONWriter (org.json.JSONWriter)1