Package com.vaadin.flow.spring
Class RootMappedCondition
java.lang.Object
com.vaadin.flow.spring.RootMappedCondition
- All Implemented Interfaces:
org.springframework.context.annotation.Condition
public class RootMappedCondition
extends Object
implements org.springframework.context.annotation.Condition
Condition to check whether the Vaadin servlet is mapped to the root
("/*").
In this case a DispatcherServlet is used. It's mapped to the root
instead of VaadinServlet and forwards requests to VaadinServlet. If
there are other mappings (via Spring endpoints e.g.) then
DispatcherServlet makes it possible to handle them properly via those
endpoints. Otherwise VaadinServlet will handle all the URLs because
it has the highest priority.
- Since:
- 10.0
- Author:
- Vaadin Ltd
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the property that holds the Vaadin servlet url mapping. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetUrlMapping(org.springframework.core.env.Environment environment) Gets the url mapping in a way compatible with both plain Spring and Spring Boot.static booleanisRootMapping(String mapping) Returnstrueifmappingis the root mapping ("/*").booleanmatches(org.springframework.context.annotation.ConditionContext context, org.springframework.core.type.AnnotatedTypeMetadata metadata)
-
Field Details
-
URL_MAPPING_PROPERTY
Name of the property that holds the Vaadin servlet url mapping.- See Also:
-
-
Constructor Details
-
RootMappedCondition
public RootMappedCondition()Creates the condition. Spring instantiates it when evaluating a@Conditionalannotation.
-
-
Method Details
-
matches
public boolean matches(org.springframework.context.annotation.ConditionContext context, org.springframework.core.type.AnnotatedTypeMetadata metadata) - Specified by:
matchesin interfaceorg.springframework.context.annotation.Condition
-
getUrlMapping
Gets the url mapping in a way compatible with both plain Spring and Spring Boot.- Parameters:
environment- the application environment- Returns:
- the url mapping or null if none is defined
- Since:
- 23.1
-
isRootMapping
Returnstrueifmappingis the root mapping ("/*").The mapping is controlled via the
vaadin.urlMappingproperty value. By default it's "/*".- Parameters:
mapping- the mapping string to check- Returns:
trueifmappingis the root mapping andfalseotherwise
-