rest_gateway: libmod_ils_rest_gateway.so
install:
- cp $(TMPDIR)/libmod_ils_gateway.so $(LIBDIR)/libmod_ils_gateway.so
cp gateway.xml.example $(ETCDIR)
- $(APXS2) -i -a -n ils_gateway $(LIBDIR)/libmod_ils_gateway.so
+ $(APXS2) -i -a -n ils_gateway $(TMPDIR)/libmod_ils_gateway.so
+ $(APXS2) -i -a -n ils_rest_gateway $(TMPDIR)/libmod_ils_rest_gateway.so
libmod_ils_gateway.so: mod_ils_gateway.c
$(CC) -c $(CC_OPTS) mod_ils_gateway.c
./fieldmapper-c-xml-out.pl rest_xml.h rest_xml.c
$(CC) -c $(CC_OPTS) -o rest_xml.o rest_xml.c
$(CC) -c -DRESTGATEWAY $(CC_OPTS) -o mod_ils_rest_gateway.o mod_ils_gateway.c
- $(CC) $(LD_OPTS) -shared -W1 mod_ils_rest_gateway.o -o $(TMPDIR)/libmod_ils_rest_gateway.so
+ $(CC) $(LD_OPTS) -shared -W1 rest_xml.o mod_ils_rest_gateway.o -o $(TMPDIR)/libmod_ils_rest_gateway.so
clean:
/bin/rm -f *.o *.so
#ifdef RESTGATEWAY
#include "rest_xml.h"
-#endif
/*
* This function is registered as a handler for HTTP methods and will
* STDERR (which httpd redirects to logs/error_log). A real module
* would do *alot* more at this point.
*/
+#define MODULE_NAME "ils_rest_gateway_module"
+#else
#define MODULE_NAME "ils_gateway_module"
+#endif
/*
struct session_list_struct {
return HTTP_INTERNAL_SERVER_ERROR;
}
- /* set content type to text/plain for passing around JSON objects */
- ap_set_content_type(r, "text/plain");
-
/* gather the post args and append them to the url query string */
free_object(exception);
} else {
#ifdef RESTGATEWAY
+ /* set content type to text/xml for passing around XML objects */
+ ap_set_content_type(r, "text/xml");
+
content = json_string_to_xml( buffer_data(result_data) );
#else
+ /* set content type to text/plain for passing around JSON objects */
+ ap_set_content_type(r, "text/plain");
+
content = buffer_data(result_data);
#endif
}
* only "glue" between the httpd core and the module.
*/
+#ifdef RESTGATEWAY
+
+module AP_MODULE_DECLARE_DATA ils_rest_gateway_module =
+{
+STANDARD20_MODULE_STUFF,
+NULL,
+NULL,
+NULL,
+NULL,
+NULL,
+mod_ils_gateway_register_hooks,
+};
+
+#else
+
module AP_MODULE_DECLARE_DATA ils_gateway_module =
{
STANDARD20_MODULE_STUFF,
mod_ils_gateway_register_hooks,
};
+#endif
+