【问题标题】:Mixing Vaadin and Spring: DispatcherServlet used before Vaadin Resources混合 Vaadin 和 Spring:在 Vaadin 资源之前使用的 DispatcherServlet
【发布时间】:2014-11-25 12:33:36
【问题描述】:

我在一个 Web 应用程序中结合使用 Spring 和 Vaadin。我将 DispatcherServlet 映射到 URL“/”(将其用于 REST API)并将 Vaadin Servlet 映射到 /rsp。当我打开应用程序时,我在浏览器中收到以下错误消息:“无法加载引导 javascript:./VAADIN/vaadinBootstrap.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 提供服务)

【问题讨论】:

    标签: spring vaadin servlet-3.0


    【解决方案1】:

    您还需要将 VaadinServlet 映射到 /VAADIN/*。前端固定使用此路径来获取 Vaadin-reated 资源。您可以在文档中了解更多信息:https://vaadin.com/docs/v8/framework/application/application-environment.html#application.environment.servlet-mapping

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

    【讨论】:

      猜你喜欢
      • 2016-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-14
      • 1970-01-01
      • 2017-12-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多