30 #include <sys/types.h>
49 #define COMMAND_LEN 128
58 char functionName[
COMMAND_LEN + this->nprefix * 10];
66 HttpResponse response;
68 if (
'/' != request->uri[0]) {
76 command = &(request->uri[1]);
77 command[0] = toupper(command[0]);
82 tmp = strchr(command,
'/');
84 ncommand = strlen(command);
86 ncommand = tmp - command;
89 memcpy(functionName, this->prefix, this->nprefix);
90 memcpy(&(functionName[this->nprefix]),
103 switch (request->method_id) {
106 strcpy(&(functionName[this->nprefix + ncommand]),
"Read");
110 args = request->post;
111 strcpy(&(functionName[this->nprefix + ncommand]),
"Create");
115 args = request->post;
116 strcpy(&(functionName[this->nprefix + ncommand]),
"Update");
120 strcpy(&(functionName[this->nprefix + ncommand]),
"Delete");
135 function = dlsym(this->handle, functionName);
234 if (NULL ==
function) {
241 if (NULL != (error = dlerror())) {
254 response_data =
function(this->application, sess, args);
256 switch (request->method_id) {
269 if (NULL != response_data) {
HttpResponse httpResponseJson(const char *, size_t)
HttpResponse routerRoute(Router this, HttpRequest request, Session sess)
char *(* fptr_routable)(Application, Session, Hash)
HttpResponse httpResponse404()