10 #include <Cutelyst/Context>
11 #include <Cutelyst/Response>
13 #include <QtCore/QLoggingCategory>
14 #include <QtCore/QVariant>
32 return Component::OnlyExecute;
35 bool View::doExecute(
Context *c)
45 if (Q_UNLIKELY(c->
error())) {
46 const auto errors = c->
errors();
47 for (
const QString &error : errors) {
48 qCCritical(CUTELYST_VIEW) << error;
52 if (d->minimalSizeToDeflate >= 0 && output.
count() > d->minimalSizeToDeflate &&
55 compressedData.
remove(0, 6);
56 compressedData.
chop(4);
58 response->
setBody(compressedData);
68 d->minimalSizeToDeflate = minSize;
70 #include "moc_view.cpp"
The Cutelyst Component base class.
QString name() const noexcept
void setName(const QString &name)
QStringList errors() const noexcept
bool error() const noexcept
Response * response() const noexcept
QByteArray header(QByteArrayView key) const noexcept
bool hasBody() const noexcept
Headers & headers() noexcept
void setBody(QIODevice *body)
Abstract View component for Cutelyst.
virtual QByteArray render(Context *c) const =0
View(QObject *parent, const QString &name)
void setMinimalSizeToDeflate(qint32 minSize=-1)
Modifiers modifiers() const override
The Cutelyst namespace holds all public Cutelyst API.
qsizetype count() const const
bool contains(QByteArrayView bv) const const
QByteArray & remove(qsizetype pos, qsizetype len)
QByteArray toLower() const const