java - 如何在 Wildfly 中激活安全 cookie?

标签 java servlets cookies wildfly wildfly-8

我正在尝试为 Wildfly(版本 8.2)中的网络应用程序将安全标志添加到我的 cookie 中。在 the documentation page of the servlet container settings你会发现“servlet-container”的 child 是:

  1. jsp
  2. 持久 session
  3. session cookie
  4. 网络套接字

但是我只有 jspwebsockets。如何访问 session cookie 设置?如果我不能,如何将安全标志添加到我的 cookie 中?

更新:我无法访问 wars 中的 web.xml 文件,只能访问 wildfly 配置文件。

最佳答案

通过 jboss-cli 尝试以下命令:

/subsystem=undertow/servlet-container=default/setting=session-cookie:add(http-only=true,secure=true)

或者在你的 standalone.xml 中:

<servlet-container name="default">
    <session-cookie http-only="true" secure="true"/>
    <jsp-config/>
</servlet-container>

引用:http://wildscribe.github.io/Wildfly/8.2.0.Final/subsystem/undertow/servlet-container/setting/session-cookie/index.html

关于java - 如何在 Wildfly 中激活安全 cookie?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31163475/

相关文章:

java - 参数和属性之间的区别

php - MySQL 查询或 $_SESSION 变量或非敏感数据的 Cookie?

javascript - 使用 Postman 或 Curl 登录第三方网站 : Learning experience

Java:寻找 Collat​​z 序列中最大的链

java - Eclipse 在我的单元测试类路径中找不到 logback-test.xml

java - EntityManager 生命周期是否应该针对每个 Servlet 请求?或者更长?

java - 是否可以在 Servlet 中使用 char[] 而不是字符串来存储密码?

ajax - 通过 CORS 请求设置 cookie

java - 使用 JFrame 和 JPanel 构建 GUI 时如何使用布局管理器?

java - hibernate 、级联操作、重复