Christopher Hull wrote:

> Is there a file handling servlet example out there?
>
> Somewhere in a static util class (I think), there is a method for
> converting .ext to content type.
> Does anyone know where that might be?
>

It's not a static utility class, becase each web app can configure their
mappings as they like, but the ServletContext.getMimeType() method is
probably
what you are looking for.

Different servlet containers have different ways to configure the
default
mappings, but any 2.2 container will let you define your own mappings
using
<mime-mapping> elements in the web application deployment descriptor
(file
"WEB-INF/web.xml").  See the servlet spec for more details, available at
<http://java.sun.com/products/servlet/download.html>).

If you want a complete example of a file-handling servlet, you can look
at the
code from an open source servlet container -- for Tomcat 3.1, it's class
org.apache.tomcat.servlets.DefaultServlet.

>
> Thanks;
> -Chris
>

Craig McClanahan

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to