添加wicket WebSocketResource返回404

时间:2017-01-22 13:13:54

标签: websocket wicket

我是wicket的新手,请耐心等待。

我创建了一个简单的WebSocketResource并将其添加到空白页面中,如下所示:

    @Override
    protected void onInitialize() {
        super.onInitialize();

        add(new BaseWebSocketBehavior(PositionWebSocketResource.NAME));
    }

当我尝试访问该页面时,我一直收到404错误:

> wicket-websocket-jquery.js?ver=1485085221000:69 WebSocket connection
> to
> 'ws://localhost:8080/wicket/websocket?resourceName=com.try.MyWebSocketResource&wicket-ajax-baseurl=wicket%2Fbookmarkable%2Fcom.try.MyPage%3F0&wicket-app-name=WicketWebSocketFilter'
> failed: Error during WebSocket handshake: Unexpected response code:
> 404

我更新了我的Application.java以包含资源:

getSharedResources().add(MyWebSocketResource.NAME, new MyWebSocketResource());

和过滤器:

<filter>
        <filter-name>WicketWebSocketFilter</filter-name>
        <filter-class>org.apache.wicket.protocol.ws.javax.JavaxWebSocketFilter</filter-class>
        <init-param>
            <param-name>applicationClassName</param-name>
            <param-value>com.try.Application</param-value>
        </init-param>
    </filter>
<filter-mapping>
        <filter-name>WicketWebSocketFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

知道我做错了什么吗?

0 个答案:

没有答案