/* * Dynamic module initialization */ MprModule *maEgiHandlerInit(MaHttp *http, cchar *path) { MprModule *module; MaStage *handler; MaEgi *egi; module = mprCreateModule(http, "egiHandler", BLD_VERSION, NULL, NULL, NULL); if (module == 0) { return 0; } handler = maCreateHandler(http, "egiHandler", MA_STAGE_GET | MA_STAGE_HEAD | MA_STAGE_POST | MA_STAGE_PUT | MA_STAGE_FORM_VARS | MA_STAGE_ENV_VARS | \ MA_STAGE_VIRTUAL); if (handler == 0) { mprFree(module); return 0; } http->egiHandler = handler; handler->run = runEgi; handler->stageData = egi = mprAllocObjZeroed(handler, MaEgi); egi->forms = mprCreateHash(egi, MA_EGI_HASH_SIZE); #if EGI_TEST egiTestInit(http, path); #endif return module; }
/* * Dynamic module initialization */ MprModule *maEjsHandlerInit(MaHttp *http, cchar *path) { MprModule *module; MaStage *handler; EjsWebControl *control; module = mprCreateModule(http, "ejsHandler", BLD_VERSION, 0, 0, 0); if (module == 0) { return 0; } handler = maCreateHandler(http, "ejsHandler", MA_STAGE_GET | MA_STAGE_HEAD | MA_STAGE_POST | MA_STAGE_PUT | MA_STAGE_FORM_VARS | MA_STAGE_VIRTUAL); if (handler == 0) { mprFree(module); return 0; } http->ejsHandler = handler; handler->match = matchEjs; handler->run = runEjs; handler->parse = parseEjs; /* * Setup the control block */ handler->stageData = control = mprAllocObjZeroed(handler, EjsWebControl); control->defineParams = defineParams; control->discardOutput = discardOutput; control->error = error; control->getHeader = getHeader; control->getVar = getVar; control->redirect = redirect; control->setCookie = setCookie; control->setHeader = setHeader; control->setHttpCode = setHttpCode; control->setMimeType = setMimeType; control->write = writeBlock; control->modulePath = mprStrdup(control, path); #if BLD_FEATURE_MULTITHREAD && FUTURE /* * This mutex is used very sparingly and must be an application global lock. */ mutex = mprCreateLock(control); control->lock = ejsWebLock; control->unlock = ejsWebUnlock; control->lockData = mutex; #endif if (ejsOpenWebFramework(control, 1) < 0) { return 0; } return module; }
/* Dynamic module initialization */ MprModule *maCgiHandlerInit(MaHttp *http, cchar *path) { MprModule *module; MaStage *handler; if ((module = mprCreateModule(http, "cgiHandler", BLD_VERSION, NULL, NULL, NULL)) == NULL) { return 0; } handler = maCreateHandler(http, "cgiHandler", MA_STAGE_ALL | MA_STAGE_VARS | MA_STAGE_ENV_VARS | MA_STAGE_PATH_INFO | MA_STAGE_MISSING_EXT); if (handler == 0) { mprFree(module); return 0; } http->cgiHandler = handler; handler->close = closeCgi; handler->start = startCgi; handler->incomingData = incomingCgiData; handler->run = runCgi; handler->parse = parseCgi; return module; }
/* * Dynamic module initialization */ MprModule *maDirHandlerInit(MaHttp *http, cchar *path) { MprModule *module; MaStage *handler; Dir *dir; module = mprCreateModule(http, "dirHandler", BLD_VERSION, NULL, NULL, NULL); if (module == 0) { return 0; } handler = maCreateHandler(http, "dirHandler", MA_STAGE_GET | MA_STAGE_HEAD); if (handler == 0) { mprFree(module); return 0; } handler->match = matchDir; handler->run = runDir; handler->parse = parseDir; handler->stageData = dir = mprAllocObjZeroed(handler, Dir); dir->sortOrder = 1; http->dirHandler = handler; return module; }