}
if (clientResponse.getType() == Response.ResponseType.CLIENT_ERROR ||
clientResponse.getType() == Response.ResponseType.SERVER_ERROR) {
if (clientResponse.getStatus() == 404) {
abderaClient.teardown();
throw new ResourceNotFoundException(path);
}
abderaClient.teardown();
throw new RegistryException(clientResponse.getStatusText());
}
if (clientResponse.getStatus() == 304) {
abderaClient.teardown();
/*do caching here */
log.debug(
"Cached resource returned since no modification has been done on the resource");
return cache.getCachedResource(path);
}
String eTag = clientResponse.getHeader("ETag");
Element introspection = clientResponse.getDocument().getRoot();
ResourceImpl resource;
if (introspection instanceof Feed) {
// This is a collection
Feed feed = (Feed) introspection;
String state = feed.getSimpleExtension(new QName(APPConstants.NAMESPACE, "state"));
if (state != null && state.equals("Deleted")) {
abderaClient.teardown();
throw new ResourceNotFoundException(path);
}
resource = createResourceFromFeed(feed);
} else {
Entry entry = (Entry) introspection;
resource = createResourceFromEntry(entry);