Java webpage is downloading itself instead of rendering in browser

275 views
Skip to first unread message

Peter Reguli

unread,
Jun 19, 2015, 6:25:44 AM6/19/15
to google-a...@googlegroups.com
Hello,

our Java webpage deployed in Google AppEngine created in Eclipse with Google plugin suddenly stopped working correctly. Instead of rendering homepage, the index file is being downloaded by the browser - as you can see on http://mobilecity.sk This issue is happening since two weeks ago and we did not change anything in the deployed project for more than one year. 

When I run the project on localhost using Eclipse, everything works just fine. I suppose something changed in the settings of content type in the developers console, but I can't find any related settings. I was not developing this project and the guy who managed it is no longer working in our company. So I'm a total newbie to the AppEngine and I have no idea how to fix this. Any feedback would be highly appreciated.

Thank you very much,
Peter Reguli

Nick (Cloud Platform Support)

unread,
Jun 19, 2015, 9:49:18 AM6/19/15
to google-a...@googlegroups.com, peter....@goodrequest.com
Hey Peter,

Questions like this are better suited to stackoverflow rather than the App Engine groups forum, as this place is more for general discussion of the platform. The issue you've encountered is a common web development issue that has several good resources out there describing the behaviour. You might want to read up about HTTP headers, the Content-Type header, the CURL tool for inspecting the response from web-servers to an HTTP request, which is very useful when debugging.

What's happening is that your browser is downloading the served response, rather than displaying it, because you have Content-Type: application/octet-stream instead of Content-Type: text/html. Based on the fact that you set a JSESSIONID cookie, it appears that your app is written using Java servlets. Inspect the servlet that's active on the / route, which is responsible for serving the content. Either that servlet, or a filter on the servlet's response, is setting the content-type incorrectly.

Satyanarayana Govindachandra

unread,
Jun 19, 2015, 12:35:01 PM6/19/15
to google-a...@googlegroups.com
May be you having any errors in the Response leading to change the Content Type application/Octet - Stream and in turn this leads to download the page instead of rendering . Try Check your logs for any errors try fixing them or have Proper Page atleast like redirected to Error Page 404 , that should work .

Peter Reguli

unread,
Jun 20, 2015, 9:13:15 AM6/20/15
to google-a...@googlegroups.com
Thanks guys,

the problem was indeed in the wrong content type. Apparently, the response was being sent without any response-type declared, so it probably used the default one. I suppose the default response type for apps in Google AppEngine changed recently, which caused the website to stop working despite no changes were made to it. response.setContentType("text/html"); in the servlet serving index solved the problem for me.

Peter
Reply all
Reply to author
Forward
0 new messages