File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Static constants for content type? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Static constants for content type?" Watch "Static constants for content type?" New topic

Static constants for content type?

Lance Miller

Joined: Jun 23, 2008
Posts: 21
In the Servlet API, are there any static constants for setting the content type? I've never found them. I created a class for such but wanted to make sure I just wasn't missing them from somewhere else.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 61092

Not in the Servlet API. I don't know if standard MIME types are defined in any other API.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Lance Miller

Joined: Jun 23, 2008
Posts: 21
Thanks Bear. I did find a ContentType class in the Google Data Protocol project. So it'll cost me a 974KB JAR file to use that. Not too bad. And it looks like it adds some nice additional utils & features.
Mariusz Zacny

Joined: Apr 11, 2013
Posts: 1
You can use Spring 3

Represents an Internet Media Type, as defined in the HTTP specification.
subject: Static constants for content type?