VirtualFileURLConnection does not override getContentType()
-----------------------------------------------------------
Key: JBVFS-149
URL:
https://jira.jboss.org/jira/browse/JBVFS-149
Project: JBoss VFS
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 3.0.0.CR3
Reporter: Alessio Soldano
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));
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira