This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman 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 Building Microservices this week in the Design 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: 63232

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.
I agree. Here's the link:
subject: Static constants for content type?
It's not a secret anymore!