通过servlet

时间:2015-10-15 12:54:17

标签: tomcat servlets redirect tomcat7

我在http://somedomain.com:8080/myapp/上提供了我的网络应用程序。

我有这个域的别名:somealias.com

当我在本地向相对给定的地址发送重定向时,响应标头的位置与我设置的位置相同(http://somealias.com/somePage.html)。

http://somedomain.com:8080/myapp上时,该位置设置为http://somedomain.com:8080/myapp/somePage.html

但是,在http://somealias.com上时,位置会以某种方式更改为http://somealias.com/MYAPP/somePage.html - 可能是因为域名。

我想知道是否有办法处理它,因为然后重定向转到http://somealias.com/myapp/somePage.html,当然不存在,服务器发送404代码。

我不希望这部分myapp - 别名http://somealias.com指向网址http://somedomain.com/8080/myapp,因此当用户被重定向到http://somealias.com/myapp/时,事实上,他被重定向到http://somedomain.com:8080/myapp/myapp - 当然,这不存在。

在代码中,我只是做

response.sendRedirect("somePage.html)";

对于不恰当的链接格式感到抱歉 - 这是因为我声誉不佳。

0 个答案:

没有答案