MediaType.APPLICATION_JSON).post(ClientResponse.class, applicationDescriptor);
status = response.getStatus();
if (status == ClientConstant.HTTP_BAD_REQUEST){
logger.debug("Descriptor already exists...");
throw new DescriptorAlreadyExistsException(applicationDescriptor.getName() + " already exists !!!");
} else if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
} else {
if (response.getCookies().size() > 0) {
cookie = response.getCookies().get(0).toCookie();
CookieManager.setCookie(cookie);
}
}
} else if (status == ClientConstant.HTTP_BAD_REQUEST){
logger.debug("Descriptor already exists...");
throw new DescriptorAlreadyExistsException(applicationDescriptor.getName() + " already exists !!!");
} else {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
}