From f76fee63ed9cb3a30d3c0c092d860b1cb93a481b Mon Sep 17 00:00:00 2001
From: Gerard Smyth <gerard.smyth@gmail.com>
Date: Thu, 08 May 2014 13:09:30 -0400
Subject: [PATCH] Updated the SyndicationServlet to provide an additional option to return details of the tags in the repository instead of the commits. This uses a new 'ot' request parameter to indicate the object type of the content to return, which can be ither TAG or COMMIT. If this is not provided, then COMMIT is assumed to maintain backwards compatability. If tags are returned, then the paging parameters, 'l' and 'pg' are still supported, but searching options are currently ignored.

---
 src/main/java/com/gitblit/utils/JsonUtils.java |   36 +++++++++++++++++++-----------------
 1 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/src/main/java/com/gitblit/utils/JsonUtils.java b/src/main/java/com/gitblit/utils/JsonUtils.java
index e924182..be7148c 100644
--- a/src/main/java/com/gitblit/utils/JsonUtils.java
+++ b/src/main/java/com/gitblit/utils/JsonUtils.java
@@ -54,9 +54,9 @@
 
 /**
  * Utility methods for json calls to a Gitblit server.
- * 
+ *
  * @author James Moger
- * 
+ *
  */
 public class JsonUtils {
 
@@ -68,7 +68,7 @@
 
 	/**
 	 * Creates JSON from the specified object.
-	 * 
+	 *
 	 * @param o
 	 * @return json
 	 */
@@ -79,7 +79,7 @@
 
 	/**
 	 * Convert a json string to an object of the specified type.
-	 * 
+	 *
 	 * @param json
 	 * @param clazz
 	 * @return an object
@@ -90,7 +90,7 @@
 
 	/**
 	 * Convert a json string to an object of the specified type.
-	 * 
+	 *
 	 * @param json
 	 * @param clazz
 	 * @return an object
@@ -101,7 +101,7 @@
 
 	/**
 	 * Reads a gson object from the specified url.
-	 * 
+	 *
 	 * @param url
 	 * @param type
 	 * @return the deserialized object
@@ -114,7 +114,7 @@
 
 	/**
 	 * Reads a gson object from the specified url.
-	 * 
+	 *
 	 * @param url
 	 * @param type
 	 * @return the deserialized object
@@ -127,7 +127,7 @@
 
 	/**
 	 * Reads a gson object from the specified url.
-	 * 
+	 *
 	 * @param url
 	 * @param type
 	 * @param username
@@ -146,7 +146,7 @@
 
 	/**
 	 * Reads a gson object from the specified url.
-	 * 
+	 *
 	 * @param url
 	 * @param clazz
 	 * @param username
@@ -165,7 +165,7 @@
 
 	/**
 	 * Retrieves a JSON message.
-	 * 
+	 *
 	 * @param url
 	 * @return the JSON message as a string
 	 * @throws {@link IOException}
@@ -205,7 +205,7 @@
 
 	/**
 	 * Sends a JSON message.
-	 * 
+	 *
 	 * @param url
 	 *            the url to write to
 	 * @param json
@@ -219,7 +219,7 @@
 
 	/**
 	 * Sends a JSON message.
-	 * 
+	 *
 	 * @param url
 	 *            the url to write to
 	 * @param json
@@ -274,10 +274,10 @@
 		return builder.create();
 	}
 
-	private static class GmtDateTypeAdapter implements JsonSerializer<Date>, JsonDeserializer<Date> {
+	public static class GmtDateTypeAdapter implements JsonSerializer<Date>, JsonDeserializer<Date> {
 		private final DateFormat dateFormat;
 
-		private GmtDateTypeAdapter() {
+		public GmtDateTypeAdapter() {
 			dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
 			dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
 		}
@@ -296,7 +296,7 @@
 				JsonDeserializationContext jsonDeserializationContext) {
 			try {
 				synchronized (dateFormat) {
-					Date date = dateFormat.parse(jsonElement.getAsString());					
+					Date date = dateFormat.parse(jsonElement.getAsString());
 					return new Date((date.getTime() / 1000) * 1000);
 				}
 			} catch (ParseException e) {
@@ -304,7 +304,7 @@
 			}
 		}
 	}
-	
+
 	private static class AccessPermissionTypeAdapter implements JsonSerializer<AccessPermission>, JsonDeserializer<AccessPermission> {
 
 		private AccessPermissionTypeAdapter() {
@@ -319,7 +319,7 @@
 		@Override
 		public synchronized AccessPermission deserialize(JsonElement jsonElement, Type type,
 				JsonDeserializationContext jsonDeserializationContext) {
-			return AccessPermission.fromCode(jsonElement.getAsString());					
+			return AccessPermission.fromCode(jsonElement.getAsString());
 		}
 	}
 
@@ -334,10 +334,12 @@
 			this.fieldName = fqfn.substring(fqfn.lastIndexOf(".") + 1);
 		}
 
+		@Override
 		public boolean shouldSkipClass(Class<?> arg0) {
 			return false;
 		}
 
+		@Override
 		public boolean shouldSkipField(FieldAttributes f) {
 			return (f.getDeclaringClass() == c && f.getName().equals(fieldName));
 		}

--
Gitblit v1.9.1