How to serve static resources from a Vaadin/Spring application?

后端 未结 3 752
庸人自扰
庸人自扰 2021-01-14 06:09

I have Vaadin web application with spring security integration for authentication. The configuration of the Vaadin servlet is pretty simple:

         


        
3条回答
  •  Happy的楠姐
    2021-01-14 06:48

    Might be late but for who is still having problems with serving static content while using vaadin /* mapping, the solution I found was using apache's default servlet org.apache.catalina.servlets.DefaultServlet, so a web.xml will have something like:

    
    
    
      
        myservlet
        com.vaadin.server.VaadinServlet
        
          UI
          com.ex.myprj.MyUI
        
        
        
          widgetset
          com.ex.myprj.AppWidgetSet
        
      
      
        myservlet
        /*
      
    
      
        Static content Servlet
        org.apache.catalina.servlets.DefaultServlet
        
          debug
          0
        
        
          listings
          false
        
        1
      
      
        Static content Servlet
        /customer/*
      
    
    

    So in the example above, despite having vaadin at /*, the /customer/* part will be served as static content by the DefaultServlet

提交回复
热议问题