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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP Response" Watch "HTTP Response" New topic

HTTP Response

Nit Kul

Joined: Oct 26, 2009
Posts: 14
I am applying some filter on all response to the requests coming to my web server.
I need to apply this filter only on the responses of the type "text/html".

How can i check the content type to be text/html on the response object?

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 39529
Does none of the methods of the HttpServletResponse class suggest itself to find out the content type?

Ping & DNS - updated with new look and Ping home screen widget
Nit Kul

Joined: Oct 26, 2009
Posts: 14
I could not find any api methods for response object. i.e. response.getContentType().

Thanks for the reply.

David Newton

Joined: Sep 29, 2008
Posts: 12617

Check again--and remember, this is Java, and has inheritance.
I agree. Here's the link:
subject: HTTP Response
Similar Threads
Default content-type
Displaying an image in a servlet
How to Use bean:write inside html:text
How to force encoding of web browser to UTF-8