Just tried that without success. Oddly, even when I debug the code, the reponse.contentType is not changed immediately after the line: response.setContentType("text/plain"). I am wondering if the contentType cannot be set twice (or overridden once set)?
On Sun, Dec 30, 2012 at 11:39 AM, Lukasz Lenart <lukaszlen...@apache.org>wrote: > 2012/12/30 Burton Rhodes <burtonrho...@gmail.com>: > > I'm not sure what I'm doing wrong, but I cannot for the life of me change > > the content-type of the response using an interceptor. My interceptor > code > > is below. The example below seems a bit absurd, but eventually I will > add > > code to change the content-type dynamically from "application/json" to > > "text/plain" depending on what the request will "accept" (this is to fix > an > > IE bug related to ajax file uploads). What am I missing here? Many > thanks > > in advance. > > > > <!-- struts.xml snippit --> > > <package name="jsonSecure" namespace="/app/json" extends="json-default"> > > > > <interceptors> > > <interceptor name="jsonDynamicContentType" > > class="com.afs.web.interceptor.JsonDynamicContentTypeInterceptor"/> > > <interceptor-stack name="dynamicContentType"> > > <interceptor-ref name="json"/> > > <interceptor-ref name="jsonDynamicContentType"/> > > </interceptor-stack> > > </interceptors> > > Did you try to change order of the interceptors? Interceptors are > executed in FILO - First-In-Last-Out - which means json interceptor > will be executed as the first one, but when action was executed and > result will be forwarded back, json interceptor will be executed as > the last one: > > json->jsonDynamicContentType->action->result->jsonDynamicContentType->json > > http://struts.apache.org/2.x/docs/interceptors.html > > > Regards > -- > Ćukasz > + 48 606 323 122 http://www.lenart.org.pl/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >