Menu

#1281 content type is incorrect for http responses

v3.2
closed-invalid
nobody
JBossWeb (123)
5
2003-05-02
2003-04-29
No

Linux RedHat 8.0
JDK 1.4.2 beta
JBoss 3.2.0 with Jetty

HTTP responses now return the wrong content type.

There are two sides to this bug, the first is that the actual content
type returned in the header from Jetty is wrong. The second is how
that content type is mangled by HttpUrlConnection.

Part 1:

I have a JSP that sets the following content type:

<%@ page info="Scores Today" contentType="application/
xml;type=svg" %>

When I hit the jsp I see the following headers:

HTTP/1.1 200 OK
Date: Tue, 29 Apr 2003 03:56:55 GMT
Server: Jetty/4.2.9 (Linux/2.4.18-18.8.0 i386 java/1.4.2-beta)
Content-Type: application/xml;type=svg;charset=ISO-8859-1

the charset has been appended to the Content-Type, this did not
happen in JBoss 3.0.*

Part 2:

I have a Java class that connects to the JSP:

connection = (HttpURLConnection) url.openConnection();
......
String contentType = connection.getContentType();

The contentType returned is:

text/xml;charset=ISO-8859-1

I would have at least expected to see

application/xml;type=svg;charset=ISO-8859-1

but would have preferred

application/xml;type=svg

Also, I would have expected the charset to be utf-8 if anything, these
JSPs are running on Linux.

This is stopping our migration to JBoss 3.2 as we rely on the content
type to dictate how SVGs are transcoded for various clients.

Thanks for any help.

Discussion

  • Brian Bannister

    Brian Bannister - 2003-04-29

    Boot log showing software versions

     
  • Brian Bannister

    Brian Bannister - 2003-04-29

    server log showing incorrect content type

     
  • Brian Bannister

    Brian Bannister - 2003-04-29
    • labels: --> JBossWeb
     
  • Greg Wilkins

    Greg Wilkins - 2003-04-29

    Logged In: YES
    user_id=44062

    The ISO-8859-1 choice is a JSP thang. You need to put a tag
    into your JSPs if you want to change the charset to UTF8.

    I think the actual problem may be the way Jetty is combining
    the mime type parameters. It may be that the correct
    response is:

    application/xml; type=svg charset=ISO-8859-1
    or
    application/xml; type=svg, charset=ISO-8859-1

    I'm investigating now....

     
  • Greg Wilkins

    Greg Wilkins - 2003-04-29

    Logged In: YES
    user_id=44062

    I have checked rfc2045 and
    application/xml;type=svg;charset=ISO-8859-1
    is correct and legal.

    So I think it must be a problem with HttpURLConnection?

    I'm not sure there is anything that we can "fix" for this, as it
    is legal for you to set type=svg AND it is legal for the JSP
    servlet
    to set a charset.

    The main change from jboss 3.0.x to 3.2.x is that the JSP
    engine
    is now jasper2. It may be that the older JSP engine was not
    setting a charset if none was specified? You can try
    dropping in the jasper jars from 3.0.x into 3.2.x to see if
    this makes a difference.

    Other than that, you will need to ask the jakarta folks if
    there is a way to stop jasper setting a charset. Or better
    yet, check if it really is a bug in HttpURLConnection and
    see if you can get them to fix it (try IBMs JVM???).

    cheers

     
  • Sacha Labourey

    Sacha Labourey - 2003-05-02
    • status: open --> closed-invalid
     
  • Sacha Labourey

    Sacha Labourey - 2003-05-02

    Logged In: YES
    user_id=95900

    This is not a jboss issue.

     

Log in to post a comment.

MongoDB Logo MongoDB