我想将${jboss.server.temp.dir}/foo_server/images_svg
目录添加为外部资源目录。
为此,我需要将以下行代码添加到/subsystem/handlers
<location name="/images_svg" handler="images"/>
进入/subsystem/server name="default-server"/host name="default-host"
<file name="images" path="${jboss.server.temp.dir}/foos_server/images_svg" directory-listing="true"/>
我期待这样的事情:
<subsystem xmlns="urn:jboss:domain:undertow:2.0">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https"/>
<host name="default-host" alias="localhost">
<location name="/images_svg" handler="images"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="images" path="${jboss.server.temp.dir}/foo_server/images_svg" directory-listing="true"/>
</handlers>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/9"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
</filters>
</subsystem>
如何从jboss-cli
命令行执行此操作?
我试过了:
/subsystem=undertow/server=default-server/host=default-host/location="/images_svg":write-attribute(name="handler",value="images")
{
"outcome" => "failed",
"failure-description" => "WFLYCTL0216: Management resource '[
(\"subsystem\" => \"undertow\"),
(\"server\" => \"default-server\"),
(\"host\" => \"default-host\"),
(\"location\" => \"/images_svg\")
]' not found",
"rolled-back" => true
}
和
/subsystem=undertow/server=default-server/host=default-host/location="/images_svg":add(handler="images")
16:02:43,851 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 27) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "undertow"),
("server" => "default-server"),
("host" => "default-host"),
("location" => "/images_svg")
]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.undertow.server.default-server.default-host.location./images_svg is missing [jboss.undertow.handler.images]"]}
{
"outcome" => "failed",
"failure-description" => {"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.undertow.server.default-server.default-host.location./images_svg is missing [jboss.undertow.handler.images]"]},
"rolled-back" => true
}
问候
答案 0 :(得分:2)
尝试以下
处理程序images
:
/subsystem=undertow/configuration=handler/file=images:add(path="${jboss.server.temp.dir}/images_svg", directory-listing="true")
位置/images_svg
/subsystem=undertow/server=default-server/host=default-host/location="/images_svg":add(handler="images")