Skip to content

Commit

Permalink
fix: Only map websockets to servlet path and not any sub paths
Browse files Browse the repository at this point in the history
Allows other websockets to work, especially when Vaadin is root mapped
  • Loading branch information
Artur- committed Sep 26, 2022
1 parent ec3b510 commit c4181b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public ServletRegistrationBean<SpringServlet> servletRegistrationBean(
initParameters.put(
VaadinServlet.INTERNAL_VAADIN_SERVLET_VITE_DEV_MODE_FRONTEND_PATH,
"");
pushRegistrationPath = "";
pushRegistrationPath = "/";
} else {
pushRegistrationPath = mapping.replace("/*", "");
}
Expand All @@ -101,6 +101,7 @@ public ServletRegistrationBean<SpringServlet> servletRegistrationBean(
*/
initParameters.put(ApplicationConfig.JSR356_MAPPING_PATH,
pushRegistrationPath);
initParameters.put(ApplicationConfig.JSR356_PATH_MAPPING_LENGTH, "0");

ServletRegistrationBean<SpringServlet> registration = new ServletRegistrationBean<>(
new SpringServlet(context, rootMapping), mapping);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void onStartup(ServletContext servletContext)
.addServlet("dispatcher", new DispatcherServlet(context));
dispatcherRegistration.addMapping("/*");
mapping = VaadinServletConfiguration.VAADIN_SERVLET_MAPPING;
pushRegistrationPath = "";
pushRegistrationPath = "/";
} else {
pushRegistrationPath = mapping.replace("/*", "");
}
Expand All @@ -85,6 +85,7 @@ public void onStartup(ServletContext servletContext)
*/
initParameters.put(ApplicationConfig.JSR356_MAPPING_PATH,
pushRegistrationPath);
initParameters.put(ApplicationConfig.JSR356_PATH_MAPPING_LENGTH, "0");

registration.setInitParameters(initParameters);

Expand Down

0 comments on commit c4181b0

Please sign in to comment.