NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
载入中...
搜索中...
未找到
neforce::http::http_filter_chain类 参考

HTTP过滤器链 更多...

#include <http_filter.hpp>

Public 成员函数

void add_filter (unique_ptr< http_filter > filter)
 添加过滤器(转移所有权)
void add_filter_ref (http_filter *filter)
 添加过滤器(不转移所有权)
void clear () noexcept
 清空所有过滤器
size_t size () const noexcept
 获取过滤器数量
bool empty () const noexcept
 检查过滤器链是否为空
bool execute_pre_filters (http_request &request, http_response &response)
 执行所有预过滤器
void execute_post_filters (http_request &request, http_response &response)
 执行所有后过滤器
void execute_pre_filters_async (http_request &request, http_response &response, http_context &ctx, function< void(bool)> next)
 异步执行所有预过滤器(回调链模式)
void execute_post_filters_async (http_request &request, http_response &response, http_context &ctx, function< void()> next)
 异步执行所有后过滤器(回调链模式)
void execute_filters (http_request &request, http_response &response)
 执行所有核心过滤器

详细描述

HTTP过滤器链

管理多个过滤器的有序执行,支持预过滤、后过滤和核心过滤。

在文件 http_filter.hpp94 行定义.

成员函数说明

◆ add_filter()

void neforce::http::http_filter_chain::add_filter ( unique_ptr< http_filter > filter)

添加过滤器(转移所有权)

参数
filter过滤器智能指针

◆ add_filter_ref()

void neforce::http::http_filter_chain::add_filter_ref ( http_filter * filter)

添加过滤器(不转移所有权)

参数
filter过滤器原始指针

◆ empty()

bool neforce::http::http_filter_chain::empty ( ) const
inlinenodiscardnoexcept

检查过滤器链是否为空

返回
为空返回true

在文件 http_filter.hpp139 行定义.

◆ execute_filters()

void neforce::http::http_filter_chain::execute_filters ( http_request & request,
http_response & response )

执行所有核心过滤器

参数
requestHTTP请求
responseHTTP响应

◆ execute_post_filters()

void neforce::http::http_filter_chain::execute_post_filters ( http_request & request,
http_response & response )

执行所有后过滤器

参数
requestHTTP请求
responseHTTP响应

◆ execute_post_filters_async()

void neforce::http::http_filter_chain::execute_post_filters_async ( http_request & request,
http_response & response,
http_context & ctx,
function< void()> next )

异步执行所有后过滤器(回调链模式)

参数
requestHTTP请求
responseHTTP响应
ctx请求上下文
next所有过滤器完成后调用

引用了 neforce::next().

◆ execute_pre_filters()

bool neforce::http::http_filter_chain::execute_pre_filters ( http_request & request,
http_response & response )

执行所有预过滤器

参数
requestHTTP请求
responseHTTP响应
返回
所有预过滤器都通过返回true

◆ execute_pre_filters_async()

void neforce::http::http_filter_chain::execute_pre_filters_async ( http_request & request,
http_response & response,
http_context & ctx,
function< void(bool)> next )

异步执行所有预过滤器(回调链模式)

参数
requestHTTP请求
responseHTTP响应
ctx请求上下文
next所有过滤器通过后调用 next(true),任一中断调用 next(false)

引用了 neforce::next().

◆ size()

size_t neforce::http::http_filter_chain::size ( ) const
inlinenodiscardnoexcept

获取过滤器数量

返回
过滤器数量

在文件 http_filter.hpp133 行定义.

引用了 size().

被这些函数引用 size().


该类的文档由以下文件生成: