diff options
author | James Moger <james.moger@gitblit.com> | 2011-10-12 22:14:10 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2011-10-12 22:14:10 -0400 |
commit | da0269b4bd57bf90877446d9f991247bc1ad2f64 (patch) | |
tree | 96033518957a9d91c831c994033c2be22f7cfadf /src/com/gitblit/utils/JsonUtils.java | |
parent | 13b8381bf7082778df572e7918599a41917bfcca (diff) | |
download | gitblit-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.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 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.
|