Closed Bug 287995 Opened 20 years ago Closed 20 years ago

Displays HTML code when accessing java servlet using tomcat

Categories

(Firefox :: File Handling, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: dmiller, Assigned: bugs)

References

()

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.40903; .NET CLR 1.1.4322)
Build Identifier: 

In the site

http://flamesofkalimdor.com

Will use the url called

http://www.amazinggrace.com.au/servlet/FOK_PortalCgi

which is basically just a java servlet that returns html code.

The problem is that with the current version of FireFox, the result places the 
HTML code within the browser, not the webpage itself. Im certain that this 
problem occurs due to fact the the URL has no typical file extension such 
as .jsp but most servlets developed follow the same url format (ie no file 
extension in the URL)

Is there a way to signal firefox to display the webpage and not the HTML code? 
Im sure other java developers have this problem with firefox and encourage 
users to simply use IE instead…not good.

Dale Miller – dmiller@amazinggrace.com.au




Reproducible: Always

Steps to Reproduce:
1. Go to http://flamesofkalimdor.com using Firefox client
2.
3.

Actual Results:  
HTML Code is displayed to the user

Expected Results:  
Display the webpage
The http headers for http://www.amazinggrace.com.au/servlet/FOK_PortalCgi

HTTP/1.1 500 Internal Server Error
Date: Mon, 28 Mar 2005 07:11:42 GMT
Server: Apache/1.3.33 (Unix) mod_mono/1.0.1 mod_jk/1.2.0
mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4
FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.7a PHP-CGI/0.1b
Connection: close
Content-Type: text/plain

The server needs to send this URI as content-type: text/html not text/plain for
Firefox to display the formated html. Firefox does not geuss what content it is
being fed. If a server says a document is plain text then it displays it as
plain text.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
For reference, the function which sets content type is
HttpServletResponse.setContentType("text/html");
and it's included in every servlet example I've seen (except the ones which, in
fact, output plain text).
(In reply to comment #2)
> For reference, the function which sets content type is
> HttpServletResponse.setContentType("text/html");
> and it's included in every servlet example I've seen (except the ones which, 
in
> fact, output plain text).

Excellent guys, solved my problem in absolute record time and even provided my 
with some java specific information :)

Within my servlet files, I had not set content-type at all. Java must have the 
response set on text/plain as default. I will certainly spread the word in 
regards to this issue and hope that it makes a welcome edition to the bugzilla 
database.

Dale Miller
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.