struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chengas123 <benjamin.j.mcc...@gmail.com>
Subject Re: [S2] Accessing HTTP Header
Date Wed, 13 Jun 2007 14:44:25 GMT

Thank you both for your responses.  While I had tried going down the
ActionInvocation.getInvocationContext(...) road I didn't see anything
interesting that way and probably would have never thought to cast it to a
ServletActionContext (although hopefully I will next time).  I'm using the
ThreadLocal approach right now for brevity.  Is there any performance
difference or other difference between the two approaches that I should be
aware of?  



Yoni Amir-2 wrote:
> 
> Here is an interceptor that I use to manipulate the HttpResponse
> object. You can do the same for the HttpRequest.
> 
> public String intercept(ActionInvocation actionInvocation) throws
> Exception {
>   HttpServletResponse resp = ServletActionContext.getResponse();
>   resp.setHeader("Pragma", "no-cache");
>   // etc ...
> }
> 
> Notice that ActionContext (and ServletActionContext) is ThreadLocal.
> That's why this code is so concise.
> 
> 
> On 6/13/07, Dave Newton <newton.dave@yahoo.com> wrote:
>> Follow the yellow brick API...
>>
>> What's the signature of Interceptor.intercept?
>>
>> String intercept(ActionInvocation)
>>
>> What's an ActionInvocation? Oh, it's an interface. One
>> thing that looks particularly interesting is
>> ActionInvocation.getInvocationContext(...) -- it's
>> interesting because it contains the word "context".
>>
>> Okay, that returns an ActionContext. One
>> *particularly* interesting implementation of
>> ActionContext is ServletActionContext.
>>
>> d.
>>
> 

-- 
View this message in context: http://www.nabble.com/-S2--Accessing-HTTP-Header-tf3907721.html#a11100917
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message