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 <[EMAIL PROTECTED]> wrote:
--- chengas123 <[EMAIL PROTECTED]> wrote:
> However, now I'm having the problem that I can't
> figure out how to access the HTTP request headers
> from the interceptor.

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.

> Is ServletRequestAware meant to be used only in
> Actions?  I am receiving a null HTTP Request Servlet

> in my Interceptor.

Um... yeah. Well, I mean, you can use it anywhere you
want, but the framework (AFAIK) only pays attention to
it in Actions, where an interceptor uses it to decide
if it needs to set anything in the Action.

d.




____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. 
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545433

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to