简体   繁体   English

JBoss 获取最大帖子大小

[英]JBoss get max post size

While I have managed to increase the max post size on my JBoss following http://www.mastertheboss.com/web/jboss-web-server/configuring-wildfly-upload-file-size/ now I'd like my webapp to inform users.虽然我在 http 之后设法增加了 JBoss 的最大帖子大小://www.mastertheboss.com/web/jboss-web-server/configuring-wildfly-upload-file-size/现在我希望我的 webapp告知用户。 So I would like to render on the screen that the server accepts upload up to XXX MB.所以我想在屏幕上呈现服务器接受上传到 XXX MB。

How can a webapp retrieve the max post size setting from JBoss? Web 应用程序如何从 JBoss 检索最大帖子大小设置? Is there even a container agnostic way that could work across different servlet containers?甚至有一种容器无关的方法可以跨不同的 servlet 容器工作吗?

The max-post-size allows for an expression . max-post-size 允许一个表达式 That means you could use a system property which could be set on the attribute and retrieved by your application.这意味着您可以使用可以在属性上设置并由您的应用程序检索的系统属性。

In CLI you'd do something like this:在 CLI 中你会做这样的事情:

/system-property=max.post.size:add(value=25485760)
/subsystem=undertow/server=default-server/http-listener=default/:write-attribute(name=max-post-size,value=${max.post.size:10485760})

While the default, :10485760 , is not strictly required, I'd advise it.虽然默认值:10485760不是严格要求的,但我建议这样做。

Then in your application you simply just to simply retrieve the system property.然后在您的应用程序中,您只需简单地检索系统属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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