I'm having a problem using URLConnection in some code that's running
on JBoss 3.0.7. URLConnection.getContentType() returns null on JBoss.
The same code on Weblogic (and similar code run in the plain java
interpreter outside of any app server) returns "content/unknown" as
a content type. The null value being returned when running on JBoss
is causing some third party code to fail - something I just can't reach
in and fix directly.
The JBoss class seems to just call up to the base class code in
java.net.URLConnection to get the content type; so why is the result
different on JBoss as opposed to the Sun JVM ?
Thanks in advance for any help,
Bruce
Some test code in a JSP:
<%@ page import="java.net.*" %>
<%
String filename = request.getParameter("filename");
if ( filename != null ) {
%>
Filename=<%=filename%>
<%
URL url = new URL( filename );
URLConnection uconn = url.openConnection();
%>
URL=<%=url.toString()%>
URLConnection:<%=uconn.getClass().getName()%>
ContentType=<%=uconn.getContentType()%>
<% } %>
On JBoss:
Filename=file:/foobar.wsdl
URL=file:/foobar.wsdl
URLConnection:org.jboss.net.protocol.file.FileURLConnection
ContentType=null
On Weblogic:
Filename=file:/foobar.wsdl
URL=file:/foobar.wsdl
URLConnection:sun.net.www.protocol.file.FileURLConnection
ContentType=content/unknown