Class 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.

    Author:
    Vaadin Ltd
    • Constructor Detail

      • RootMappedCondition

        public RootMappedCondition()
    • Method Detail

      • matches

        public boolean matches​(org.springframework.context.annotation.ConditionContext context,
                               org.springframework.core.type.AnnotatedTypeMetadata metadata)
        Specified by:
        matches in interface org.springframework.context.annotation.Condition
      • getUrlMapping

        public static String getUrlMapping​(org.springframework.core.env.Environment environment)
        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
      • isRootMapping

        public static boolean isRootMapping​(String mapping)
        Returns true if mapping is the root mapping ("/*").

        The mapping is controlled via the vaadin.urlMapping property value. By default it's "/*".

        Parameters:
        mapping - the mapping string to check
        Returns:
        true if mapping is the root mapping and false otherwise