简体   繁体   English

上下文路径与 webapp-runner 中的 Spring UrlTag 冲突?

[英]Context path conflict with Spring UrlTag in webapp-runner?

We have a Java/Spring app deployed into Heroku, using the excellent webapp-runner as the Tomcat-lite servlet container.我们有一个 Java/Spring 应用程序部署到 Heroku,使用优秀的webapp-runner作为 Tomcat-lite servlet 容器。 In upgrading from 7.0.27.1 to 7.0.31.1, it seems the behavior for setting a default context path of "/" causes problems with <spring:url> tags.在从 7.0.27.1 升级到 7.0.31.1 时,设置“/”的默认上下文路径的行为似乎会导致<spring:url>标签出现问题。 Specifically, with the default context path of "/", tags like <spring:url value="/foo/bar"/> end up getting rendered as //foo/bar .具体来说,使用“/”的默认上下文路径,像<spring:url value="/foo/bar"/>这样的标签最终会被渲染为//foo/bar All browsers I tested on OS X (Chrome, Safari, Firefox), for example, don't seem to handle those particularly gracefully, and try to load http://foo/bar , resulting in all kinds of chaos.例如,我在 OS X 上测试的所有浏览器(Chrome、Safari、Firefox)似乎都没有特别优雅地处理这些,并尝试加载http://foo/bar ,导致各种混乱。

I can think of two workarounds:我可以想到两种解决方法:

  • Specify --context-path "" argument to webapp-runner - this seems "best" since it corresponds to the 7.0.27.1 behaviorwebapp-runner指定--context-path ""参数 - 这看起来是“最好的”,因为它对应于 7.0.27.1 行为
  • Write the tags as <spring:url context="" .../> - unsure what additional consequences there might be, considering how SpringUrl uses leading slash to determine UrlType .将标签编写为<spring:url context="" .../> - 考虑SpringUrl如何使用前导斜杠来确定UrlType ,不确定可能会产生什么额外的后果。

Are either of these reasonable?这两者是否合理? If not, is there some other solution I should consider?如果没有,我应该考虑其他一些解决方案吗?

webapp-runner-7.0.34.1 has changed the default --context-path back to "" . webapp-runner-7.0.34.1 已将默认的--context-path"" If you upgrade, it should fix your issue.如果您升级,它应该可以解决您的问题。

I had similar issue of double slash // and upgrading from webapp-runner 7.0.34.0 to webapp-runner 7.0.34.1 solved the problem for me .我有类似的双斜杠问题//从 webapp-runner 7.0.34.0 升级到webapp-runner 7.0.34.1 为我解决了这个问题

I had tried with both <spring:url> and ${pageContext.request.contextPath} .我已经尝试过<spring:url>${pageContext.request.contextPath} Upgrading webapp-runner solved the problem in both cases.升级 webapp-runner 解决了这两种情况下的问题。

More details: http://bit.ly/1zuL1T1更多详情: http : //bit.ly/1zuL1T1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spymemcached与hibernate-memcached和webapp-runner发生冲突 - Spymemcached conflict with hibernate-memcached and webapp-runner webapp运行程序错误(NoInitialContextException) - webapp-runner error (NoInitialContextException) Heroku Webapp运行程序-启用命名 - Heroku webapp-runner --enable-naming 使用&#39;webapp-runner&#39;运行Spring Boot应用后,它在“ INFO:Starting ProtocolHandler [“ http-nio-8080”]”行中停止 - After running Spring boot app with 'webapp-runner' it's stoping on a line “INFO: Starting ProtocolHandler [”http-nio-8080“]” Heroku Webapp运行程序JNDI命名,资源不可用 - Heroku webapp-runner JNDI naming, resource not available Java Web App在带有webapp-runner的Heroku上崩溃 - Java Web App Crashes on Heroku with webapp-runner 需要帮助Java Web App(webapp运行程序,tomcat)heroku(应用程序崩溃) - Need Help Java Web App (webapp-runner, tomcat) heroku (app crashed) 在webapp-runner中运行的对Heroku Web-app的API调用最终失败,并出现google.common中的NoSuchMethodError和NoClassDefFoundError - API calls to Heroku web-app running in webapp-runner eventually fail with NoSuchMethodError then NoClassDefFoundError in google.common 重写规则,附加webapp上下文路径与 <spring:url> 和 <c:url> 标签库 - Rewrite Rule appending webapp context path conflicts with <spring:url> and <c:url> taglibs 上下文webapp下的Grizzly静态内容路径 - Grizzly Static Content path below the context webapp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM