コード例 #1
0
ファイル: output.c プロジェクト: WeiY/appweb-4
/*
    Action to run in response to the "test/output" URI
 */
static void output_action() 
{ 
    Output  *output;

    /*
        Don't automatically finalize (complete) the request when this routine returns. This keeps the connection open.
     */
    dontAutoFinalize();

    /*
        Define the event notifier. We're interested in WRITABLE events
     */
    setNotifier(output_callback);

    /*
        Open a file for output. Could use open/write, but we use the MPR equivalents for cross-platform I/O.
     */
    output = mprAllocObj(Output, manageOutput);
    if ((output->file = mprOpenFile(OUTPUT_FILE, O_RDONLY, 0)) == 0) {
        httpError(getConn(), HTTP_CODE_INTERNAL_SERVER_ERROR, "Cannot open huge.txt");
        return;
    }
    mprGetPathInfo(OUTPUT_FILE, &output->info);
    /*
        Save a reference to our output state
     */ 
    setData(output);
}
コード例 #2
0
ファイル: echo.c プロジェクト: DavionKnight/RtFileSystem
/*
    Action to run in response to the "test/echo" URI
 */
static void echo_action() { 
    /*
        Don't automatically finalize (complete) the request when this routine returns. This keeps the connection open.
     */
    dontAutoFinalize();

    /*
        Establish the event callback
     */
    espSetNotifier(getConn(), echo_callback);
}
コード例 #3
0
ファイル: websockets.c プロジェクト: kamihouse/appweb-4
static void echo_action() {
    dontAutoFinalize();
    httpSetConnNotifier(getConn(), echo_callback);
}
コード例 #4
0
ファイル: websockets.c プロジェクト: kamihouse/appweb-4
static void dummy_action() {
    dontAutoFinalize();
    httpSetConnNotifier(getConn(), dummy_callback);
}
コード例 #5
0
ファイル: demo.c プロジェクト: gamman/appweb-4
static void first() {
    dontAutoFinalize();
    render("Hello ");
    setTimeout(second, 5000, getConn());
    flush();
}