服务器:WindFly 15,Undertow 8
我已按照文章http://www.mastertheboss.com/jboss-web/jbosswebserver/configuring-undertow-filters-on-wildfly创建了自定义过滤器“ MyFilter”。但是我没有找到使用jboss.cli在配置中添加它的方法。
我尝试过/subsystem=undertow/configuration=filter/filter=myFilter/:add(module=com.xxx.myfilter,class-name=com.xxx.MyFilter),并收到以下错误:
ERROR [org.jboss.as.cli.CommandContext] Failed to get the list of the operationproperties: "WFLYCTL0030: No resource definition is registered for address [
("subsystem" => "undertow"),
("configuration" => "filter"),
("filter" => "myFilter")
那么我们是否只能通过手动编辑配置文件来添加过滤器?
您可以使用cli通过以下命令添加:
/subsystem=undertow/configuration=filter/custom-filter
原始答案可以找到here。
这与Guide Configuring The Web Server ~ Undertow - Chapter 17.6上说明的自定义过滤器创建有关>
/subsystem=undertow/configuration=filter/response-header=new-response-header:add(header-name=new-response-header,header-value="My Value")
提示
主要提示是使用Tab
,以便自动完成。