简体   繁体   中英

Wildfly 9: Undertow setup by programming [max-post-size] rather than modifying standalone.xml

I need to increase the max-post-size of my undertow configuration, because I got the following exception

java.io.IOException: UT000020: Connection terminated as request was larger than 10485760 
at io.undertow.conduits.FixedLengthStreamSourceConduit.checkMaxSize(FixedLengthStreamSourceConduit.java:168) 

and I need post requests with larger payloads.

However, I know that I could adapt standalone.xml , but I was not able to figure successfully out, how I can do this by programming or at least in web.xml (I need to be able to put the change in the build artifact rather than in the server configuration).

Edit :
I use the post requests with jax-rs @Post methods. If it is possible to eg annotate a payload size per request, it would also be OK, since there are only few requests needing higher payload size enabled.

Can anybody point my to what I can do?
Thanks in advance!

I don't think it's possible with an annotation. You'd have to change the max-post-size attribute on the listener . A change to the listener requires a reload which is why it's not possible from an annotation.

With CLI on the default http-listener the command would be:

/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=max-post-size, value=20971520)

打开管理控制台,单击“配置”,单击“子系统”,单击“ Web / http-”,单击“ Undertow”,单击“ http HTTP-server-> defual-server”,编辑max-post-size

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM