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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
////////////////////////////////////////////////////////////////////////
// action/myaction.cpp
// generated with ecppc
//
#include <tnt/ecpp.h>
#include <tnt/httprequest.h>
#include <tnt/httpreply.h>
#include <tnt/httpheader.h>
#include <tnt/http.h>
#include <tnt/data.h>
#include <tnt/componentfactory.h>
#include <cxxtools/log.h>
#include <stdexcept>
log_define("component.action.myaction")
// <%pre>
#include <actionreply.h>
// </%pre>
namespace
{
class _component_ : public tnt::EcppComponent
{
_component_& main() { return *this; }
protected:
~_component_();
public:
_component_(const tnt::Compident& ci, const tnt::Urlmapper& um, tnt::Comploader& cl);
unsigned operator() (tnt::HttpRequest& request, tnt::HttpReply& reply, tnt::QueryParams& qparam);
};
static tnt::EcppComponentFactoryImpl<_component_> Factory("action/myaction");
// <%shared>
// </%shared>
// <%config>
// </%config>
#define SET_LANG(lang) \
do \
{ \
request.setLang(lang); \
reply.setLocale(request.getLocale()); \
} while (false)
_component_::_component_(const tnt::Compident& ci, const tnt::Urlmapper& um, tnt::Comploader& cl)
: EcppComponent(ci, um, cl)
{
// <%init>
// </%init>
}
_component_::~_component_()
{
// <%cleanup>
// </%cleanup>
}
template <typename T>
inline void _tnt_ignore_unused(const T&) { }
unsigned _component_::operator() (tnt::HttpRequest& request, tnt::HttpReply& reply, tnt::QueryParams& qparam)
{
log_trace("action/myaction " << qparam.getUrl());
#line 6 "action.ecpp"
typedef ActionReply actionReply_type;
TNT_REQUEST_FILE_VAR(ActionReply, actionReply, action.ecpp, ()); // <%request> ActionReply actionReply
_tnt_ignore_unused<actionReply_type>(actionReply);
// <%cpp>
// <%include> action.ecpp
// </%include>
#line 2 "action/myaction.ecpp"
// This is a example action, which just opens a notification in the browser.
actionReply.information("myaction executed");
// <%/cpp>
return DEFAULT;
}
} // namespace
|