Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glassfish: web application deployed with non-root context interprets requests relative to domain1/docroot

The webapp uses 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>

So requests like http://localhost:8080/application-context-folder/index.jsp should resolve to application-context-folder/index.jsp and they resolve to domain1/docroot/application-context-folder.

Is it by design or do I need to change something in the application or configuration ?

@Edit: there was a typo, the requested URL is http://localhost:8080/application-context-folder/index.jsp, not http://localhost:8080/index.jsp

like image 336
axk Avatar asked Sep 26 '08 17:09

axk


1 Answers

Use redirect to your application context. Place an index.html file in the docroot folder of your domain. File may look something like this:

<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>

like image 103
Aleksey Avatar answered Oct 10 '22 18:10

Aleksey