summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/utils/JsonUtils.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2011-10-12 22:14:10 -0400
committerJames Moger <james.moger@gitblit.com>2011-10-12 22:14:10 -0400
commitda0269b4bd57bf90877446d9f991247bc1ad2f64 (patch)
tree96033518957a9d91c831c994033c2be22f7cfadf /src/com/gitblit/utils/JsonUtils.java
parent13b8381bf7082778df572e7918599a41917bfcca (diff)
downloadgitblit-da0269b4bd57bf90877446d9f991247bc1ad2f64.tar.gz
gitblit-da0269b4bd57bf90877446d9f991247bc1ad2f64.zip
RPC Client: Create/Edit Repository & User. Partially working.
Added new request type to retrieve Gitblit settings to implement the password preferences (minLength, storage type) and federation sets.
Diffstat (limited to 'src/com/gitblit/utils/JsonUtils.java')
-rw-r--r--src/com/gitblit/utils/JsonUtils.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/gitblit/utils/JsonUtils.java b/src/com/gitblit/utils/JsonUtils.java
index 3834c8ed..fee79901 100644
--- a/src/com/gitblit/utils/JsonUtils.java
+++ b/src/com/gitblit/utils/JsonUtils.java
@@ -157,6 +157,25 @@ public class JsonUtils {
}
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.