[Carbon-dev] svn commit r31382 - in trunk/solutions/wsf/c/registry_client: include src test
dimuthu at wso2.com
dimuthu at wso2.com
Mon Feb 23 22:47:12 PST 2009
Author: dimuthu
Date: Mon Feb 23 22:47:12 2009
New Revision: 31382
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=31382
Log:
adding the slug header
Modified:
trunk/solutions/wsf/c/registry_client/include/remote_registry_rest_client.h
trunk/solutions/wsf/c/registry_client/src/remote_registry.c
trunk/solutions/wsf/c/registry_client/src/rest_client.c
trunk/solutions/wsf/c/registry_client/test/reg_put_full_test.c
Modified: trunk/solutions/wsf/c/registry_client/include/remote_registry_rest_client.h
URL: http://wso2.org/svn/browse/wso2/trunk/solutions/wsf/c/registry_client/include/remote_registry_rest_client.h?rev=31382&r1=31381&r2=31382&view=diff
==============================================================================
--- trunk/solutions/wsf/c/registry_client/include/remote_registry_rest_client.h (original)
+++ trunk/solutions/wsf/c/registry_client/include/remote_registry_rest_client.h Mon Feb 23 22:47:12 2009
@@ -69,7 +69,7 @@
const axutil_env_t *env,
const axis2_char_t *url,
const axis2_char_t *data,
- const axis2_char_t *content_type_header);
+ const axis2_char_t *custom_headers);
AXIS2_EXTERN axis2_status_t AXIS2_CALL
remote_registry_rest_client_delete(
Modified: trunk/solutions/wsf/c/registry_client/src/remote_registry.c
URL: http://wso2.org/svn/browse/wso2/trunk/solutions/wsf/c/registry_client/src/remote_registry.c?rev=31382&r1=31381&r2=31382&view=diff
==============================================================================
--- trunk/solutions/wsf/c/registry_client/src/remote_registry.c (original)
+++ trunk/solutions/wsf/c/registry_client/src/remote_registry.c Mon Feb 23 22:47:12 2009
@@ -293,22 +293,50 @@
{
axiom_node_t *node = NULL;
axis2_char_t *node_str = NULL;
- axis2_char_t *content_type_header = NULL;
+ axis2_char_t *custom_headers = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+ axis2_char_t *ri = 0;
- node = remote_registry_resource_serialize(resource, env);
- node_str = axiom_node_to_string(node, env);
-
- if(remote_registry_resource_get_is_collection(resource, env))
- {
- content_type_header = "Content-Type: application/atom+xml;type=collection";
+ path = axutil_strdup(env, path);
+ if(!path) {
+
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create path");
+ return AXIS2_FAILURE;
}
- else
- {
- content_type_header = "Content-Type: application/atom+xml;type=entry";
+ ri = axutil_rindex(path, '/');
+
+ if(ri) {
+ axis2_char_t *resource_name = NULL;
+
+ *ri = '\0';
+ resource_name = ri + 1;
+
+ node = remote_registry_resource_serialize(resource, env);
+ node_str = axiom_node_to_string(node, env);
+
+ if(remote_registry_resource_get_is_collection(resource, env))
+ {
+ custom_headers = axutil_strcat(env, "Content-Type: application/atom+xml;type=collection\r\nSlug: ",
+ resource_name, NULL);
+ }
+ else
+ {
+ custom_headers = axutil_strcat(env, "Content-Type: application/atom+xml;type=entry\r\nSlug: ",
+ resource_name, NULL);
+ }
+
+ if(custom_headers)
+ {
+ status = remote_registry_rest_client_post(remote_registry->rest_client, env, path, node_str, custom_headers);
+
+ AXIS2_FREE(env->allocator, custom_headers);
+ }
+ *ri = '/';
}
- return remote_registry_rest_client_post(remote_registry->rest_client, env, path, node_str, content_type_header);
+ return status;
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
Modified: trunk/solutions/wsf/c/registry_client/src/rest_client.c
URL: http://wso2.org/svn/browse/wso2/trunk/solutions/wsf/c/registry_client/src/rest_client.c?rev=31382&r1=31381&r2=31382&view=diff
==============================================================================
--- trunk/solutions/wsf/c/registry_client/src/rest_client.c (original)
+++ trunk/solutions/wsf/c/registry_client/src/rest_client.c Mon Feb 23 22:47:12 2009
@@ -465,7 +465,7 @@
const axutil_env_t *env,
const axis2_char_t *url,
const axis2_char_t *data,
- const axis2_char_t *content_type_header)
+ const axis2_char_t *custom_headers)
{
CURL *curl_handle;
CURLcode res;
@@ -488,9 +488,9 @@
curl_handle = curl_easy_init();
if(curl_handle)
{
- if(content_type_header)
+ if(custom_headers)
{
- headers = curl_slist_append(headers, content_type_header);
+ headers = curl_slist_append(headers, custom_headers);
curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
}
Modified: trunk/solutions/wsf/c/registry_client/test/reg_put_full_test.c
URL: http://wso2.org/svn/browse/wso2/trunk/solutions/wsf/c/registry_client/test/reg_put_full_test.c?rev=31382&r1=31381&r2=31382&view=diff
==============================================================================
--- trunk/solutions/wsf/c/registry_client/test/reg_put_full_test.c (original)
+++ trunk/solutions/wsf/c/registry_client/test/reg_put_full_test.c Mon Feb 23 22:47:12 2009
@@ -10,7 +10,7 @@
remote_registry_t *remote_registry = NULL;
remote_registry_t *remote_registry2 = NULL;
const axutil_env_t *env = NULL;
- axis2_char_t *path = "/weather/4/system.subscriptions";
+ axis2_char_t *path = "/weather/4/system.subscriptions/test_id";
remote_registry_resource_t *res = NULL;
remote_registry_resource_t *res2 = NULL;
axutil_hash_t *properties = NULL;
More information about the Carbon-dev
mailing list