File: actionmain.ecpp

package info (click to toggle)
tntnet 3.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,488 kB
  • sloc: cpp: 16,636; javascript: 8,109; ansic: 2,189; makefile: 861; sh: 317; xml: 258; perl: 159; sql: 14
file content (36 lines) | stat: -rw-r--r-- 757 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<%pre>

#include "actionreply.h"
#include <cxxtools/json.h>
#include <tnt/httperror.h>

</%pre>
<%include>action.ecpp</%include>
<%cpp>

// A action is a http request, which do not expect any output other than
// success or failure or notifications.

try
{
    // call the actual action component
    unsigned ret = callComp("action/" + request.getArg("next"), request, reply, qparam);

    log_debug("action <" << request.getArg("next") << "> http return code " << ret);
    if (ret > HTTP_OK)
        return ret;
}
catch (const tnt::HttpError& e)
{
    throw;
}
catch (const std::exception& e)
{
    log_warn(e.what());
    actionReply.setFailed(e.what());
}

reply.setContentType("application/json");
reply.out() << cxxtools::Json(actionReply);

</%cpp>