gpt4 book ai didi

spring-mvc - Glassfish:使用非根上下文部署的 Web 应用程序解释相对于 domain1/docroot 的请求

转载 作者:行者123 更新时间:2023-12-04 15:38:17 25 4
gpt4 key购买 nike

Web 应用程序使用 Spring MVC。

<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="urlMap">
<map>
<entry key="/*" value-ref="defaultHandler"/>
</map>
</property>
<property name="order" value="2"/>
</bean>
<bean name="defaultHandler" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/>

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/"/>
<property name="suffix" value=""/>
</bean>

所以请求像 http://localhost:8080/application-context-folder/index.jsp 应该解析为 application-context-folder/index.jsp,它们解析为 domain1/docroot/application-context-folder。

是设计使然还是我需要更改应用程序或配置中的某些内容?

@Edit:有一个错字,请求的 URL 是 http://localhost:8080/application-context-folder/index.jsp, not http://localhost:8080/index.jsp

最佳答案

使用重定向到您的应用程序上下文。将 index.html 文件放在域的 docroot 文件夹中。文件可能如下所示:

<html>
<head>
<title>Your application title</title>
<frameset>
<frame src="http://localhost:8080/[application_context]">
</frameset>
</head>
<body>
Redirecting to <a href="http://localhost:8080/[application_context]">Some title</a>...
</body>

关于spring-mvc - Glassfish:使用非根上下文部署的 Web 应用程序解释相对于 domain1/docroot 的请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/140708/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com