Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RESTEASY-2728] Clients running in a resource method throw safer WebA…
…pplicationExceptions (#2623) [RESTEASY-2728] Added arquillian tests. [RESTEASY-2728] Correct serialVersionUID in some of the new ClientWebApplicationExceptions. [RESTEASY-2728] Adding documentation to User Guide. [RESTEASY-2728] Make the custom WebApplicationException's wrap the exception they're replacing. Also create a sanitized response for the exceptions. Add an API used to wrap/unwrap the exceptions. https://issues.redhat.com/browse/RESTEASY-2728 [RESTEASY-2728] 1) MP REST Client DefaultResponseExceptionMapper can handle RedirectException; 2) Fix integration tests. [RESTEASY-2728] Modified docbook.
- Loading branch information
Showing
34 changed files
with
3,183 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...-jaxrs/src/main/java/org/jboss/resteasy/client/exception/ResteasyBadRequestException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.jboss.resteasy.client.exception; | ||
|
||
import static org.jboss.resteasy.client.exception.WebApplicationExceptionWrapper.sanitize; | ||
|
||
import javax.ws.rs.BadRequestException; | ||
import javax.ws.rs.core.Response; | ||
|
||
/** | ||
* Wraps a {@link BadRequestException} with a {@linkplain #sanitize(Response) sanitized} response. | ||
* | ||
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a> | ||
*/ | ||
public class ResteasyBadRequestException extends BadRequestException implements WebApplicationExceptionWrapper<BadRequestException> { | ||
private final BadRequestException wrapped; | ||
|
||
ResteasyBadRequestException(final BadRequestException wrapped) { | ||
super(wrapped.getMessage(), sanitize(wrapped.getResponse()), wrapped.getCause()); | ||
this.wrapped = wrapped; | ||
} | ||
|
||
@Override | ||
public BadRequestException unwrap() { | ||
return wrapped; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...jaxrs/src/main/java/org/jboss/resteasy/client/exception/ResteasyClientErrorException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.jboss.resteasy.client.exception; | ||
|
||
|
||
import static org.jboss.resteasy.client.exception.WebApplicationExceptionWrapper.sanitize; | ||
|
||
import javax.ws.rs.ClientErrorException; | ||
import javax.ws.rs.core.Response; | ||
|
||
/** | ||
* Wraps a {@link ClientErrorException} with a {@linkplain #sanitize(Response) sanitized} response. | ||
* | ||
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a> | ||
*/ | ||
public class ResteasyClientErrorException extends ClientErrorException implements WebApplicationExceptionWrapper<ClientErrorException> { | ||
|
||
private final ClientErrorException wrapped; | ||
|
||
ResteasyClientErrorException(final ClientErrorException wrapped) { | ||
super(wrapped.getMessage(), sanitize(wrapped.getResponse()), wrapped.getCause()); | ||
this.wrapped = wrapped; | ||
} | ||
|
||
@Override | ||
public ClientErrorException unwrap() { | ||
return wrapped; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...y-jaxrs/src/main/java/org/jboss/resteasy/client/exception/ResteasyForbiddenException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.jboss.resteasy.client.exception; | ||
|
||
import static org.jboss.resteasy.client.exception.WebApplicationExceptionWrapper.sanitize; | ||
|
||
import javax.ws.rs.ForbiddenException; | ||
import javax.ws.rs.core.Response; | ||
|
||
/** | ||
* Wraps a {@link ForbiddenException} with a {@linkplain #sanitize(Response) sanitized} response. | ||
* | ||
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a> | ||
*/ | ||
public class ResteasyForbiddenException extends ForbiddenException implements WebApplicationExceptionWrapper<ForbiddenException> { | ||
private final ForbiddenException wrapped; | ||
|
||
ResteasyForbiddenException(final ForbiddenException wrapped) { | ||
super(wrapped.getMessage(), sanitize(wrapped.getResponse()), wrapped.getCause()); | ||
this.wrapped = wrapped; | ||
} | ||
|
||
@Override | ||
public ForbiddenException unwrap() { | ||
return wrapped; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...c/main/java/org/jboss/resteasy/client/exception/ResteasyInternalServerErrorException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.jboss.resteasy.client.exception; | ||
|
||
import static org.jboss.resteasy.client.exception.WebApplicationExceptionWrapper.sanitize; | ||
|
||
import javax.ws.rs.InternalServerErrorException; | ||
import javax.ws.rs.core.Response; | ||
|
||
/** | ||
* Wraps a {@link InternalServerErrorException} with a {@linkplain #sanitize(Response) sanitized} response. | ||
* | ||
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a> | ||
*/ | ||
public class ResteasyInternalServerErrorException extends InternalServerErrorException implements WebApplicationExceptionWrapper<InternalServerErrorException> { | ||
private final InternalServerErrorException wrapped; | ||
|
||
ResteasyInternalServerErrorException(final InternalServerErrorException wrapped) { | ||
super(wrapped.getMessage(), sanitize(wrapped.getResponse()), wrapped.getCause()); | ||
this.wrapped = wrapped; | ||
} | ||
|
||
@Override | ||
public InternalServerErrorException unwrap() { | ||
return wrapped; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...xrs/src/main/java/org/jboss/resteasy/client/exception/ResteasyNotAcceptableException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.jboss.resteasy.client.exception; | ||
|
||
import static org.jboss.resteasy.client.exception.WebApplicationExceptionWrapper.sanitize; | ||
|
||
import javax.ws.rs.NotAcceptableException; | ||
import javax.ws.rs.core.Response; | ||
|
||
/** | ||
* Wraps a {@link NotAcceptableException} with a {@linkplain #sanitize(Response) sanitized} response. | ||
* | ||
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a> | ||
*/ | ||
public class ResteasyNotAcceptableException extends NotAcceptableException implements WebApplicationExceptionWrapper<NotAcceptableException> { | ||
private final NotAcceptableException wrapped; | ||
|
||
ResteasyNotAcceptableException(final NotAcceptableException wrapped) { | ||
super(wrapped.getMessage(), sanitize(wrapped.getResponse()), wrapped.getCause()); | ||
this.wrapped = wrapped; | ||
} | ||
|
||
@Override | ||
public NotAcceptableException unwrap() { | ||
return wrapped; | ||
} | ||
} |
Oops, something went wrong.