(Redhat 7 with kernel 2.42; TomCat/ServletApi Build2001-05-04) - please note 
that I've tried this on TCb1 and TCb3 with the same results.

The following request url (as well as all other valid urls) always returns 
null for contentType:
   http://localhost:8080/xyz/servlet/ViewResource/index.html

******************* Some code within doGet method **********************

    // Get the resource to view
    URL url = null;
    try {
      url = getServletContext().getResource(req.getPathInfo());   
      return url;                  
    }
    catch (IOException e) {
      ....
      return;
    }
 
    // Connect to the resource
    URLConnection con = url.openConnection();
    con.connect();  
    // con.getURL() returns jndi:/localhost/xyz/index.html
 
    // Get and set the type of the resource
    String contentType = con.getContentType();  // This returns null
    res.setContentType(contentType);

***************************************************************************

Any suggestions?

Thank You,
Anthony

Reply via email to