Skip to content

Commit

Permalink
fix: custom push URL, handle URL when already prefixed by `context://…
Browse files Browse the repository at this point in the history
…` correctly
  • Loading branch information
Johannes Eriksson authored and Pekka Hyvönen committed Oct 5, 2020
1 parent 2fb59cb commit 7751d00
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ protected DeploymentConfiguration createDeploymentConfiguration(
}
final String mapping = VaadinServletConfiguration.VAADIN_SERVLET_MAPPING
.replace("/*", "");
customPushUrl = customPushUrl.replaceFirst("context://", "/");
customPushUrl = customPushUrl.replaceFirst(Pattern.quote(mapping),
""); // if workaround "/vaadinServlet/myCustomUrl" used
customPushUrl = customPushUrl.replaceFirst("^/","");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ public void pushURL_rootMappingAndCustomURLWithPrecedingSlash_isPrefixedWithCont
service.getDeploymentConfiguration().getPushURL());
}

@Test
public void pushURL_rootMappingAndCustomURLWithContextVaadinServletPrefix_isNotAdditionallyPrefixed()
throws ServletException {
final Properties properties = new Properties();
properties.setProperty("pushURL", "context://vaadinServlet/customUrl");
VaadinService service = SpringInstantiatorTest.getService(context,
properties, true);
Assert.assertEquals("context://vaadinServlet/customUrl",
service.getDeploymentConfiguration().getPushURL());
}

@Test
public void pushURL_rootMappingAndCustomURLWithVaadinServletPrefix_isNotAdditionallyPrefixed()
throws ServletException {
Expand Down

0 comments on commit 7751d00

Please sign in to comment.