mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-25 09:25:57 +02:00
integrate PageCompiler changes from poco-1.7.9
This commit is contained in:
parent
fe7230a6d5
commit
e4014e88b7
@ -1,7 +1,7 @@
|
||||
//
|
||||
// ApacheCodeWriter.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/PageCompiler/src/ApacheCodeWriter.cpp#1 $
|
||||
// $Id: //poco/1.7/PageCompiler/src/ApacheCodeWriter.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// ApacheCodeWriter.h
|
||||
//
|
||||
// $Id: //poco/1.4/PageCompiler/src/ApacheCodeWriter.h#1 $
|
||||
// $Id: //poco/1.7/PageCompiler/src/ApacheCodeWriter.h#3 $
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// CodeWriter.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/PageCompiler/src/CodeWriter.cpp#3 $
|
||||
// $Id: //poco/1.7/PageCompiler/src/CodeWriter.cpp#4 $
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@ -351,7 +351,7 @@ void CodeWriter::writeContent(std::ostream& ostr)
|
||||
if (buffered)
|
||||
{
|
||||
ostr << "\tstd::stringstream responseStream;\n";
|
||||
ostr << _page.handler().str();
|
||||
ostr << cleanupHandler(_page.handler().str());
|
||||
if (!chunked)
|
||||
{
|
||||
ostr << "\tresponse.setContentLength(static_cast<int>(responseStream.tellp()));\n";
|
||||
@ -363,13 +363,31 @@ void CodeWriter::writeContent(std::ostream& ostr)
|
||||
ostr << "\tstd::ostream& _responseStream = response.send();\n"
|
||||
<< "\tPoco::DeflatingOutputStream _gzipStream(_responseStream, Poco::DeflatingStreamBuf::STREAM_GZIP, " << compressionLevel << ");\n"
|
||||
<< "\tstd::ostream& responseStream = _compressResponse ? _gzipStream : _responseStream;\n";
|
||||
ostr << _page.handler().str();
|
||||
ostr << cleanupHandler(_page.handler().str());
|
||||
ostr << "\tif (_compressResponse) _gzipStream.close();\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
ostr << "\tstd::ostream& responseStream = response.send();\n";
|
||||
ostr << _page.handler().str();
|
||||
ostr << cleanupHandler(_page.handler().str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string CodeWriter::cleanupHandler(std::string handler)
|
||||
{
|
||||
static const std::string EMPTY_WRITE("\tresponseStream << \"\";\n");
|
||||
static const std::string NEWLINE_WRITE("\tresponseStream << \"\\n\";\n");
|
||||
static const std::string DOUBLE_NEWLINE_WRITE("\tresponseStream << \"\\n\";\n\tresponseStream << \"\\n\";\n");
|
||||
static const std::string EMPTY;
|
||||
|
||||
// remove empty writes
|
||||
Poco::replaceInPlace(handler, EMPTY_WRITE, EMPTY);
|
||||
// remove consecutive newlines
|
||||
while (handler.find(DOUBLE_NEWLINE_WRITE) != std::string::npos)
|
||||
{
|
||||
Poco::replaceInPlace(handler, DOUBLE_NEWLINE_WRITE, NEWLINE_WRITE);
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// CodeWriter.h
|
||||
//
|
||||
// $Id: //poco/1.4/PageCompiler/src/CodeWriter.h#1 $
|
||||
// $Id: //poco/1.7/PageCompiler/src/CodeWriter.h#4 $
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
@ -67,6 +67,7 @@ protected:
|
||||
void handlerClass(std::ostream& ostr, const std::string& base, const std::string& ctorArg);
|
||||
void factoryClass(std::ostream& ostr, const std::string& base);
|
||||
void factoryImpl(std::ostream& ostr, const std::string& arg);
|
||||
std::string cleanupHandler(std::string handler);
|
||||
|
||||
private:
|
||||
CodeWriter();
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// OSPCodeWriter.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/PageCompiler/src/OSPCodeWriter.cpp#3 $
|
||||
// $Id: //poco/1.7/PageCompiler/src/OSPCodeWriter.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// OSPCodeWriter.h
|
||||
//
|
||||
// $Id: //poco/1.4/PageCompiler/src/OSPCodeWriter.h#1 $
|
||||
// $Id: //poco/1.7/PageCompiler/src/OSPCodeWriter.h#3 $
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// Page.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/PageCompiler/src/Page.cpp#2 $
|
||||
// $Id: //poco/1.7/PageCompiler/src/Page.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// Page.h
|
||||
//
|
||||
// $Id: //poco/1.4/PageCompiler/src/Page.h#2 $
|
||||
// $Id: //poco/1.7/PageCompiler/src/Page.h#3 $
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// PageCompiler.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/PageCompiler/src/PageCompiler.cpp#4 $
|
||||
// $Id: //poco/1.7/PageCompiler/src/PageCompiler.cpp#5 $
|
||||
//
|
||||
// A compiler that compiler HTML pages containing JSP directives into C++ classes.
|
||||
//
|
||||
@ -206,7 +206,7 @@ protected:
|
||||
helpFormatter.setHeader(
|
||||
"\n"
|
||||
"The POCO C++ Server Page Compiler.\n"
|
||||
"Copyright (c) 2008-2016 by Applied Informatics Software Engineering GmbH.\n"
|
||||
"Copyright (c) 2008-2017 by Applied Informatics Software Engineering GmbH.\n"
|
||||
"All rights reserved.\n\n"
|
||||
"This program compiles web pages containing embedded C++ code "
|
||||
"into a C++ class that can be used with the HTTP server "
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// PageReader.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/PageCompiler/src/PageReader.cpp#1 $
|
||||
// $Id: //poco/1.7/PageCompiler/src/PageReader.cpp#3 $
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// PageReader.h
|
||||
//
|
||||
// $Id: //poco/1.4/PageCompiler/src/PageReader.h#1 $
|
||||
// $Id: //poco/1.7/PageCompiler/src/PageReader.h#3 $
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
|
Loading…
x
Reference in New Issue
Block a user