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

org.jboss.resteasy.client.exception.ResteasyWebApplicationException Maven / Gradle / Ivy

There is a newer version: 4.0.0.Beta5
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy