All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.dropwizard.health.http.HttpHealthResponse Maven / Gradle / Ivy

Go to download

Provides a health check implementation that performs ongoing monitoring of an application's dependencies and includes an endpoint that can be called by a load balancer to determine if the application is healthy and thus able to retrieve traffic.

There is a newer version: 1.7.3
Show newest version
package io.dropwizard.health.http;

import java.util.Objects;

import javax.annotation.Nonnull;

public class HttpHealthResponse {
    private final int status;
    @Nonnull
    private final String body;

    public HttpHealthResponse(final int status, @Nonnull final String body) {
        this.status = status;
        this.body = Objects.requireNonNull(body);
    }

    public int getStatus() {
        return status;
    }

    @Nonnull
    public String getBody() {
        return body;
    }

    @Override
    public boolean equals(final Object other) {
        if (this == other) {
            return true;
        }
        if (!(other instanceof HttpHealthResponse)) {
            return false;
        }
        final HttpHealthResponse that = (HttpHealthResponse) other;
        return status == that.status
                && Objects.equals(body, that.body);
    }

    @Override
    public int hashCode() {
        return Objects.hash(status, body);
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("HttpHealthResponse{");
        sb.append("status=").append(status);
        sb.append(", body='").append(body).append('\'');
        sb.append('}');
        return sb.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy