gate.rest.exception.ServiceUnavailableExceptionMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gate Show documentation
Show all versions of gate Show documentation
A multipurpose java library
package gate.rest.exception;
import gate.error.ServiceUnavailableException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
@Provider
public class ServiceUnavailableExceptionMapper implements ExceptionMapper
{
@Override
public Response toResponse(ServiceUnavailableException ex)
{
return Response.status(Response.Status.SERVICE_UNAVAILABLE)
.entity(ex.getMessage())
.type(MediaType.TEXT_PLAIN)
.build();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy