Class HttpServiceExceptionFactory

java.lang.Object
oracle.wcc.ridc.adfca.http.internal.exception.HttpServiceExceptionFactory

public class HttpServiceExceptionFactory extends Object
Factory to create and log HttpService exceptions. The HttpServiceExceptionFactory is a utility factory class for producing the exceptions thrown in the oracle.wcc.ridc.adfca.http.internal package. The class is thread safe. It uses a thread safe resource bundle and an ADFLogger to log the exceptions, both of which are held as final field and are constructed during the construction of the factory. The ADFLogger is a thin thread safe wrapper over the java.util.Logger.
  • Constructor Details

    • HttpServiceExceptionFactory

      public HttpServiceExceptionFactory(oracle.adf.share.logging.ADFLogger logger)
      Exception factory constructor.
      Parameters:
      logger - reference to httpService using this factory.
  • Method Details

    • createForbidden

      public ForbiddenException createForbidden(String sourceClass, String sourceMethod, String message, Object messageParam, Throwable cause)
      Create and log a new HttpServiceException with FORBIDDEN HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      message - exception message,
      messageParam - message parameter.
      cause - Throwable exception that is the underlying cause of the internal server error HttpServiceException being created.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createForbidden

      public ForbiddenException createForbidden(String sourceClass, String sourceMethod, String message, Object[] messageParams, Throwable cause)
      Create and log a new HttpServiceException with FORBIDDEN HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      message - exception message,
      messageParams - message parameters.
      cause - Throwable exception that is the underlying cause of the internal server error HttpServiceException being created.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createNotFound

      public NotFoundException createNotFound(String sourceClass, String sourceMethod, String message, Object messageParam, Throwable cause)
      Create and log a new HttpServiceException with NOT_FOUND HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      message - exception message,
      messageParam - message parameter.
      cause - Throwable exception that is the underlying cause of the internal server error HttpServiceException being created.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createNotFound

      public NotFoundException createNotFound(String sourceClass, String sourceMethod, String message, Object[] messageParams, Throwable cause)
      Create and log a new HttpServiceException with NOT_FOUND HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      message - exception message,
      messageParams - message parameters.
      cause - Throwable exception that is the underlying cause of the internal server error HttpServiceException being created.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createBadRequest

      public BadRequestException createBadRequest(String sourceClass, String sourceMethod, String message, Object messageParam, Throwable cause)
      Create and log a new HttpServiceException with BAD REQUEST HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      message - exception message,
      messageParam - message parameter.
      cause - Throwable exception that is the underlying cause of the internal server error HttpServiceException being created.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createBadRequest

      public BadRequestException createBadRequest(String sourceClass, String sourceMethod, String message, Object[] messageParams, Throwable cause)
      Create and log a new HttpServiceException with BAD REQUEST HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      message - exception message,
      messageParams - message parameters.
      cause - Throwable exception that is the underlying cause of the internal server error HttpServiceException being created.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createBadRequest

      public BadRequestException createBadRequest(String sourceClass, String sourceMethod, String messageKey)
      Create and log a new HttpServiceException with BAD REQUEST HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      messageKey - Resource bundle key or message if no localization.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createPreconditionFailed

      public PreconditionFailedException createPreconditionFailed(String sourceClass, String sourceMethod, String message, Object messageParam, Throwable cause)
      Create and log a new HttpServiceException with PRECONDITION_FAILED HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      message - exception message,
      messageParam - message parameter.
      cause - Throwable exception that is the underlying cause of the internal server error HttpServiceException being created.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createPreconditionFailed

      public PreconditionFailedException createPreconditionFailed(String sourceClass, String sourceMethod, String message, Object[] messageParams, Throwable cause)
      Create and log a new HttpServiceException with PRECONDITION_FAILED HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      message - exception message,
      messageParams - message parameters.
      cause - Throwable exception that is the underlying cause of the internal server error HttpServiceException being created.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createPreconditionFailed

      public PreconditionFailedException createPreconditionFailed(String sourceClass, String sourceMethod, String messageKey)
      Create and log a new HttpServiceException with PRECONDITION_FAILED HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      messageKey - Resource bundle key or message if no localization.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createNotAcceptable

      public NotAcceptableException createNotAcceptable(String sourceClass, String sourceMethod, String messageKey)
      Create and log a new HttpServiceException with NOT_ACCEPTABLE HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      messageKey - Resource bundle key or message if no localization.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createNotModified

      public NotModifiedException createNotModified(String sourceClass, String sourceMethod, String messageKey)
      Create and log a new HttpServiceException with NOT_MODIFIED HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      messageKey - Resource bundle key or message if no localization.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createRedirection

      public RedirectionException createRedirection(String sourceClass, String sourceMethod, HttpStatus status, String redirectURL)
      Create and log a new HttpServiceException with a redirection (3xx) HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      status - The redirection status
      redirectURL - The redirect URL
      Returns:
      RedirectionException Constructed exception, ready to be thrown.
    • createInternalServerError

      public InternalServerErrorException createInternalServerError(String sourceClass, String sourceMethod, Throwable t)
      Create and log a new HttpServiceException with INTERNAL_SERVER_ERROR HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      t - Throwable exception that is the underlying cause of the internal server error HttpServiceException being created.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createInternalServerError

      public InternalServerErrorException createInternalServerError(String sourceClass, String sourceMethod, String messageKey)
      Create and log a new HttpServiceException with INTERNAL_SERVER_ERROR HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      messageKey - Resource bundle key or message if no localization.
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createInternalServerError

      public InternalServerErrorException createInternalServerError(String sourceClass, String sourceMethod, String message, String messageParam)
      Create and log a new HttpServiceException with INTERNAL_SERVER_ERROR HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      message - Exception message (or resource bundle key)
      messageParam - Single String message parameter
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createInternalServerError

      public InternalServerErrorException createInternalServerError(String sourceClass, String sourceMethod, String message, Object[] messageParams)
      Create and log a new HttpServiceException with INTERNAL_SERVER_ERROR HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      message - the main text to log
      messageParams - parameters for the message (may be null)
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.
    • createInternalServerError

      public InternalServerErrorException createInternalServerError(String sourceClass, String sourceMethod, String message, Object[] messageParams, Level logLevel)
      Create and log a new HttpServiceException with INTERNAL_SERVER_ERROR HTTP status.
      Parameters:
      sourceClass - The name of the class that is the source of the exception
      sourceMethod - The name of the method that is the source of the exception
      message - the main text to log
      messageParams - parameters for the message (may be null)
      Returns:
      HttpServiceException Constructed exception, ready to be thrown.