if (MediaType.TEXT_PLAIN.equals(entity.getMediaType(), true)) {
try {
String namespace = entity.getText().trim();
if (namespace.length() == 0) {
throw new ResourceException(CLIENT_ERROR_BAD_REQUEST,
"No namespace name found in request body");
}
// FIXME: perform some sanity checks on the namespace string
ServerConnection connection = getConnection();
connection.setNamespace(prefix, namespace);
connection.getCacheInfo().processUpdate();
getResponse().setStatus(SUCCESS_NO_CONTENT);
return null;
}
catch (IOException e) {
throw new ResourceException(e);
}
catch (StoreException e) {
throw new ResourceException(e);
}
}
else {
throw new ResourceException(CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE);
}
}