perwendel / spark

A simple expressive web framework for java. Spark has a kotlin DSL https://github.com/perwendel/spark-kotlin
Apache License 2.0
9.63k stars 1.56k forks source link

Websocket route and catch all route doesn't work together #1164

Open lriuui0x0 opened 4 years ago

lriuui0x0 commented 4 years ago

If I have the following route definiton:

http.webSocket("/api/service", websocket);
http.get("*", (req, res) -> new String(Files.readAllBytes("index.html")));

The catch all route will actually shortcut the websocket connection.

lolski commented 4 years ago

Additionally, if you use the notFound handler, it will not be triggered, and the default 404 page is returned:

http.webSocket("/api/service", websocket);
http.notFound((req, res) -> new String(Files.readAllBytes("index.html")));
m4rr5 commented 2 years ago

I can confirm that if you add a webSocket() the notFound() stops working.