diff options
author | randomdan <randomdan@localhost> | 2013-01-04 21:51:43 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2013-01-04 21:51:43 +0000 |
commit | 328c6ef1b6ce90b7330a51f2492460d3646b81cf (patch) | |
tree | d022eb571f940a4b65b6276188fc5b1ab0b55244 /project2/cgi | |
parent | Add missing include required for older versions of Boost (diff) | |
download | project2-328c6ef1b6ce90b7330a51f2492460d3646b81cf.tar.bz2 project2-328c6ef1b6ce90b7330a51f2492460d3646b81cf.tar.xz project2-328c6ef1b6ce90b7330a51f2492460d3646b81cf.zip |
Use media-type for content type of XSL transformed documents
Allow setting up a default transformation chain with default presenters
Remove mod_transform requirement from sites
Diffstat (limited to 'project2/cgi')
-rw-r--r-- | project2/cgi/cgiEnvironment.cpp | 4 | ||||
-rw-r--r-- | project2/cgi/cgiEnvironment.h | 2 | ||||
-rw-r--r-- | project2/cgi/cgiStagePresent.cpp | 11 |
3 files changed, 16 insertions, 1 deletions
diff --git a/project2/cgi/cgiEnvironment.cpp b/project2/cgi/cgiEnvironment.cpp index 7bb68d2..439f6d8 100644 --- a/project2/cgi/cgiEnvironment.cpp +++ b/project2/cgi/cgiEnvironment.cpp @@ -34,6 +34,10 @@ CgiEnvironment::CgiEnvironment() : cgiOptions ("cgi.defaultPresenter", Options::value(&defaultPresenter, "xml"), "The default engine for formatting presentations") + ("cgi.transformContentType", Options::value(&transformContentType, "text/xml-xslt"), + "The content type specified to enable standard internal transformations") + ("cgi.transformTargetType", Options::value(&transformTargetType, "htmldocument"), + "The transform target type used in standard internal transformations") ("cgi.defaultPresent", Options::value(&defaultPresent, "index"), "The present script to use when no other is specified") ("cgi.presentRoot", Options::value(&presentRoot, "present"), diff --git a/project2/cgi/cgiEnvironment.h b/project2/cgi/cgiEnvironment.h index cfe9c7b..6797a24 100644 --- a/project2/cgi/cgiEnvironment.h +++ b/project2/cgi/cgiEnvironment.h @@ -60,6 +60,8 @@ class CgiEnvironment : public Environment { Glib::ustring errorContentType; Glib::ustring errorTransformStyle; std::string defaultPresent; + std::string transformContentType; + std::string transformTargetType; std::string presentRoot; std::string requestRoot; std::string errorPresentRoot; diff --git a/project2/cgi/cgiStagePresent.cpp b/project2/cgi/cgiStagePresent.cpp index 8e4a6ff..c66f409 100644 --- a/project2/cgi/cgiStagePresent.cpp +++ b/project2/cgi/cgiStagePresent.cpp @@ -11,7 +11,16 @@ CgiApplicationEngine::PresentStage::PresentStage(ScriptReaderPtr s) : CommonObjects(s->root()), CheckHost(s->root()), ViewHost(s->root()), - presenter([root,this] { return PresenterLoader::getFor(this->env()->defaultPresenter)->create(root, Default); }) + presenter([root,this] { + auto p = PresenterLoader::getFor(this->env()->defaultPresenter)->create(root, Default); + auto xp = dynamic_cast<TransformSource *>(p); + auto cp = dynamic_cast<ContentPresenter *>(p); + if (xp && cp && cp->contentType == this->env()->transformContentType) { + auto h = TransformTargetLoader::getFor(this->env()->transformTargetType)->create(root, Default); + xp->addTarget(h, root); + } + return p; + }) { s->loader.addLoadTarget(s->root(), Storer::into<OutputOptionsLoader>(&outputOptions)); s->loader.addLoadTarget(s->root(), Storer::into<PresenterLoader>(&presenter, Scripted)); |