package ogloszenia.rest;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

import ogloszenia.exn.NieznanyRekord;

@Provider
public class NieznanyRekordMapper implements ExceptionMapper<NieznanyRekord> {

	@Override
	public Response toResponse(NieznanyRekord e) {
		String html = "<html><body>"
				+ "<h1>Brak danych</h1>"
				+ "<p style='color:red'>"
				+ e.getMessage()
				+ "</p></body></html>";
		return Response.status(Status.NOT_FOUND)
			.type("text/html")
			.entity(html)
			.build();
		}
}
