commit-classpath
[Top][All Lists]
Advanced

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

[commit-cp] [bugs #8991] URLConnection doesn't support explicit mime par


From: Mark Wielaard
Subject: [commit-cp] [bugs #8991] URLConnection doesn't support explicit mime parameters
Date: Thu, 09 Sep 2004 17:37:08 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Galeon/1.3.15 (Debian package 1.3.15-2)

This mail is an automated notification from the bugs tracker
 of the project: classpath.

/**************************************************************************/
[bugs #8991] Latest Modifications:

Changes by: 
                Mark Wielaard <address@hidden>
'Date: 
                Thu 09/09/04 at 21:31 (Europe/Amsterdam)

            What     | Removed                   | Added
---------------------------------------------------------------------------
          Resolution | None                      | Fixed
         Assigned to | None                      | mark
              Status | Open                      | Closed


------------------ Additional Follow-up Comments ----------------------------
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







/**************************************************************************/
[bugs #8991] Full Item Snapshot:

URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=8991>
Project: classpath
Submitted by: 0
On: Tue 05/18/04 at 02:51

Category:  None
Severity:  5 - Average
Resolution:  Fixed
Privacy:  Public
Assigned to:  mark
Status:  Closed
Platform Version:  None


Summary:  URLConnection doesn't support explicit mime parameters

Original Submission:  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();
     }
    }
   }



Follow-up Comments
------------------


-------------------------------------------------------
Date: Thu 09/09/04 at 21:31         By: Mark Wielaard <mark>
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







File Attachments
-------------------

-------------------------------------------------------
Date: Tue 05/18/04 at 02:53  Name: html.java  Size: 2.77KB   By: None
html.java (trivial mod from plain.java for 
/cvsroot/classpath/classpath/gnu/java/net/content/text/html.java
http://savannah.gnu.org/bugs/download.php?item_id=8991&amp;item_file_id=1317

-------------------------------------------------------
Date: Tue 05/18/04 at 02:51  Name: URLConnection.java.patch  Size: 956B   By: 
None
patch for URLConnection.java
http://savannah.gnu.org/bugs/download.php?item_id=8991&amp;item_file_id=1316






For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=8991>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/







reply via email to

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