Package graphql.kickstart.servlet.cache
Class CachedResponse
- java.lang.Object
-
- graphql.kickstart.servlet.cache.CachedResponse
-
- All Implemented Interfaces:
java.io.Serializable
public class CachedResponse extends java.lang.Object implements java.io.Serializable- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getContentBytes()java.lang.StringgetErrorMessage()java.lang.IntegergetErrorStatusCode()booleanisError()static CachedResponseofContent(byte[] contentBytes)Constructor for success responsestatic CachedResponseofError(int errorStatusCode, java.lang.String errorMessage)Constructor for error response
-
-
-
Method Detail
-
ofContent
public static CachedResponse ofContent(byte[] contentBytes)
Constructor for success response- Parameters:
contentBytes- bytes array of graphql json response
-
ofError
public static CachedResponse ofError(int errorStatusCode, java.lang.String errorMessage)
Constructor for error response- Parameters:
errorStatusCode- the status code for the error responseerrorMessage- the error message for the error response
-
isError
public boolean isError()
- Returns:
- true when this request was failed
-
getContentBytes
public byte[] getContentBytes()
- Returns:
- the response body for success requests, null when
isError()is true
-
getErrorStatusCode
public java.lang.Integer getErrorStatusCode()
- Returns:
- the response error code
-
getErrorMessage
public java.lang.String getErrorMessage()
- Returns:
- the response error message
-
-