Hello, 



I just tried to switch to "wicket native websockets" in a springboot project:

1) filter changed to „org.apache.wicket.protocol.ws.javax.JavaxWebSocketFilter“

2) added   „add(new WebSocketBehavior() {});“ to  page


3)
<java.version>1.8</java.version>
<tomcat.version>8.5.15</tomcat.version>
<wicket.version>7.7.0</wicket.version>
      ...
<parent>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter parent</artifactId>

<version>1.4.2.RELEASE</version>

</parent>
...

<dependency>
    <groupId>org.apache.wicket</groupId>
    <artifactId>wicket-native-websocket-javax</artifactId>
    <version>${wicket.version}</version>
</dependency>


5)
@SpringBootApplication(exclude = {ErrorMvcAutoConfiguration.class})
@Slf4j
public class WebApplication {

    public static void main(String[] args) {
        SpringApplication.run(WebApplication.class, args);
    }

    @Bean
    public FilterRegistrationBean wicketFilter() {
        final FilterRegistrationBean wicketFilter = new 
FilterRegistrationBean();
        wicketFilter.setDispatcherTypes(DispatcherType.REQUEST, 
DispatcherType.ERROR, DispatcherType.FORWARD);
        wicketFilter.setAsyncSupported(true);
        wicketFilter.setFilter(new JavaxWebSocketFilter());
        wicketFilter.addInitParameter(WicketFilter.APP_FACT_PARAM,
        SpringWebApplicationFactory.class.getName());
        wicketFilter.addInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
        wicketFilter.addInitParameter("applicationBean", 
"wicketWebApplication");
        wicketFilter.addInitParameter("configuration", "development");
       wicketFilter.addUrlPatterns("/*");
        return wicketFilter;
    }

Logging:
INFO  19/06/2017 16:13 org.apache.catalina.core.StandardService: Starting 
service [Tomcat]
INFO  19/06/2017 16:13 org.apache.catalina.core.StandardEngine: Starting 
Servlet Engine: Apache Tomcat/8.5.15
INFO  19/06/2017 16:13 
org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]: Initializing 
Spring embedded WebApplicationContext
INFO  19/06/2017 16:13 org.springframework.web.context.ContextLoader: Root 
WebApplicationContext: initialization completed in 2044 ms
INFO  19/06/2017 16:13 
org.springframework.boot.web.servlet.FilterRegistrationBean: Mapping filter: 
'characterEncodingFilter' to: [/*]
INFO  19/06/2017 16:13 
org.springframework.boot.web.servlet.FilterRegistrationBean: Mapping filter: 
'hiddenHttpMethodFilter' to: [/*]
INFO  19/06/2017 16:13 
org.springframework.boot.web.servlet.FilterRegistrationBean: Mapping filter: 
'httpPutFormContentFilter' to: [/*]
INFO  19/06/2017 16:13 
org.springframework.boot.web.servlet.FilterRegistrationBean: Mapping filter: 
'requestContextFilter' to: [/*]
INFO  19/06/2017 16:13 
org.springframework.boot.web.servlet.FilterRegistrationBean: Mapping filter: 
'javaxWebSocketFilter' to urls: [/*]
INFO  19/06/2017 16:13 
org.springframework.boot.web.servlet.ServletRegistrationBean: Mapping servlet: 
'dispatcherServlet' to [/]
...
INFO  19/06/2017 16:13 org.apache.wicket.Application: [javaxWebSocketFilter] 
init: Wicket extensions initializer
INFO  19/06/2017 16:13 org.apache.wicket.protocol.http.WebApplication: 
[javaxWebSocketFilter] Started Wicket version 7.7.0 in DEVELOPMENT mode
...


Result:
WebSocket connection to 
'ws://localhost:8080/wicket/websocket?pageId=2&wicket-ajax-baseurl=intro%3F2&wicket-app-name=javaxWebSocketFilter'
 failed: Error during WebSocket handshake: Unexpected response code: 404        
        wicket-websocket-jquery-ver-1497450491000.js:69

No errors in the log on server start and while working 


Should this configuration work? or maybe I'm missing something?

The „org.apache.wicket.protocol.ws.javax.WicketEndpoint#onOpen()“ is not being 
called

We are using "embeded Tomcat of Spring Boot", maybe this is the reason .... 



Thanks in advance!


Reply via email to