Uploaded image for project: 'JBoss VFS'
  1. JBoss VFS
  2. JBVFS-149

VirtualFileURLConnection does not override getContentType()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.0.CR4
    • 3.0.0.CR3
    • None
    • None

      While overriding URLConnection:getContentType() seems at first not required, this is currently causing regressions in JBossWS SwA testsuite. When the user provides a DataHandler as a parameter for an attachment, JBossWS needs to get the content-type from it. DataHandler (javax.activation) delegates to its datasource, which in in the example below is a URLDataSource. The URLDataSource simply opens a connection from the url and calls getContentType on it. Since VirtualFileURLConnection does not override getContentType(), it uses the impl in java.net.URLConnection, which simply returns null. Before the changes for VFS3, this was using the Sun's impl sun.net.www.URLConnection which redefines the getContentType() and leverages the convenient method guessContentTypeFromName(..) from java.net.URLConnection.

      Example:
      InitialContext iniCtx = getInitialContext();
      Service service = (Service)iniCtx.lookup("java:comp/env/service/AttachmentService");
      Attachment port = (Attachment)service.getPort(Attachment.class);
      URL url = new File("jaxrpc/samples/swa/attach.gif").toURL();
      String value = port.send("Some text message", new DataHandler(url));

            johnbailey_jira John Bailey (Inactive)
            rhn-support-asoldano Alessio Soldano
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: