io.dropwizard.health.http.HttpHealthResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dropwizard-health Show documentation
Show all versions of dropwizard-health Show documentation
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.
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();
}
}