From e5e2e5a5dcd0ef5e88c3bbc687969577b9d13bfa Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 6 Sep 2005 15:24:48 +0000 Subject: [PATCH] fixed makefile ommission updated the JSON api stuff in json_xml.c added json_xml.o to the build target git-svn-id: svn://svn.open-ils.org/ILS/trunk@1799 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/apachemods/Makefile | 6 +-- Open-ILS/src/apachemods/json_xml.c | 54 +++++++++++--------------- Open-ILS/src/apachemods/mod_xmltools.c | 2 +- OpenSRF/src/gateway/Makefile | 8 ++-- 4 files changed, 31 insertions(+), 39 deletions(-) diff --git a/Open-ILS/src/apachemods/Makefile b/Open-ILS/src/apachemods/Makefile index 5e1b9ccb45..380f6aa3bd 100644 --- a/Open-ILS/src/apachemods/Makefile +++ b/Open-ILS/src/apachemods/Makefile @@ -28,9 +28,9 @@ libfieldmapper.so: fieldmapper_lookup.o echo $@ $(CC) $(LDFLAGS) $(LDLIBS) -shared -W1 fieldmapper_lookup.o -o $@ -mod_ils_rest_gateway.so: libfieldmapper.so ils_rest_gateway.o +mod_ils_rest_gateway.so: libfieldmapper.so ils_rest_gateway.o json_xml.o echo $@ - $(CC) $(LDFLAGS) $(LDLIBS) -shared -W1 ils_rest_gateway.o -lfieldmapper -o $@ + $(CC) $(LDFLAGS) $(LDLIBS) -shared -W1 json_xml.o ils_rest_gateway.o -lfieldmapper -o $@ # ------------------------------------------------------ @@ -43,7 +43,7 @@ libfieldmapper-install: libfieldmapper.so mod_ils_rest_gateway-install: - $(APXS2) -i -a -n mod_ils_rest_gateway mod_ils_rest_gateway.so + $(APXS2) -i -a -n ils_rest_gateway mod_ils_rest_gateway.so echo "-----------------------------------------------"; echo -e "* Important * : Change httpd.conf from this: \n \ LoadModule mod_ils_rest_gateway_module modules/mod_ils_rest_gateway.so \n \ diff --git a/Open-ILS/src/apachemods/json_xml.c b/Open-ILS/src/apachemods/json_xml.c index e34f89fee9..0cd42a426d 100644 --- a/Open-ILS/src/apachemods/json_xml.c +++ b/Open-ILS/src/apachemods/json_xml.c @@ -1,11 +1,11 @@ #include "json_xml.h" #include "fieldmapper_lookup.h" -void _rest_xml_output(growing_buffer*, object*, char*, int, int); +void _rest_xml_output(growing_buffer*, jsonObject*, char*, int, int); char* _escape_xml (char*); char* json_string_to_xml(char* content) { - object * obj; + jsonObject * obj; growing_buffer * res_xml; char * output; int i; @@ -18,9 +18,9 @@ char* json_string_to_xml(char* content) { buffer_add(res_xml, ""); - if(obj->is_array) { + if(obj->type == JSON_ARRAY ) { for( i = 0; i!= obj->size; i++ ) { - _rest_xml_output(res_xml, obj->get_index(obj,i), NULL, 0,0); + _rest_xml_output(res_xml, jsonObjectGetIndex(obj,i), NULL, 0,0); } } else { _rest_xml_output(res_xml, obj, NULL, 0,0); @@ -30,7 +30,7 @@ char* json_string_to_xml(char* content) { output = buffer_data(res_xml); buffer_free(res_xml); - free_object(obj); + jsonObjectFree(obj); return output; } @@ -55,7 +55,7 @@ char* _escape_xml (char* text) { return out; } -void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int arr_index, int notag) { +void _rest_xml_output(growing_buffer* buf, jsonObject* obj, char * obj_class, int arr_index, int notag) { char * tag; int i; @@ -75,7 +75,7 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int ar /* add class hints if we have a class name */ if(obj->classname) { - if(obj->is_null) { + if(obj->type == JSON_NULL) { buffer_fadd(buf,"<%s>", tag, obj->classname, tag); return; } else { @@ -85,48 +85,40 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int ar /* now add the data */ - if(obj->is_null) { + if(obj->type == JSON_NULL) { if (!notag) buffer_fadd(buf, "<%s/>",tag); - } else if(obj->is_bool && obj->bool_value) { + } else if(obj->type == JSON_BOOL && obj->value.b) { if (notag) buffer_add(buf, "true"); else buffer_fadd(buf, "<%s>true",tag,tag); - } else if(obj->is_bool && ! obj->bool_value) { + } else if(obj->type == JSON_BOOL && ! obj->value.b) { if (notag) buffer_add(buf, "false"); else buffer_fadd(buf, "<%s>false",tag,tag); - } else if (obj->is_string) { + } else if (obj->type == JSON_STRING) { if (notag) { - char * t = _escape_xml(obj->string_data); + char * t = _escape_xml(jsonObjectGetString(obj)); buffer_add(buf,t); free(t); } else { - char * t = _escape_xml(obj->string_data); + char * t = _escape_xml(jsonObjectGetString(obj)); buffer_fadd(buf,"<%s>%s",tag,t,tag); free(t); } - } else if(obj->is_number) { - - if (notag) - buffer_fadd(buf,"%ld",obj->num_value); - else - buffer_fadd(buf,"<%s>%ld",tag,obj->num_value,tag); - - - } else if(obj->is_double) { + } else if(obj->type == JSON_NUMBER) { if (notag) - buffer_fadd(buf,"%lf",tag,obj->double_value,tag); + buffer_fadd(buf,"%lf",tag, jsonObjectGetNumber(obj),tag); else - buffer_fadd(buf,"<%s>%lf",tag,obj->double_value,tag); + buffer_fadd(buf,"<%s>%lf",tag, jsonObjectGetNumber(obj),tag); - } else if (obj->is_array) { + } else if (obj->type == JSON_ARRAY) { if (!notag) { if(!isFieldmapper(obj_class)) buffer_add(buf,""); @@ -135,7 +127,7 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int ar } for( i = 0; i!= obj->size; i++ ) { - _rest_xml_output(buf, obj->get_index(obj,i), obj->classname, i,0); + _rest_xml_output(buf, jsonObjectGetIndex(obj,i), obj->classname, i,0); } if (!notag) { @@ -145,7 +137,7 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int ar buffer_fadd(buf,"",tag); } - } else if (obj->is_hash) { + } else if (obj->type == JSON_HASH) { if (!notag) { if(!obj_class) @@ -154,9 +146,9 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int ar buffer_fadd(buf,"<%s>",tag); } - object_iterator* itr = new_iterator(obj); - object_node* tmp; - while( (tmp = itr->next(itr)) ) { + jsonObjectIterator* itr = jsonNewObjectIterator(obj); + jsonObjectNode* tmp; + while( (tmp = jsonObjectIteratorNext(itr)) ) { if (notag) { buffer_fadd(buf,"<%s>",tmp->key); } else { @@ -172,7 +164,7 @@ void _rest_xml_output(growing_buffer* buf, object* obj, char * obj_class, int ar buffer_add(buf,""); } } - free_iterator(itr); + jsonObjectIteratorFree(itr); if (!notag) { if(!obj_class) diff --git a/Open-ILS/src/apachemods/mod_xmltools.c b/Open-ILS/src/apachemods/mod_xmltools.c index fee76e5a61..0eaa324a7c 100644 --- a/Open-ILS/src/apachemods/mod_xmltools.c +++ b/Open-ILS/src/apachemods/mod_xmltools.c @@ -77,7 +77,7 @@ static int mod_xmltools_handler (request_rec* r) { r->allowed |= (AP_METHOD_BIT << M_GET); r->allowed |= (AP_METHOD_BIT << M_POST); - ap_set_content_type(r, "text/html"); + ap_set_content_type(r, "text/html; charset=utf-8"); string_array* params = apacheParseParms(r); diff --git a/OpenSRF/src/gateway/Makefile b/OpenSRF/src/gateway/Makefile index 10d0b3eed2..96b5eed6f8 100644 --- a/OpenSRF/src/gateway/Makefile +++ b/OpenSRF/src/gateway/Makefile @@ -1,13 +1,13 @@ CCFLAGS += -DASSUME_STATELESS LDLIBS += -lobjson -lxml2 -lopensrf -all: libmod_ils_gateway.so +all: mod_ils_gateway.so install: - $(APXS2) -i -a -n ils_gateway libmod_ils_gateway.so + $(APXS2) -i -a -n ils_gateway mod_ils_gateway.so -libmod_ils_gateway.so: mod_ils_gateway.o - $(CC) -shared -W1 mod_ils_gateway.o -o libmod_ils_gateway.so +mod_ils_gateway.so: mod_ils_gateway.o + $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -shared -W1 mod_ils_gateway.o -o mod_ils_gateway.so mod_ils_gateway.o: mod_ils_gateway.h mod_ils_gateway.c -- 2.43.2