Revision b0236d96
Added by Andreas Kohlbecker over 7 years ago
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/BaseController.java | ||
---|---|---|
45 | 45 |
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference; |
46 | 46 |
import eu.etaxonomy.cdm.remote.controller.util.PagerParameters; |
47 | 47 |
import eu.etaxonomy.cdm.remote.editor.UUIDPropertyEditor; |
48 |
import eu.etaxonomy.cdm.remote.exception.NoRecordsMatchException; |
|
49 | 48 |
|
50 | 49 |
/** |
51 | 50 |
* based on org.cateproject.controller.common |
... | ... | |
285 | 284 |
CDM_BASE cdmBaseObject = service.load(uuid, pathProperties); |
286 | 285 |
if (cdmBaseObject == null) { |
287 | 286 |
HttpStatusMessage.UUID_NOT_FOUND.send(response); |
288 |
throw new NoRecordsMatchException("No instance found for UUID " + uuid.toString()); |
|
289 | 287 |
} |
290 | 288 |
return cdmBaseObject; |
291 | 289 |
} |
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/HttpStatusMessage.java | ||
---|---|---|
14 | 14 |
import javax.servlet.http.HttpServletResponse; |
15 | 15 |
|
16 | 16 |
import org.apache.commons.lang.StringUtils; |
17 |
import org.apache.log4j.Logger; |
|
17 | 18 |
|
18 | 19 |
|
19 | 20 |
/** |
... | ... | |
23 | 24 |
*/ |
24 | 25 |
public class HttpStatusMessage { |
25 | 26 |
|
27 |
public static final Logger logger = Logger.getLogger(HttpStatusMessage.class); |
|
28 |
|
|
26 | 29 |
public final static HttpStatusMessage UUID_MISSING = new HttpStatusMessage(HttpServletResponse.SC_BAD_REQUEST, "missing uuid parameter"); |
27 | 30 |
public final static HttpStatusMessage UUID_INVALID = new HttpStatusMessage(HttpServletResponse.SC_BAD_REQUEST, "invalid uuid"); |
28 | 31 |
public final static HttpStatusMessage UUID_NOT_FOUND = new HttpStatusMessage(HttpServletResponse.SC_NOT_FOUND, "uuid not found"); |
... | ... | |
74 | 77 |
|
75 | 78 |
|
76 | 79 |
public void send(HttpServletResponse response) throws IOException{ |
80 |
logger.info("HTTP " + getStatusCode() + " : " + getMessage()); |
|
77 | 81 |
response.sendError(getStatusCode(), getMessage()); |
78 | 82 |
} |
79 | 83 |
|
Also available in: Unified diff
#5859 avoiding pollution of the log file with stack traces