diff options
author | randomdan <randomdan@localhost> | 2011-02-28 19:22:20 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2011-02-28 19:22:20 +0000 |
commit | 561995d123f1ee04296cfa2f2aef07ceccb4c617 (patch) | |
tree | 4871987d8ae149bef20a3d62c13ea3dd1d2c627d /project2/cgi | |
parent | Add support for a timeout, settable in ms, defaulting to 6000, for xslRows (diff) | |
download | project2-561995d123f1ee04296cfa2f2aef07ceccb4c617.tar.bz2 project2-561995d123f1ee04296cfa2f2aef07ceccb4c617.tar.xz project2-561995d123f1ee04296cfa2f2aef07ceccb4c617.zip |
Add support for local error handling
Diffstat (limited to 'project2/cgi')
-rw-r--r-- | project2/cgi/cgiAppEngine.cpp | 23 | ||||
-rw-r--r-- | project2/cgi/cgiAppEngine.h | 5 |
2 files changed, 7 insertions, 21 deletions
diff --git a/project2/cgi/cgiAppEngine.cpp b/project2/cgi/cgiAppEngine.cpp index 043da76..9f7665d 100644 --- a/project2/cgi/cgiAppEngine.cpp +++ b/project2/cgi/cgiAppEngine.cpp @@ -97,6 +97,7 @@ CgiApplicationEngine::write(std::ostream & IO) const xmlOutputBufferPtr out = xmlOutputBufferCreateIO( xmlWrite, NULL, &IO, xmlGetCharEncodingHandler(XML_CHAR_ENCODING_UTF8)); xmlSaveFileTo(out, currentStage->getDataDocument()->cobj(), "utf-8"); + sessionsContainer->CleanUp(); #ifndef NDEBUG if (!_env->dumpdatadoc.empty()) { currentStage->getDataDocument()->write_to_file_formatted(_env->dumpdatadoc); @@ -146,7 +147,6 @@ CgiApplicationEngine::PresentStage::run() } } execute(); - sessionsContainer->CleanUp(); return NULL; } @@ -204,6 +204,8 @@ CgiApplicationEngine::RequestStage::RequestStage(const std::string & id) XmlScriptParser request("request", id, false); xmlpp::Element * requestRoot = request.get_document()->get_root_node(); present = requestRoot->get_attribute_value("present"); + rollbackBeforeHandle = requestRoot->get_attribute_value("rollbackBeforeHandle") == "true"; + localErrorHandling = requestRoot->get_attribute_value("errorHandling") == "local"; LoaderBase loader("http://project2.randomdan.homeip.net", true); loader.supportedStorers.insert(Storer::into(¶meterChecks)); @@ -222,23 +224,8 @@ CgiApplicationEngine::RequestStage::run() return new PresentStage(pc->present); } } - try { - BOOST_FOREACH(const Tasks::value_type & t, tasks.get<bySOOrder>()) { - t->execute(); - } - // Commit data source transactions (without invoking a connection) - BOOST_FOREACH(const DataSources::value_type & ds, datasources) { - ds->commit(); - } - return present.empty() ? NULL : new PresentStage(present); - } - catch (...) { - // Do something about the error - BOOST_FOREACH(const DataSources::value_type & ds, datasources) { - ds->rollback(); - } - throw; - } + RequestHost::run(); + return present.empty() ? NULL : new PresentStage(present); } CgiApplicationEngine::HttpHeaderPtr diff --git a/project2/cgi/cgiAppEngine.h b/project2/cgi/cgiAppEngine.h index 79638f4..65142b6 100644 --- a/project2/cgi/cgiAppEngine.h +++ b/project2/cgi/cgiAppEngine.h @@ -7,6 +7,7 @@ #include "../xmlPresenter.h" #include "../commonObjects.h" #include "../uuid.h" +#include "../requestHost.h" #include <boost/intrusive_ptr.hpp> class CgiEnvironment; @@ -52,7 +53,7 @@ class CgiApplicationEngine : public ApplicationEngine { virtual HttpHeaderPtr getHeader() const = 0; }; - class RequestStage : public Stage, public XmlPresenter { + class RequestStage : public Stage, public XmlPresenter, RequestHost { public: RequestStage(const std::string & id); virtual ~RequestStage(); @@ -67,8 +68,6 @@ class CgiApplicationEngine : public ApplicationEngine { std::string present; typedef Storage<ParamChecker>::Objects ParamCheckers; ParamCheckers parameterChecks; - typedef Storage<NoOutputExecute>::Objects Tasks; - Tasks tasks; private: static const Glib::ustring resp; |