From 4b430b4b02e96f0257fb70f1aacab1269b0c2aec Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Sun, 16 Oct 2011 08:43:52 -0400
Subject: [PATCH] Users JList to JTable. Fixed indicator tooltip. Users Tab.
---
src/com/gitblit/utils/JsonUtils.java | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/com/gitblit/utils/JsonUtils.java b/src/com/gitblit/utils/JsonUtils.java
index 3834c8e..fee7990 100644
--- a/src/com/gitblit/utils/JsonUtils.java
+++ b/src/com/gitblit/utils/JsonUtils.java
@@ -157,6 +157,25 @@
}
return gson().fromJson(json, type);
}
+
+ /**
+ * Reads a gson object from the specified url.
+ *
+ * @param url
+ * @param clazz
+ * @param username
+ * @param password
+ * @return the deserialized object
+ * @throws {@link IOException}
+ */
+ public static <X> X retrieveJson(String url, Class<X> clazz, String username, char[] password)
+ throws IOException {
+ String json = retrieveJsonString(url, username, password);
+ if (StringUtils.isEmpty(json)) {
+ return null;
+ }
+ return gson().fromJson(json, clazz);
+ }
/**
* Retrieves a JSON message.
--
Gitblit v1.9.1