forked from jboss-developer/ticket-monster
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Mark SeatAllocationException as @applicationexception and indicate the correct rollback strategy * Add an ApplicationException subclass to WebApplicationException * Both changes improve clarity as well and don't cause the container to log them as system exceptions
- Loading branch information
1 parent
b127e35
commit 001d997
Showing
4 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
11 changes: 10 additions & 1 deletion
11
demo/src/main/java/org/jboss/jdf/example/ticketmonster/model/SeatAllocationException.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
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
51 changes: 51 additions & 0 deletions
51
demo/src/main/java/org/jboss/jdf/example/ticketmonster/rest/RestServiceException.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,51 @@ | ||
package org.jboss.jdf.example.ticketmonster.rest; | ||
|
||
import javax.ejb.ApplicationException; | ||
import javax.ws.rs.WebApplicationException; | ||
import javax.ws.rs.core.Response; | ||
|
||
/** | ||
* <p> | ||
* This exception is thrown by RESTful services. As a subclass of {@link WebApplicationException}, | ||
* it is translated automatically into a {@link Response}. | ||
* </p> | ||
* <p> | ||
* We mark it as {@link ApplicationException} because it is part of the application logic. Also, | ||
* we want the container to roll back automatically when it is thrown. | ||
* </p> | ||
* @author Marius Bogoevici | ||
*/ | ||
@ApplicationException(inherited = true, rollback = true) | ||
public class RestServiceException extends WebApplicationException { | ||
|
||
public RestServiceException() { | ||
} | ||
|
||
public RestServiceException(Response response) { | ||
super(response); | ||
} | ||
|
||
public RestServiceException(int status) { | ||
super(status); | ||
} | ||
|
||
public RestServiceException(Response.Status status) { | ||
super(status); | ||
} | ||
|
||
public RestServiceException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
public RestServiceException(Throwable cause, Response response) { | ||
super(cause, response); | ||
} | ||
|
||
public RestServiceException(Throwable cause, int status) { | ||
super(cause, status); | ||
} | ||
|
||
public RestServiceException(Throwable cause, Response.Status status) { | ||
super(cause, status); | ||
} | ||
} |
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