GWT and servlet calling in IE (in FF it is OK)

28 views
Skip to first unread message

Matej Jelovcan

unread,
Aug 27, 2011, 1:52:46 PM8/27/11
to google-we...@googlegroups.com
Hey guys.

A problem that is driving me nuts these days. I have a simple servlet, NO content, just get and post methods in it:

public class FileDownloadServlet extends HttpServlet
{
    private static final long serialVersionUID = 1L;
   
    /**
     * @see HttpServlet#HttpServlet()
     */
    public FileDownloadServlet()
    {
        super();
    }
   
    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
    }
   
    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
     *      response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
    }
}

And in a widget I have a call like this:
Window.open("FileDownloadServlet", "_blank", "");

The servlet mapping in web.xml is like this:
<servlet>
        <servlet-name>FileDownloadServlet</servlet-name>
        <servlet-class>si.zuti.servlets.FileDownloadServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>FileDownloadServlet</servlet-name>
        <url-pattern>/FileDownloadServlet</url-pattern>
    </servlet-mapping>

When I run my app in FF it is working PERFECTLY, no problems. Nothing is done only new window is opened. As it should be. But when I try to run this in IE... well, this is the output:
> HTTP Status 404 - /ZPortal/si.zuti.ZPortal/FileDownloadServlet
>
> ________________________________
>
> type Status report
>
> message /ZPortal/si.zuti.ZPortal/FileDownloadServlet
>
> description The requested resource (/ZPortal/si.zuti.ZPortal/FileDownloadServlet) is not available.
 
Why is the URL reading as /ZPortal/si.zuti.ZPortal/FileDownloadServlet?! If I remove the si.zuti.ZPortal part, it is fine. In FF it reads as it should: /ZPortal/FileDownloadServlet.

I have no idea what to do. I am deploying this in Apache Tomcat. Any ideas would be very welcome.

Thanks.

Thomas Broyer

unread,
Aug 28, 2011, 5:32:09 AM8/28/11
to google-we...@googlegroups.com
Rule of thumb, always use GWT.getHostPageBaseURL() or GWT.getModuleBaseURL() as a "prefix" for your relative URLs. That's because some browsers (maybe all but IE) will resolve the URL relative to the page the method is called on ($wnd.open(), $wnd corresponding to the host page), and others (IE at least, from your report) will resolve it from the page the script is running in (the *.cache.html of your module)
Reply all
Reply to author
Forward
0 new messages