首页 > 解决方案 > 当我将 cookie 名称更改为自定义时,Wicket 出现错误

问题描述

我将cookie名称更改为自定义名称。之后,当页面第一次加载时,Wicket 会出错。(出现意外错误(类型=未找到,状态=404))。当我重新加载页面时,没有错误,因为 cookie 已经创建。

春季启动配置

 server.session.cookie.name=mySessionId

标签: javaspringspring-bootwicket

解决方案


来自org.apache.wicket.util.string.Strings.java

    /**
     * The name of the parameter used to keep the session id.
     * The Servlet specification mandates <em>jsessionid</em> but the web containers
     * provide ways to set a custom one, e.g. <em>sid</em>.
     * Since Wicket doesn't have access to the web container internals the name should be set explicitly.
     */
     public static final String SESSION_ID_PARAM_NAME = 
        System.getProperty("wicket.jsessionid.name", "jsessionid");

尝试启动您的 Web 容器,-Dwicket.jsessionid.name=mySessionId看看它是否有帮助。


推荐阅读