コード例 #1
0
ファイル: espFramework.c プロジェクト: WeiY/appweb-4
PUBLIC void espRenderConfig(HttpConn *conn)
{
    EspRoute    *eroute;
    MprJson     *settings;

    eroute = conn->rx->route->eroute;
    settings = mprLookupJson(eroute->config, "settings");
    if (settings) {
        renderString(mprJsonToString(eroute->config, MPR_JSON_QUOTES));
    } else {
        renderError(HTTP_CODE_NOT_FOUND, "Cannot find config.settings to send to client");
    }
    finalize();
}
コード例 #2
0
ファイル: espFramework.c プロジェクト: armagardon/esp
static cchar *getClientConfig(HttpConn *conn)
{
    HttpRoute   *route;
    MprJson     *mappings, *obj;

    conn = getConn();
    for (route = conn->rx->route; route; route = route->parent) {
        if (route->clientConfig) {
            return route->clientConfig;
        }
    }
    route = conn->rx->route;
    if ((obj = mprGetJsonObj(route->config, "esp.mappings")) != 0) {
        mappings = mprCreateJson(MPR_JSON_OBJ);
        copyMappings(route, mappings, obj);
        mprWriteJson(mappings, "prefix", route->prefix, 0);
        route->clientConfig = mprJsonToString(mappings, MPR_JSON_QUOTES);
    }
    return route->clientConfig;
}