Wildfly:从JSF应用程序更改smtp资源和邮件会话

时间:2017-06-20 10:51:29

标签: jsf wildfly

有一种简单的方法可以创建一个JSF页面来改变Wildfly 9中的smtp配置和邮件会话吗?

我知道我可以在CLI中执行此操作,因此我可以调用bash脚本来设置值,如下所示:

/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=$smtp:add(host=$host, port=$port)
/subsystem=mail/mail-session=$name:add(jndi-name="$jndi", from="$from", debug=$debug)
/subsystem=mail/mail-session=$name/server=smtp:add(outbound-socket-binding-ref=$smtp, ssl=$ssl, username=$user, password=$pass)

但我正在寻找一种更简单的方法。

1 个答案:

答案 0 :(得分:3)

Wildfly has also a HTTP management API and native management API.

HTTP API example:

$ curl --digest  http://localhost:9990/management --header "Content-Type: application/json" -d '{"operation":"write-attribute", "name":"default-timeout", "value":"600", "address":["subsystem","transactions"]}' -u admin
Enter host password for user 'admin':
{"outcome" : "success", "response-headers" : {"operation-requires-reload" : true, "process-state" : "reload-required"}}