简体   繁体   English

web.xml上cookie安全标志的动态值

[英]Dynamic value for cookie secure flag at web.xml

I want to set the "cookie-config secure" flag on my web.xml dynamically based on my environment. 我想根据我的环境动态地在我的web.xml上设置“cookie-config secure”标志。

I know I can do this with maven build, but I want to make it a single war file that can be used in multi-environment instead of different war file. 我知道我可以用maven build做到这一点,但是我想让它成为一个单一的war文件,可以在多环境中使用,而不是使用不同的war文件。

Is there any way to set it based on my environment variable or parameter? 有没有办法根据我的环境变量或参数设置它?

Just realized it easily can be achieved using Java system properties. 刚刚意识到可以使用Java系统属性轻松实现。 Just need to add -Dsome.value on JAVA_OPTS And use ${some.value} at the web.xml file. 只需要在JAVA_OPTS上添加-Dsome.value并在web.xml文件中使用$ {some.value}。

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

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