]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.api.acr/src/org/argeo/api/acr/ContentNotFoundException.java
Introduce UUID identified and openForEdit/freeze cycle
[lgpl/argeo-commons.git] / org.argeo.api.acr / src / org / argeo / api / acr / ContentNotFoundException.java
1 package org.argeo.api.acr;
2
3 /**
4 * When a content was requested which does not exists, equivalent to HTTP code
5 * 404.
6 */
7 public class ContentNotFoundException extends RuntimeException {
8 private static final long serialVersionUID = -8629074900713760886L;
9
10 private final String path;
11
12 public ContentNotFoundException(ContentSession session, String path, Throwable cause) {
13 super(message(session, path), cause);
14 this.path = path;
15 // we don't keep reference to the session for security reasons
16 }
17
18 public ContentNotFoundException(ContentSession session, String path) {
19 this(session, path, (String) null);
20 }
21
22 public ContentNotFoundException(ContentSession session, String path, String message) {
23 super(message != null ? message : message(session, path));
24 this.path = path;
25 // we don't keep reference to the session for security reasons
26 }
27
28 private static String message(ContentSession session, String path) {
29 return "Content " + path + "cannot be found.";
30 }
31
32 public String getPath() {
33 return path;
34 }
35 }