org.springframework.cloud.dataflow.server.controller

## Class RestControllerAdvice

- java.lang.Object
- - org.springframework.cloud.dataflow.server.controller.RestControllerAdvice

-     @ControllerAdvice
      public class RestControllerAdvice
      extends Object

  Apply common behavior (exception handling etc.,) to all the REST controllers.
  Author:
    Eric Bottard, Gunnar Hillert, Ilayaperumal Gopinathan, Christian Tzolov

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RestControllerAdvice()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.springframework.hateoas.mediatype.vnderrors.VndErrors` | `onClientGenericBadRequest(Exception e)` Client did not formulate a correct request.
    `org.springframework.hateoas.mediatype.vnderrors.VndErrors` | `onConflictException(Exception e)` Log the exception message at warn level and stack trace as trace level.
    `org.springframework.hateoas.mediatype.vnderrors.VndErrors` | `onConstraintViolationException(javax.validation.ConstraintViolationException e)` The exception handler is trigger if a JSR303 `ConstraintViolationException` is being raised.
    `org.springframework.hateoas.mediatype.vnderrors.VndErrors` | `onException(Exception e)` Handles the general error case.
    `org.springframework.hateoas.mediatype.vnderrors.VndErrors` | `onNotFoundException(Exception e)` Log the exception message at warn level and stack trace as trace level.
    `org.springframework.hateoas.mediatype.vnderrors.VndErrors` | `onUnprocessableEntityException(Exception e)` Log the exception message at warn level and stack trace as trace level.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RestControllerAdvice

          public RestControllerAdvice()

  - ### Method Detail

    - #### onException

          @ExceptionHandler(value=java.lang.Exception.class)
           @ResponseStatus(value=INTERNAL_SERVER_ERROR)
           @ResponseBody
          public org.springframework.hateoas.mediatype.vnderrors.VndErrors onException(Exception e)

      Handles the general error case. Log track trace at error level
      Parameters:
        `e` - the exception not handled by other exception handler methods
      Returns:
        the error response in JSON format with media type application/vnd.error+json

    - #### onConflictException

          @ExceptionHandler(value={AppAlreadyRegisteredException.class,DuplicateStreamDefinitionException.class,DuplicateTaskException.class,StreamAlreadyDeployedException.class,StreamAlreadyDeployingException.class,UnregisterAppException.class,InvalidCTRLaunchRequestException.class})
           @ResponseStatus(value=CONFLICT)
           @ResponseBody
          public org.springframework.hateoas.mediatype.vnderrors.VndErrors onConflictException(Exception e)

      Log the exception message at warn level and stack trace as trace level. Return response status HttpStatus.CONFLICT
      Parameters:
        `e` - one of the exceptions, `AppAlreadyRegisteredException`, `DuplicateStreamDefinitionException`, `DuplicateTaskException`, `StreamAlreadyDeployedException`, `StreamAlreadyDeployingException`, or `StreamAlreadyDeployingException`
      Returns:
        the error response in JSON format with media type application/vnd.error+json

    - #### onUnprocessableEntityException

          @ExceptionHandler(value={JobNotRestartableException.class,org.springframework.batch.core.launch.JobExecutionNotRunningException.class})
           @ResponseStatus(value=UNPROCESSABLE_ENTITY)
           @ResponseBody
          public org.springframework.hateoas.mediatype.vnderrors.VndErrors onUnprocessableEntityException(Exception e)

      Log the exception message at warn level and stack trace as trace level. Return response status HttpStatus.UNPROCESSABLE_ENTITY
      Parameters:
        `e` - one of the exceptions, `JobNotRestartableException` or `JobExecutionNotRunningException`
      Returns:
        the error response in JSON format with media type application/vnd.error+json

    - #### onNotFoundException

          @ExceptionHandler(value={NoSuchAuditRecordException.class,NoSuchStreamDefinitionException.class,NoSuchAppRegistrationException.class,NoSuchTaskDefinitionException.class,NoSuchTaskExecutionException.class,org.springframework.batch.core.launch.NoSuchJobExecutionException.class,org.springframework.batch.core.launch.NoSuchJobInstanceException.class,org.springframework.batch.core.launch.NoSuchJobException.class,NoSuchStepExecutionException.class,NoSuchTaskBatchException.class,NoSuchAppException.class,NoSuchAppInstanceException.class,NoSuchScheduleException.class})
           @ResponseStatus(value=NOT_FOUND)
           @ResponseBody
          public org.springframework.hateoas.mediatype.vnderrors.VndErrors onNotFoundException(Exception e)

      Log the exception message at warn level and stack trace as trace level. Return response status HttpStatus.NOT_FOUND
      Parameters:
        `e` - one of the exceptions, `NoSuchAuditRecordException`, `NoSuchStreamDefinitionException`, `NoSuchAppRegistrationException`, `NoSuchTaskDefinitionException`, `NoSuchTaskExecutionException`, `NoSuchJobExecutionException`, `NoSuchJobInstanceException`, `NoSuchJobException`, `NoSuchStepExecutionException`, `NoSuchAppException`, or `NoSuchAppInstanceException`
      Returns:
        the error response in JSON format with media type application/vnd.error+json

    - #### onClientGenericBadRequest

          @ExceptionHandler(value={org.springframework.web.bind.MissingServletRequestParameterException.class,org.springframework.http.converter.HttpMessageNotReadableException.class,org.springframework.web.bind.UnsatisfiedServletRequestParameterException.class,org.springframework.web.method.annotation.MethodArgumentTypeMismatchException.class,InvalidDateRangeException.class,CannotDeleteNonParentTaskExecutionException.class,InvalidStreamDefinitionException.class,org.springframework.cloud.deployer.spi.scheduler.CreateScheduleException.class,OffsetOutOfBoundsException.class,TaskExecutionMissingExternalIdException.class,TaskQueryParamException.class,InvalidApplicationNameException.class})
           @ResponseStatus(value=BAD_REQUEST)
           @ResponseBody
          public org.springframework.hateoas.mediatype.vnderrors.VndErrors onClientGenericBadRequest(Exception e)

      Client did not formulate a correct request. Log the exception message at warn level and stack trace as trace level. Return response status HttpStatus.BAD_REQUEST (400).
      Parameters:
        `e` - one of the exceptions, `MissingServletRequestParameterException`, `UnsatisfiedServletRequestParameterException`, `MethodArgumentTypeMismatchException`, `InvalidStreamDefinitionException` or `InvalidApplicationNameException`
      Returns:
        the error response in JSON format with media type application/vnd.error+json

    - #### onConstraintViolationException

          @ExceptionHandler(value=javax.validation.ConstraintViolationException.class)
           @ResponseStatus(value=BAD_REQUEST)
           @ResponseBody
          public org.springframework.hateoas.mediatype.vnderrors.VndErrors onConstraintViolationException(javax.validation.ConstraintViolationException e)

      The exception handler is trigger if a JSR303 `ConstraintViolationException` is being raised.

      Log the exception message at warn level and stack trace as trace level. Return response status HttpStatus.BAD_REQUEST (400).

      Parameters:
        `e` - the exceptions, `ConstraintViolationException`
      Returns:
        the error response in JSON format with media type application/vnd.error+json

Copyright © 2021 Pivotal Software, Inc.. All rights reserved.