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

gate.rest.exception.ServiceUnavailableExceptionMapper Maven / Gradle / Ivy

There is a newer version: 12.3.1
Show newest version
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