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:
		@@ -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;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user