Loading...
Searching...
No Matches
tactioncontroller.h
Go to the documentation of this file.
21class T_CORE_EXPORT TActionController : public TAbstractController, public TActionHelper, protected TAccessValidator {
34 QString getRenderingData(const QString &templateName, const QVariantMap &vars = QVariantMap()) override;
62 void setFlashValidationErrors(const TFormValidator &validator, const QString &prefix = QString("err_"));
66 bool addCookie(const QByteArray &name, const QByteArray &value, const QDateTime &expire = QDateTime(), const QString &path = QString(), const QString &domain = QString(), bool secure = false, bool httpOnly = false, const QByteArray &sameSite = "Lax") override;
67 bool addCookie(const QByteArray &name, const QByteArray &value, int64_t maxAge, const QString &path = QString(), const QString &domain = QString(), bool secure = false, bool httpOnly = false, const QByteArray &sameSite = "Lax") override;
72 bool renderText(const QString &text, bool layoutEnable = false, const QString &layout = QString());
83 bool renderAndCache(const QByteArray &key, int seconds, const QString &action = QString(), const QString &layout = QString());
86 bool renderCbor(const QVariant &variant, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
87 bool renderCbor(const QVariantMap &map, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
88 bool renderCbor(const QVariantHash &hash, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
89 bool renderCbor(const QCborValue &value, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
90 bool renderCbor(const QCborMap &map, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
91 bool renderCbor(const QCborArray &array, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
94 bool sendFile(const QString &filePath, const QByteArray &contentType, const QString &name = QString(), bool autoRemove = false);
The TAbstractController class is the abstract base class of controllers, providing functionality comm...
Definition tabstractcontroller.h:13
virtual QStringList arguments() const
Definition tabstractcontroller.h:20
virtual QString getRenderingData(const QString &templateName, const QVariantMap &vars=QVariantMap())
Definition tabstractcontroller.cpp:95
virtual void setFlash(const QString &name, const QVariant &value)
Definition tabstractcontroller.cpp:89
virtual bool addCookie(const TCookie &cookie)
Definition tabstractcontroller.cpp:125
virtual const THttpRequest & request() const
Definition tabstractcontroller.cpp:107
virtual QByteArray authenticityToken() const
Definition tabstractcontroller.h:25
virtual QString name() const =0
This function is reimplemented in subclasses to return a controller name.
virtual bool isUserLoggedIn() const
Returns true if a user is logged in to the system; otherwise returns false.
Definition tabstractcontroller.cpp:148
virtual QString activeAction() const =0
This function is reimplemented in subclasses to return a active action name.
The TAbstractUser class is the abstract base class of users, providing functionality common to users.
Definition tabstractuser.h:6
The TAccessValidator class provides validation of user access.
Definition taccessvalidator.h:11
The TActionController class is the base class of all action controllers.
Definition tactioncontroller.h:21
void rollbackTransaction()
This function is called to rollback a transaction on the database.
Definition tactioncontroller.h:96
const THttpRequest & httpRequest() const override
Definition tactioncontroller.h:30
virtual void setAccessRules()
Sets rules of access to this controller.
Definition tactioncontroller.h:109
virtual void postFilter()
This function is called after actions on the controller are performed.
Definition tactioncontroller.h:54
THttpResponse & httpResponse()
Returns a HTTP response to be sent.
Definition tactioncontroller.h:113
void setStatusCode(int code)
Sets the status code to code.
Definition tactioncontroller.h:197
QString activeAction() const override
Returns the active action name.
Definition tactioncontroller.h:162
bool layoutEnabled() const
Returns true if the layout mechanism is enabled; otherwise returns false.
Definition tactioncontroller.h:187
const TSession & session() const override
Returns the current HTTP session, allows associating information with individual visitors.
Definition tactioncontroller.h:33
TSession & session() override
Returns the current HTTP session, allows associating information with individual visitors.
Definition tactioncontroller.h:63
QString name() const override
Returns the controller name.
Definition tactioncontroller.cpp:64
QStringList arguments() const override
Definition tactioncontroller.h:167
const THttpResponse & httpResponse() const
Returns a HTTP response to be sent.
Definition tactioncontroller.h:32
virtual bool transactionEnabled() const
Must be overridden by subclasses to disable transaction mechanism.
Definition tactioncontroller.h:38
QString flash(const QString &name) const
Returns the flash message for name.
Definition tactioncontroller.h:202
void setContentType(const QByteArray &type)
Sets the content type specified by type for a response message.
Definition tactioncontroller.h:212
virtual bool preFilter()
This function is called before actions on the controller are performed, therefore can be overridden b...
Definition tactioncontroller.h:53
void setLayoutDisabled(bool disable)
Disables the layout mechanism if disable is true, otherwise enables it.
Definition tactioncontroller.h:182
int statusCode() const
Returns the status code of the HTTP response to be sent.
Definition tactioncontroller.h:61
virtual bool sessionEnabled() const
Must be overridden by subclasses to enable a HTTP session.
Definition tactioncontroller.h:35
void setLayoutEnabled(bool enable)
Enables the layout mechanism if enable is true, otherwise disables it.
Definition tactioncontroller.h:177
virtual QStringList exceptionActionsOfCsrfProtection() const
Must be overridden by subclasses to return a string list of actions excluded from CSRF protection whe...
Definition tactioncontroller.h:37
QString layout() const
Returns the name of the layout template.
Definition tactioncontroller.h:192
QByteArray contentType() const
Returns the content type for a response message.
Definition tactioncontroller.h:207
virtual bool csrfProtectionEnabled() const
Must be overridden by subclasses to disable CSRF protection.
Definition tactioncontroller.h:36
virtual const TAbstractController * controller() const =0
The TActionView class is the abstract base class of views, providing functionality common to view.
Definition tactionview.h:14
The TFormValidator class provides form validation for a map-table-based dictionary.
Definition tformvalidator.h:9
The THttpRequest class contains request information for HTTP.
Definition thttprequest.h:34
The THttpResponse class contains response information for HTTP.
Definition thttpresponse.h:10
THttpResponseHeader & header()
Return the HTTP header.
Definition thttpresponse.h:16
void setContentType(const QByteArray &type)
Sets the value of the header field content-type to type.
Definition tinternetmessageheader.cpp:123
QByteArray contentType() const
Returns the value of the header field content-type.
Definition tinternetmessageheader.cpp:115
The TSession class holds information associated with individual visitors.
Definition tsession.h:7
