org.springframework.boot.actuate.health

Class HealthStatusHttpMapper

  • java.lang.Object
    • org.springframework.boot.actuate.health.HealthStatusHttpMapper


  • public class HealthStatusHttpMapper
    extends Object
    Map a Status to an HTTP status code.
    Since:
    2.0.0
    Author:
    Stephane Nicoll
    • Constructor Detail

      • HealthStatusHttpMapper

        public HealthStatusHttpMapper()
        Create a new instance.
    • Method Detail

      • setStatusMapping

        public void setStatusMapping(Map<String,Integer> statusMapping)
        Set specific status mappings.
        Parameters:
        statusMapping - a map of health status code to HTTP status code
      • addStatusMapping

        public void addStatusMapping(Map<String,Integer> statusMapping)
        Add specific status mappings to the existing set.
        Parameters:
        statusMapping - a map of health status code to HTTP status code
      • addStatusMapping

        public void addStatusMapping(Status status,
                                     Integer httpStatus)
        Add a status mapping to the existing set.
        Parameters:
        status - the status to map
        httpStatus - the http status
      • addStatusMapping

        public void addStatusMapping(String statusCode,
                                     Integer httpStatus)
        Add a status mapping to the existing set.
        Parameters:
        statusCode - the status code to map
        httpStatus - the http status
      • getStatusMapping

        public Map<String,Integer> getStatusMapping()
        Return an immutable view of the status mapping.
        Returns:
        the http status codes mapped by status name
      • mapStatus

        public int mapStatus(Status status)
        Map the specified Status to an HTTP status code.
        Parameters:
        status - the health Status
        Returns:
        the corresponding HTTP status code