This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Static constants for content type?" Watch "Static constants for content type?" New topic
Author

Static constants for content type?

Lance Miller
Greenhorn

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
Marshal

Joined: Jan 10, 2002
Posts: 60764
    
  65

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
Greenhorn

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
Greenhorn

Joined: Apr 11, 2013
Posts: 1
You can use Spring 3 http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/http/MediaType.html

Represents an Internet Media Type, as defined in the HTTP specification.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Static constants for content type?
 
Similar Threads
Constants, where to place them.
MP3/J2ME
Using and accessing variables, constants, and Magic Cookie.
Interfaces
Enum vs Constant File