Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now using proper JAX-RS ExceptionMapping, thus cleaning up a lot of J…
…AX-RS endpoint methods and also installing finally{} statements to be sure that JCR sessions are always logged out: for https://www.pivotaltracker.com/story/show/44821755
- Loading branch information
Showing
13 changed files
with
337 additions
and
385 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
19 changes: 0 additions & 19 deletions
19
fcrepo-http-commons/src/main/java/org/fcrepo/Constants.java
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...http-commons/src/main/java/org/fcrepo/exceptionhandlers/AccessControlExceptionMapper.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,19 @@ | ||
|
||
package org.fcrepo.exceptionhandlers; | ||
|
||
import static javax.ws.rs.core.Response.status; | ||
import static javax.ws.rs.core.Response.Status.FORBIDDEN; | ||
|
||
import javax.jcr.security.AccessControlException; | ||
import javax.ws.rs.core.Response; | ||
import javax.ws.rs.ext.ExceptionMapper; | ||
|
||
public class AccessControlExceptionMapper implements | ||
ExceptionMapper<AccessControlException> { | ||
|
||
@Override | ||
public Response toResponse(AccessControlException arg0) { | ||
return status(FORBIDDEN).build(); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
...-http-commons/src/main/java/org/fcrepo/exceptionhandlers/PathNotFoundExceptionMapper.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,19 @@ | ||
|
||
package org.fcrepo.exceptionhandlers; | ||
|
||
import static javax.ws.rs.core.Response.status; | ||
import static javax.ws.rs.core.Response.Status.NOT_FOUND; | ||
|
||
import javax.jcr.PathNotFoundException; | ||
import javax.ws.rs.core.Response; | ||
import javax.ws.rs.ext.ExceptionMapper; | ||
|
||
public class PathNotFoundExceptionMapper implements | ||
ExceptionMapper<PathNotFoundException> { | ||
|
||
@Override | ||
public Response toResponse(PathNotFoundException arg0) { | ||
return status(NOT_FOUND).build(); | ||
} | ||
|
||
} |
Oops, something went wrong.