bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22742] URLConnection doesn't support explicit mime parame


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22742] URLConnection doesn't support explicit mime parameters
Date: 16 Oct 2005 01:26:56 -0000

Here's a quick patch for URLConnection to handle explicit media type parameters
[1].  It currently only modifies the classname requested for the Class.forName,
and does not support having individual content handlers for all of the various
media types, but it lets this fetch URL.getContent() on my apache instance. 
(almost - we needed a handler for text/html - see attached "html.txt")

The sun (1.4.2_04) impl has the URLConnection.getContentType()  return [2] the
full content type (including charset parameter), so this is compatible with
their behavior (demonstrated by using the jre, not from the source).

My environment doesn't have the classpath prerequisites (autoconf, automake,
etc) so I haven't tested this, though I did make this patch originally for
kaffe, tested it there, and have been running it for over a week with no
problems.  I havent submitted to classpath before, so if there's something
missing, please let me know.

=jr

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17
[2] "Type: [text/html; charset=ISO-8859-1]" from:

   import java.net.*;

   public class testType {
    public static void main(String args[]) {
     try {
      URL url = new URL("http://localhost/";);
      URLConnection con = url.openConnection();
      con.connect();
      Object o = con.getContent();
      String type = con.getContentType();
      System.out.println("Type: [" + type + "]");
     } catch (Exception e) {
      e.printStackTrace();
     }
    }
   }


------- Comment #1 from from-classpath at savannah dot gnu dot org  2004-09-09 
21:31 -------
I checked in a fix for this:


2004-09-09  Mark Wielaard  <address@hidden>

        Fixes bug #8991.
        * java/net/URLConnection.java (getContent): Add support for
        explicit mime types. Call getInputStream() if no handler found.
        * gnu/java/net/content/text/plain.java: Removed


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22742





reply via email to

[Prev in Thread] Current Thread [Next in Thread]