org.jboss.resteasy.client.exception.ResteasyWebApplicationException Maven / Gradle / Ivy
package org.jboss.resteasy.client.exception;
import static org.jboss.resteasy.client.exception.WebApplicationExceptionWrapper.sanitize;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
/**
* Wraps a {@link WebApplicationException} with a {@linkplain #sanitize(Response) sanitized} response.
*
* @author James R. Perkins
*/
public class ResteasyWebApplicationException extends WebApplicationException implements WebApplicationExceptionWrapper {
private final WebApplicationException wrapped;
/**
* Creates a new exception based on the wrapped exception. The response will be
* {@linkplain #sanitize(Response) sanitized}.
*
* @param wrapped the exception to wrap
*/
public ResteasyWebApplicationException(final WebApplicationException wrapped) {
super(wrapped.getMessage(), wrapped.getCause(), sanitize(wrapped.getResponse()));
this.wrapped = wrapped;
}
@Override
public WebApplicationException unwrap() {
return wrapped;
}
}