WildFly 表达式变量
WildFly expression variables
是否有 WildFly 网络配置表达式(例如重写过滤器)支持的完整变量列表?喜欢 %U、%h、%p...
<filters>
<rewrite name="http-to-https" redirect="true" target="https://myhostname:8443%U"/>
</filters>
<server name="default-server">
<host name="default-host" alias="localhost">
...
<filter-ref name="http-to-https" predicate="equals(%p,8080)"/>
这些是AccessLogHandler.java
用于日志的属性。
%a - 远程 IP 地址
%A - 本地 IP 地址
%b - 发送的字节数,不包括 HTTP headers,如果没有字节则为 '-'
被发送
%B - 发送的字节数,不包括 HTTP headers
%h - 远程主机名
%H - 请求协议
%l - 来自 identd 的远程逻辑用户名(总是 returns '-')
%m - 请求方式
%p - 本地端口
%q - 查询字符串(不包括 '?' 字符)
%r - 请求的第一行
%s - 响应的 HTTP 状态代码
%t - 日期和时间,采用通用日志格式
%u - 已通过身份验证的远程用户
%U - 请求的 URL 路径
%v - 本地服务器名称
%D - 处理请求所花费的时间,以毫秒为单位
%T - 处理请求所花费的时间,以秒为单位
%I - 当前请求线程名称(稍后可以与堆栈跟踪进行比较)
另外,来电者可以指定以下别名之一
常用模式:
- 普通 -
%h %l %u %t "%r" %s %b
- 合并 -
%h %l %u %t "%r" %s %b "%{i,Referer}" "%{i,User-Agent}"
还有支持从cookie中写入信息,传入
header,或者 session
它是在 apache 语法之后建模的:
%{i,xxx}
用于传入 headers
%{o,xxx}
用于传出响应 headers
%{c,xxx}
对于特定的 cookie
%{r,xxx}
xxx是ServletRequest中的一个属性
%{s,xxx}
xxx是HttpSession中的一个属性
Current WildFly (15) 使用 Undertow 2.0,因此请查看关于谓词的 Undertow 文档:
http://undertow.io/undertow-docs/undertow-docs-2.0.0/predicates-attributes-handlers.html
是否有 WildFly 网络配置表达式(例如重写过滤器)支持的完整变量列表?喜欢 %U、%h、%p...
<filters>
<rewrite name="http-to-https" redirect="true" target="https://myhostname:8443%U"/>
</filters>
<server name="default-server">
<host name="default-host" alias="localhost">
...
<filter-ref name="http-to-https" predicate="equals(%p,8080)"/>
这些是AccessLogHandler.java
用于日志的属性。
另外,来电者可以指定以下别名之一 常用模式:
- 普通 -
%h %l %u %t "%r" %s %b
- 合并 -
%h %l %u %t "%r" %s %b "%{i,Referer}" "%{i,User-Agent}"
还有支持从cookie中写入信息,传入
header,或者 session
它是在 apache 语法之后建模的:
%{i,xxx}
用于传入 headers%{o,xxx}
用于传出响应 headers%{c,xxx}
对于特定的 cookie%{r,xxx}
xxx是ServletRequest中的一个属性%{s,xxx}
xxx是HttpSession中的一个属性
Current WildFly (15) 使用 Undertow 2.0,因此请查看关于谓词的 Undertow 文档: http://undertow.io/undertow-docs/undertow-docs-2.0.0/predicates-attributes-handlers.html