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

org.openfact.services.ErrorResponse Maven / Gradle / Ivy

The newest version!
package org.openfact.services;

import org.openfact.representations.idm.ErrorRepresentation;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

public class ErrorResponse {

    public static Response exists(String message) {
        return ErrorResponse.error(message, Response.Status.CONFLICT);
    }

    public static Response error(String message, Response.Status status) {
        ErrorRepresentation error = new ErrorRepresentation();
        error.setErrorMessage(message);
        return Response.status(status).entity(error).type(MediaType.APPLICATION_JSON).build();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy