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

net.leanix.dropkit.WebApplicationException Maven / Gradle / Ivy

There is a newer version: 2.0.10
Show newest version
package net.leanix.dropkit;

import javax.ws.rs.core.Response;

/**
 * Convenience class to avoid boilerplate code, allows sending an error message.
 *
 *
 *
 */
public class WebApplicationException extends javax.ws.rs.WebApplicationException {

    public static javax.ws.rs.WebApplicationException withMessage(Response.Status status, String errorMessage) {
        Response response = Response.status(status).entity(errorMessage).build();
        return new javax.ws.rs.WebApplicationException(response);
    }

    public static javax.ws.rs.WebApplicationException withPayload(Response.Status status, Object o) {
        Response response = Response.status(status).entity(o).build();
        return new javax.ws.rs.WebApplicationException(response);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy