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

问题描述:

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

<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 要求应解析为应用上下文文件夹/ index.jsp和他们决心DOMAIN1 /文档根目录/应用上下文文件夹。

是由设计还是需要在应用程序或配置中更改某些内容?

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

+2

对于HTTP://本地主机:8080/index.jsp的工作,应用程序需要在根上下文。否则,它的http:// localhost:8080/context/index.jsp – 2008-09-27 19:40:47

使用重定向到您的应用程序上下文。将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>