Allow error responses from REST API to be cached

Change-Id: I45986c287f244a1a4b53ea623258255e29dbacb5
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2013-07-08 16:34:36 +02:00
parent 872cd35978
commit fe228a7258
4 changed files with 38 additions and 21 deletions

View File

@@ -17,6 +17,7 @@ package com.google.gerrit.extensions.restapi;
/** Root exception type for JSON API failures. */
public abstract class RestApiException extends Exception {
private static final long serialVersionUID = 1L;
private CacheControl caching = CacheControl.NONE;
public RestApiException() {
}
@@ -28,4 +29,14 @@ public abstract class RestApiException extends Exception {
public RestApiException(String msg, Throwable cause) {
super(msg, cause);
}
public CacheControl caching() {
return caching;
}
@SuppressWarnings("unchecked")
public <T extends RestApiException> T caching(CacheControl c) {
caching = c;
return (T) this;
}
}