Package com.vaadin.flow.internal
Class BootstrapHandlerHelper
java.lang.Object
com.vaadin.flow.internal.BootstrapHandlerHelper
- All Implemented Interfaces:
Serializable
Helper methods for use in bootstrapping.
For internal use only. May be renamed or removed in a future release.
- Since:
- 4.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringdeterminePushServletMapping(VaadinSession vaadinSession) static StringfindFirstUrlMapping(jakarta.servlet.ServletRegistration registration) Returns the first of sorted URL mappings of the givenServletRegistration, ignoring '/VAADIN/*' and '/vaadinServlet/*' mapping.static StringgetCleanedPushServletMapping(String pushServletMapping) Cleans up the given push servlet mapping value for proper use.static StringgetPushEndpointPath(jakarta.servlet.ServletConfig servletConfig) Gets the path that the push WebSocket endpoint of the given servlet is registered at.static StringgetPushURL(VaadinSession vaadinSession, VaadinRequest vaadinRequest) Gets the push URL as a URL relative to the request URI.static StringgetServiceUrl(VaadinRequest vaadinRequest) Gets the service URL as a URL relative to the request URI.static Optional<jakarta.servlet.ServletRegistration> getServletRegistration(jakarta.servlet.ServletConfig servletConfig) Returns aServletRegistrationfor the givenServletConfig, if available.
-
Method Details
-
getServiceUrl
Gets the service URL as a URL relative to the request URI.- Parameters:
vaadinRequest- the request- Returns:
- the relative service URL
-
getPushURL
Gets the push URL as a URL relative to the request URI.- Parameters:
vaadinSession- the sessionvaadinRequest- the request- Returns:
- the relative push URL
-
determinePushServletMapping
-
getCleanedPushServletMapping
Cleans up the given push servlet mapping value for proper use. Effectively makes sure it starts and ends with a '/', and removes possible '/*' at the end.- Parameters:
pushServletMapping- Original pushServletMapping value- Returns:
- cleaned-up value, or null if the original value is blank.
- Since:
- 23.3.5
-
getServletRegistration
public static Optional<jakarta.servlet.ServletRegistration> getServletRegistration(jakarta.servlet.ServletConfig servletConfig) Returns aServletRegistrationfor the givenServletConfig, if available.- Parameters:
servletConfig-ServletConfigto find the registration for.- Returns:
- an optional
ServletRegistration, or an empty optional if a registration is not available. - Since:
- 23.3.5
-
findFirstUrlMapping
Returns the first of sorted URL mappings of the givenServletRegistration, ignoring '/VAADIN/*' and '/vaadinServlet/*' mapping.- Parameters:
registration-ServletRegistrationfrom which to look up the mappings.- Returns:
- first URL mapping, ignoring '/VAADIN/*' and '/vaadinServlet/*'
- Since:
- 23.3.5
-
getPushEndpointPath
Gets the path that the push WebSocket endpoint of the given servlet is registered at.The path is the push servlet mapping init parameter of the servlet, or the first URL mapping of the servlet if the parameter is not set, followed by
Constants.PUSH_MAPPING.- Parameters:
servletConfig- the configuration of the servlet- Returns:
- the path of the push WebSocket endpoint, or
nullif the servlet has neither the init parameter nor a registration to read the URL mapping from
-