com.indeed.status.web.AbstractResponseWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of status-web Show documentation
Show all versions of status-web Show documentation
The web classes for showing that status of a webapp in a servlet
package com.indeed.status.web;
import com.google.common.base.Function;
import com.indeed.status.core.CheckStatus;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletResponse;
/**
*
*/
public class AbstractResponseWriter {
public static final Function FN_PUBLIC_RESPONSE =
new Function() {
@Override
public Integer apply (@Nullable CheckStatus status) {
final int result;
if ( null == status ) {
result = SC_ERROR;
} else {
switch( status ) {
case OK:
case MINOR:
case MAJOR:
result = SC_OK;
break;
case OUTAGE:
default:
result = SC_ERROR;
break;
}
}
return result;
}
};
public static final Function FN_PRIVATE_RESPONSE =
new Function() {
@Override
public Integer apply (@Nullable CheckStatus status) {
final int result;
if ( null == status ) {
result = SC_ERROR;
} else {
switch( status ) {
case OK:
result = SC_OK;
break;
case MINOR:
case MAJOR:
case OUTAGE:
default:
result = SC_ERROR;
break;
}
}
return result;
}
};
public static final int SC_OK = HttpServletResponse.SC_OK;
public static final int SC_ERROR = 512;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy