2009/2/5 Caldarale, Charles R <chuck.caldar...@unisys.com>:
>> From: Dave Pawson [mailto:dave.paw...@gmail.com]
>> Subject: TC6 ${CATALINA_HOME}/conf/web.xml Is this the place
>> to constrain the mime type?
>>
>> I want to 'reject' (if that's the right word) any http get
>> with mime type != application/xml
>
> Do you mean .html and .jsp are not valid?  That might make life interesting.  
> It will be difficult to stop clients from accepting at least text/html in 
> addition to application/xml.

Wrong way round?

Background.
Currently I generate a template (outline XML) for an atom feed I run.
This is 'wrong' (IMHO). I have a tiny server visible to the web.
I want to use REST to 'get' this template (hence restrict it to application/xml)
 so if you|anyone does a GET on this url I want to 'refuse' you content, by
returning an http 'error'..... code TBD, I'm sure Roy defined one :-)

So unless the GET is for application/xml I want to return nothing.


>
>> I see in web.xml in the conf directory
>>  <mime-mapping>
>>         <extension>xml</extension>
>>         <mime-type>application/xml</mime-type>
>>     </mime-mapping>
>> Is this the right place to do it please?
>
> No - that would pretty much certainly break things.  Also, AFAIK, that's only 
> used for responses, so that the container can set the mime type properly for 
> whatever resource is being returned.

>
> You probably need to do this in a filter that will see the request before 
> your servlets do.

Makes sense (in my very limited view of http)

Check if the GET is for the 'desired' mime type.
If it isn't... respond accordingly..... at the header level?

10.4.16 415 Unsupported Media Type

The server is refusing to service the request because the entity of
the request is in a format not supported by the requested resource for
the requested method.

(http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)



Does that make sense?


regards



-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to