diff options
-rw-r--r-- | project2/cgi/cgiAppEngine.h | 5 | ||||
-rw-r--r-- | project2/cgi/cgiStageCustomError.cpp | 2 | ||||
-rw-r--r-- | project2/cgi/cgiStageCustomNotFound.cpp | 2 | ||||
-rw-r--r-- | project2/cgi/cgiStageInitial.cpp | 6 | ||||
-rw-r--r-- | project2/cgi/cgiStagePresent.cpp | 16 | ||||
-rw-r--r-- | project2/cgi/cgiStageRequest.cpp | 8 |
6 files changed, 16 insertions, 23 deletions
diff --git a/project2/cgi/cgiAppEngine.h b/project2/cgi/cgiAppEngine.h index e2ad1a2..8482181 100644 --- a/project2/cgi/cgiAppEngine.h +++ b/project2/cgi/cgiAppEngine.h @@ -80,7 +80,7 @@ class CgiApplicationEngine : public ApplicationEngine, public TransformChainLink /// Stage to process POST requests class RequestStage : public ResponseStage, TaskHost { public: - RequestStage(const CgiEnvironment *, const std::string & id); + RequestStage(const CgiEnvironment *, const boost::filesystem::path & path); virtual NextStage run(); virtual HttpHeaderPtr getHeader() const; @@ -91,8 +91,7 @@ class CgiApplicationEngine : public ApplicationEngine, public TransformChainLink /// Stage to process GET requests and follow up RequestStages class PresentStage : public virtual ResponseStage, ViewHost { public: - PresentStage(const CgiEnvironment * e, const std::string & id); - PresentStage(const CgiEnvironment * e, const std::string & group, const std::string & id); + PresentStage(const CgiEnvironment * e, const boost::filesystem::path & path); virtual NextStage run(); virtual HttpHeaderPtr getHeader() const; diff --git a/project2/cgi/cgiStageCustomError.cpp b/project2/cgi/cgiStageCustomError.cpp index 26fdf51..bc53c23 100644 --- a/project2/cgi/cgiStageCustomError.cpp +++ b/project2/cgi/cgiStageCustomError.cpp @@ -8,7 +8,7 @@ CgiApplicationEngine::CustomErrorStage::CustomErrorStage(const CgiEnvironment * ::XmlScriptParser(e->resolveScript(env->errorPresentRoot, env->onErrorPresent), false), ::CheckHost(e->resolveScript(env->errorPresentRoot, env->onErrorPresent)), CgiApplicationEngine::DefaultErrorStage(env, ex), - CgiApplicationEngine::PresentStage(env, env->errorPresentRoot, env->onErrorPresent) + CgiApplicationEngine::PresentStage(env, e->resolveScript(env->errorPresentRoot, env->onErrorPresent)) { } diff --git a/project2/cgi/cgiStageCustomNotFound.cpp b/project2/cgi/cgiStageCustomNotFound.cpp index 4f06c2e..e0c6bfc 100644 --- a/project2/cgi/cgiStageCustomNotFound.cpp +++ b/project2/cgi/cgiStageCustomNotFound.cpp @@ -8,7 +8,7 @@ CgiApplicationEngine::CustomNotFoundStage::CustomNotFoundStage(const CgiEnvironm ::XmlScriptParser(e->resolveScript(env->errorPresentRoot, env->notFoundPresent), false), ::CheckHost(e->resolveScript(env->errorPresentRoot, env->notFoundPresent)), CgiApplicationEngine::DefaultNotFoundStage(env, notfound), - CgiApplicationEngine::PresentStage(env, env->errorPresentRoot, env->notFoundPresent) + CgiApplicationEngine::PresentStage(env, e->resolveScript(env->errorPresentRoot, env->notFoundPresent)) { } diff --git a/project2/cgi/cgiStageInitial.cpp b/project2/cgi/cgiStageInitial.cpp index 7c7b198..348cbb9 100644 --- a/project2/cgi/cgiStageInitial.cpp +++ b/project2/cgi/cgiStageInitial.cpp @@ -16,10 +16,12 @@ CgiApplicationEngine::InitialStage::run() if (e->elems.empty()) { throw EmptyRequestURL(); } - return NextStage(new RequestStage(e, e->getRedirectURL())); + return NextStage(new RequestStage(e, e->resolveScript(e->requestRoot, + e->getRedirectURL()))); } else { - return NextStage(new PresentStage(e, e->elems.empty() ? e->defaultPresent : e->getRedirectURL())); + return NextStage(new PresentStage(e, e->resolveScript(e->presentRoot, + e->elems.empty() ? e->defaultPresent : e->getRedirectURL()))); } } diff --git a/project2/cgi/cgiStagePresent.cpp b/project2/cgi/cgiStagePresent.cpp index 4920623..44a344b 100644 --- a/project2/cgi/cgiStagePresent.cpp +++ b/project2/cgi/cgiStagePresent.cpp @@ -4,19 +4,11 @@ #include <boost/foreach.hpp> #include <boost/bind.hpp> -CgiApplicationEngine::PresentStage::PresentStage(const CgiEnvironment * e, const std::string & id) : +CgiApplicationEngine::PresentStage::PresentStage(const CgiEnvironment * e, const boost::filesystem::path & path) : CgiApplicationEngine::ResponseStage(e), - XmlScriptParser(e->resolveScript(e->presentRoot, id), false), - CheckHost(e->resolveScript(e->presentRoot, id)), - ViewHost(e->resolveScript(e->presentRoot, id)) -{ -} - -CgiApplicationEngine::PresentStage::PresentStage(const CgiEnvironment * e, const std::string & group, const std::string & id) : - CgiApplicationEngine::ResponseStage(e), - XmlScriptParser(e->resolveScript(group, id), false), - CheckHost(e->resolveScript(group, id)), - ViewHost(e->resolveScript(group, id)) + XmlScriptParser(path, false), + CheckHost(path), + ViewHost(path) { } diff --git a/project2/cgi/cgiStageRequest.cpp b/project2/cgi/cgiStageRequest.cpp index c53a172..a050146 100644 --- a/project2/cgi/cgiStageRequest.cpp +++ b/project2/cgi/cgiStageRequest.cpp @@ -4,11 +4,11 @@ #include "../xmlObjectLoader.h" #include <boost/foreach.hpp> -CgiApplicationEngine::RequestStage::RequestStage(const CgiEnvironment * e, const std::string & id) : - XmlScriptParser(e->resolveScript(e->requestRoot, id), false), - ::CheckHost(e->resolveScript(e->requestRoot, id)), +CgiApplicationEngine::RequestStage::RequestStage(const CgiEnvironment * e, const boost::filesystem::path & path) : + XmlScriptParser(path, false), + ::CheckHost(path), CgiApplicationEngine::ResponseStage(e), - ::TaskHost(e->resolveScript(e->requestRoot, id)) + ::TaskHost(path) { xmlpp::Element * requestRoot = get_document()->get_root_node(); present = requestRoot->get_attribute_value("present"); |