Class JsonPipelineExceptionHandlers

    • Method Detail

      • rethrow404

        public static JsonPipelineExceptionHandler rethrow404​(RuntimeException exceptionToThrow)
        Creates an exception handling function that will throw the given exception if the exception being caught has a status code of 404 (and otherwise rethrow the original exception )
        Parameters:
        exceptionToThrow - the error message
        Returns:
        a function that will throw a new JsonPipelineInputException if status code is 404
      • rethrow50x

        public static JsonPipelineExceptionHandler rethrow50x​(RuntimeException exceptionToThrow)
        Creates an exception handling function that will throw the given exception if the exception being caught has a status code >= 500 (and otherwise rethrow the original exception )
        Parameters:
        exceptionToThrow - the error message
        Returns:
        a function that will throw a new JsonPipelineInputException if status code is 404
      • fallbackFor404

        public static JsonPipelineExceptionHandler fallbackFor404​(com.fasterxml.jackson.databind.JsonNode fallbackContent,
                                                                  int timeToLive)
        Creates an exception handling function that will provide static fallback content if the exception being caught has a status code of 404 (and otherwise rethrow the original exception )
        Parameters:
        fallbackContent - the fallback content to return
        timeToLive - the duration in seconds for which the fallback response is allowed to be cached
        Returns:
        a function that will throw a new JsonPipelineInputException if status code is 404
      • fallbackFor50x

        public static JsonPipelineExceptionHandler fallbackFor50x​(com.fasterxml.jackson.databind.JsonNode fallbackContent,
                                                                  int timeToLive)
        Creates an exception handling function that will provide static fallback content if the exception being caught has a status code > 500 (and otherwise rethrow the original exception )
        Parameters:
        fallbackContent - the fallback content to return
        timeToLive - the duration in seconds for which the fallback response is allowed to be cached
        Returns:
        a function that will throw a new JsonPipelineInputException if status code is 404