/** * Invoked when an error or an exception is caught during initialization, * handling or releasing. By default, updates the responses's status with * the result of {@link org.restlet.service.StatusService#toStatus(Throwable, Resource)}. * * @param throwable * The caught error or exception. */ protected void doCatch(Throwable throwable) { Level level = Level.INFO; Status status = getStatusService().toStatus(throwable, this); if (status.isServerError()) { level = Level.SEVERE; } else if (status.isConnectorError()) { level = Level.INFO; } else if (status.isClientError()) { level = Level.FINE; } getLogger().log(level, "Exception or error caught in server resource", throwable); if (getResponse() != null) { getResponse().setStatus(status); Representation errorEntity = getStatusService().toRepresentation( status, this); getResponse().setEntity(errorEntity); } }
getLogger().log(Level.FINE, "Unable to get variants from annotation", e);
&& (getResponseEntity() == null || !getResponseEntity() .isAvailable())) { getLogger() .fine("A response with a 200 (Ok) status should have an entity. " + "Changing the status to 204 (No content).");