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

axk*_*axk 6 glassfish spring-mvc

webapp使用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>
Run Code Online (Sandbox Code Playgroud)

因此请求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

小智 3

使用重定向到您的应用程序上下文。将 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>
Run Code Online (Sandbox Code Playgroud)