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.

Author:

Vaadin Ltd

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    getUrlMapping(org.springframework.core.env.Environment environment)

    Gets the url mapping in a way compatible with both plain Spring and Spring Boot.

    static boolean

    Returns true if mapping is the root mapping ("/*").

    boolean
    matches(org.springframework.context.annotation.ConditionContext context, org.springframework.core.type.AnnotatedTypeMetadata metadata)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • RootMappedCondition

      public RootMappedCondition()
  • Method Details

    • 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