混合Vaadin和Spring:在Vaadin Resources之前使用DispatcherServlet

时间:2014-11-25 12:33:37

标签: spring vaadin servlet-3.0

我在一个Web应用程序中结合使用Spring和Vaadin。我将DispatcherServlet映射到URL“/”(将其用于REST API)并将Vaadin Servlet映射到/ rsp。当我打开应用程序时,我在浏览器中收到以下错误消息:“无法加载引导程序javascript:./ VAADIN / evadinBootstrap.js”以及我服务器中的以下日志条目:

12:21:15.915 [http-bio-8088-exec-4] WARN  org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/rsp/VAADIN/vaadinPush.debug.js] in DispatcherServlet with name 'dispatcher'
12:21:15.922 [http-bio-8088-exec-5] WARN  org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/rsp/VAADIN/vaadinBootstrap.js] in DispatcherServlet with name 'dispatcher'
12:21:15.934 [http-bio-8088-exec-6] WARN  org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/rsp/VAADIN/themes/parsp-theme/favicon.ico] in DispatcherServlet with name 'dispatcher'
12:21:15.974 [http-bio-8088-exec-8] WARN  org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/rsp/VAADIN/themes/parsp-theme/favicon.ico] in DispatcherServlet with name 'dispatcher'
12:21:16.013 [http-bio-8088-exec-8] WARN  org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/rsp/VAADIN/themes/parsp-theme/favicon.ico] in DispatcherServlet with name 'dispatcher'
12:21:16.052 [http-bio-8088-exec-8] WARN  org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/rsp/VAADIN/themes/parsp-theme/favicon.ico] in DispatcherServlet with name 'dispatcher'

我可以将dispatcherservlet映射到/ rest来解决问题,但是是否可以将两个servlet映射到相同的路径(“/”),这样每个servlet都可以提供服务(/ VAADIN / ... vaadin servlet,其余API由调度程序servlet提供)

1 个答案:

答案 0 :(得分:0)

您还需要将VaadinServlet映射到/VAADIN/*。前端固定为使用此路径来获取与Vaadin相关的资源。您可以在文档中进一步了解它:https://vaadin.com/docs/v8/framework/application/application-environment.html#application.environment.servlet-mapping

您使用哪个版本的Vaadin和Spring? Vaadin Spring Servlet旨在与Spring MVC一起使用,即开即用