Artur, Thanks for this component. I couldn't get it to work for embedded c

Artur,

Thanks for this component. I couldn’t get it to work for embedded components that are served from a non-root context. The following changes seemed to solve it:

   // Path for VAADIN components
   private static String VAADIN_PATH = "/VAADIN/build";
   // Path for embedded components. This must match the path specified for the
   // WebComponentServlet
   private static String COMPONENTS_PATH = "/components";

   private boolean needsCorsHeaders(HttpServletRequest request) {
      String path = request.getPathInfo();
      if ("uidl".equals(request.getParameter("v-r"))) {
         // Vaadin UIDL request
         return true;
      } else if ("heartbeat".equals(request.getParameter("v-r"))) {
         // Heartbeats need to go through or the session expires
         return true;
      }

      // Get the URI.
      String uri = request.getRequestURI();
      // If we're not root, then remove context path.
      if (request.getContextPath() != null && uri.startsWith(request.getContextPath())) {
         uri = uri.substring(request.getContextPath().length());
      }

      // Check for VAADIN path
      if (uri != null && uri.startsWith(VAADIN_PATH)) {
         return true;
      }

      // Check for COMPONENT path
      if (uri != null && uri.startsWith(COMPONENTS_PATH)) {
         return true;
      }

      return false;
   }