axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manj...@apache.org
Subject svn commit: r663041 - in /webservices/axis2/branches/c/post_1_4_mtom/c: axiom/include/axiom_mime_parser.h axiom/src/attachments/mime_parser.c samples/client/mtom/mtom_client.c samples/mtom_caching_callback/mtom_caching_callback.c
Date Wed, 04 Jun 2008 09:35:30 GMT
Author: manjula
Date: Wed Jun  4 02:35:30 2008
New Revision: 663041

URL: http://svn.apache.org/viewvc?rev=663041&view=rev
Log:
Fixing the case when we are not caching.

Modified:
    webservices/axis2/branches/c/post_1_4_mtom/c/axiom/include/axiom_mime_parser.h
    webservices/axis2/branches/c/post_1_4_mtom/c/axiom/src/attachments/mime_parser.c
    webservices/axis2/branches/c/post_1_4_mtom/c/samples/client/mtom/mtom_client.c
    webservices/axis2/branches/c/post_1_4_mtom/c/samples/mtom_caching_callback/mtom_caching_callback.c

Modified: webservices/axis2/branches/c/post_1_4_mtom/c/axiom/include/axiom_mime_parser.h
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/axiom/include/axiom_mime_parser.h?rev=663041&r1=663040&r2=663041&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/axiom/include/axiom_mime_parser.h (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/axiom/include/axiom_mime_parser.h Wed Jun
 4 02:35:30 2008
@@ -38,7 +38,7 @@
 {
 #endif
 
-#define AXIOM_MIME_PARSER_BUFFER_SIZE (1024*1024/2)
+#define AXIOM_MIME_PARSER_BUFFER_SIZE (1024/2)
 #define AXIOM_MIME_PARSER_MAX_BUFFERS 1000
 
 #define AXIOM_MIME_PARSER_END_OF_MIME_MAX_COUNT 100

Modified: webservices/axis2/branches/c/post_1_4_mtom/c/axiom/src/attachments/mime_parser.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/axiom/src/attachments/mime_parser.c?rev=663041&r1=663040&r2=663041&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/axiom/src/attachments/mime_parser.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/axiom/src/attachments/mime_parser.c Wed Jun
 4 02:35:30 2008
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include <axiom_caching_callback.h>
 #include <axutil_class_loader.h>
+#include <axutil_http_chunked_stream.h>
 
 struct axiom_mime_parser
 {
@@ -160,6 +161,10 @@
     axiom_mime_parser_t *mime_parser,
     const axutil_env_t *env);
 
+static axis2_bool_t axiom_mime_parser_is_more_data(
+    axiom_mime_parser_t *mime_parser,
+    const axutil_env_t *env,
+    axis2_callback_info_t *callback_info);
 
 AXIS2_EXTERN axiom_mime_parser_t *AXIS2_CALL
 axiom_mime_parser_create(
@@ -244,6 +249,9 @@
     axis2_status_t status = AXIS2_FAILURE; 
     axis2_char_t *buffer = NULL;
     int malloc_len = 0;
+    axis2_callback_info_t *callback_info = NULL;
+
+    callback_info = (axis2_callback_info_t *)callback_ctx;
 
     size = AXIOM_MIME_PARSER_BUFFER_SIZE * (mime_parser->buffer_size); 
 
@@ -339,9 +347,13 @@
             {
                 memcpy(buffer, pos + 4, malloc_len);
             }
-            len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
          
+
+            if(axiom_mime_parser_is_more_data(mime_parser, env, callback_info))
+            {
+                len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
          
+            }
             axiom_mime_parser_clear_buffers(env, buf_array, part_start, buf_num);
-            if(len > 0)
+            if(len >= 0)
             {
                 buf_array[buf_num] = buffer;
                 len_array[buf_num] = malloc_len + len;                    
@@ -369,9 +381,12 @@
             {
                 memcpy(buffer, buf_array[buf_num] + search_info->match_len2, malloc_len);
       
             }
-            len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
+            if(axiom_mime_parser_is_more_data(mime_parser, env, callback_info))
+            {
+                len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
+            }
             axiom_mime_parser_clear_buffers(env, buf_array, part_start, buf_num);
-            if(len > 0)
+            if(len >= 0)
             {
                 buf_array[buf_num] = buffer;
                 len_array[buf_num] = malloc_len + len; 
@@ -436,9 +451,13 @@
                 {
                     memcpy(buffer, pos + temp_mime_boundary_size, malloc_len);
                 }
-                len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
+                if(axiom_mime_parser_is_more_data(mime_parser, env, callback_info))
+                {
+                    len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
+                }
+
                 axiom_mime_parser_clear_buffers(env, buf_array, part_start, buf_num);
-                if(len > 0)
+                if(len >= 0)
                 {
                     buf_array[buf_num] = buffer;
                     len_array[buf_num] = malloc_len + len;
@@ -481,9 +500,13 @@
                 {
                     memcpy(buffer, buf_array[buf_num] + search_info->match_len2, malloc_len);
                 }
-                len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
+
+                if(axiom_mime_parser_is_more_data(mime_parser, env, callback_info))
+                {
+                    len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
+                }
                 axiom_mime_parser_clear_buffers(env, buf_array, part_start, buf_num);
-                if(len > 0)
+                if(len >= 0)
                 {
                     buf_array[buf_num] = buffer;
                     len_array[buf_num] = malloc_len + len;
@@ -577,10 +600,14 @@
                     {
                         memcpy(buffer, pos + 4, malloc_len);
                     }
-                    len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
+                    
+                    if(axiom_mime_parser_is_more_data(mime_parser, env, callback_info))
+                    {
+                        len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
+                    }
 
                     axiom_mime_parser_clear_buffers(env, buf_array, part_start, buf_num);
-                    if(len > 0)
+                    if(len >= 0)
                     {
                         buf_array[buf_num] = buffer;
                         len_array[buf_num] = malloc_len + len;
@@ -625,9 +652,12 @@
                     {
                         memcpy(buffer, buf_array[buf_num] + search_info->match_len2, malloc_len);
                     }
-                    len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
+                    if(axiom_mime_parser_is_more_data(mime_parser, env, callback_info))
+                    {
+                        len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
+                    }
                     axiom_mime_parser_clear_buffers(env, buf_array, part_start, buf_num);
-                    if(len > 0)
+                    if(len >= 0)
                     {
                         buf_array[buf_num] = buffer;
                         len_array[buf_num] = malloc_len + len;
@@ -728,8 +758,11 @@
 
                     if(malloc_len != 2)
                     {
-                        len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
       
-                        if(len > 0)
+                        if(axiom_mime_parser_is_more_data(mime_parser, env, callback_info))
+                        {
+                            len = callback(buffer + malloc_len, size - malloc_len, (void
*) callback_ctx);        
+                        }
+                        if(len >= 0)
                         {
                             len_array[buf_num] = malloc_len + len;
                         }
@@ -763,8 +796,11 @@
                     }
                     if(malloc_len != 2)
                     {
-                        len = callback(buffer + malloc_len, size - malloc_len, (void *) callback_ctx);
-                        if(len > 0)
+                        if(axiom_mime_parser_is_more_data(mime_parser, env, callback_info))
+                        {
+                            len = callback(buffer + malloc_len, size - malloc_len, (void
*) callback_ctx);
+                        }
+                        if(len >= 0)
                         {
                             len_array[buf_num] = malloc_len + len;
                         }
@@ -1740,3 +1776,31 @@
     }
 
 }
+
+static axis2_bool_t axiom_mime_parser_is_more_data(
+    axiom_mime_parser_t *mime_parser,
+    const axutil_env_t *env,
+    axis2_callback_info_t *callback_info)
+{
+    if(callback_info->chunked_stream)
+    {
+        if(axutil_http_chunked_stream_get_end_of_chunks(
+            callback_info->chunked_stream, env))
+        {
+            return AXIS2_FALSE;
+        }
+        else
+        {
+            return AXIS2_TRUE;
+        }
+    }
+
+    else if(callback_info->unread_len <= 0)
+    {
+        return AXIS2_FALSE;
+    }
+    else
+    {
+        return AXIS2_TRUE;
+    }
+}

Modified: webservices/axis2/branches/c/post_1_4_mtom/c/samples/client/mtom/mtom_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/samples/client/mtom/mtom_client.c?rev=663041&r1=663040&r2=663041&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/samples/client/mtom/mtom_client.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/samples/client/mtom/mtom_client.c Wed Jun
 4 02:35:30 2008
@@ -235,9 +235,9 @@
         data_handler = axiom_text_get_data_handler(axiom_text, env);
 
         /*axiom_data_handler_set_file_name(data_handler, env, (axis2_char_t *)to_save_name);*/
-        if(axiom_data_handler_get_cached) 
+        if(axiom_data_handler_get_cached(data_handler, env)) 
         {
-            printf("Attachmrnt is cached.\n");    
+            printf("Attachment is cached.\n");    
         }   
         else
         {

Modified: webservices/axis2/branches/c/post_1_4_mtom/c/samples/mtom_caching_callback/mtom_caching_callback.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/samples/mtom_caching_callback/mtom_caching_callback.c?rev=663041&r1=663040&r2=663041&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/samples/mtom_caching_callback/mtom_caching_callback.c
(original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/samples/mtom_caching_callback/mtom_caching_callback.c
Wed Jun  4 02:35:30 2008
@@ -40,7 +40,18 @@
                               const axutil_env_t* env)
 {
     FILE *fp = NULL;
+    
+
     fp = fopen("/tmp/attachment", "a+");
+
+    #if !defined(WIN32)
+    {
+        axis2_char_t permission_str[256];
+        sprintf(permission_str, "chmod 777 /tmp/attachment");
+        system(permission_str);
+    }
+    #endif
+
     return (void *)fp;
 }
 



Mime
View raw message