示例#1
0
int _ExecuteApp(HttpContextRef context, RouteRef route) {
	
	if (route->_application && !strcmp(route->_application,"AppManager")) {
		RAWLOG_INFO("Executing AppManager");
		return ExecuteAppManager(context,route);
	} else if (route->_application && !strcmp(route->_application,"system")) {
		if (context->_request->_method == METHOD_GET) {
			if (route->_model && !strcmp(route->_model,"geolocation")) {
				return HTTPSendReply(context,GeoGetLocation()); 	
			} else if (route->_model && !strcmp(route->_model,"syncdb")) {
				rho_sync_doSyncAllSources();
				return HTTPSendReply(context,"OK"); 	
			} else if (route->_model && !strcmp(route->_model,"redirect_to")) {
				if (context->_request->_query && !strncmp("url=",context->_request->_query,4)) {
					char* location = context->_request->_query+4;
					int len = strlen(location);
					HTTPUrlDecode(location, len, location, len+1);
					return HTTPRedirect(context, location);
				} else {
					return HTTPRedirect(context, "/app/");
				}
			}
		}
	} else if (route->_application && !strcmp(route->_application,"shared")) {
		return 0;
	} else {
		RAWLOG_INFO1( "Executing %s",route->_application);
		return _CallApplication(context, route);
	}
	return 0;
}
示例#2
0
int _ExecuteApp(HttpContextRef context, RouteRef route) {
	
	if (route->_application && !strcmp(route->_application,"AppManager")) {
		DBG(("Executing AppManager\n"));
		return ExecuteAppManager(context,route);
	} else if (route->_application && !strcmp(route->_application,"system")) {
		if (context->_request->_method == METHOD_GET) {
			if (route->_model && !strcmp(route->_model,"geolocation")) {
				return HTTPSendReply(context,GeoGetLocation()); 	
			} else if (route->_model && !strcmp(route->_model,"syncdb")) {
				wake_up_sync_engine();
				return HTTPSendReply(context,"OK"); 	
			}
		}
	} else if (route->_application && !strcmp(route->_application,"shared")) {
		return 0;
	} else {
		DBG(("Executing %s\n",route->_application));
		return _CallApplication(context, route);
	}
	return 0;
}