struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ossieguy <ossie...@hotmail.com>
Subject Re: Struts2 Portlet - pre/post render, pre/post action hooks?
Date Mon, 18 Aug 2008 13:28:23 GMT

Torsten, did you ever solve this? We're having the same problem.

I think it's worth mentioning that the "action phase" and "render phase" are
distinct concepts that come directly from the Portlet API, with or without
Struts. 

So Torsten's original confusion is ours as well - Struts2 portlet support
doesn't seem to separate the two, but rather lump them together as a single
"view phase". Obviously this is a big problem performance wise, e.g. you
really want to make your heavy service-tier invocation at action time, and
*not* each time a user resizes a portlet for instance - that would just be a
call to render.

The PortletActionContext does make mention of the RENDER_PHASE, we're
looking now at how to use that, probably in an if-then expression within the
single execute() method.

The generic interceptor concept, while somewhat analogous to the action
phase/render phase, doesn't really solve the problem that struts lacks a
natural exposure of the underlying portlet API.

So I can't resist quoting the Spring Portlet MVC docs: "Most other portlet
MVC frameworks attempt to completely hide the two phases from the developer
and make it look as much like traditional servlet development as possible -
we think this approach removes one of the main benefits of using portlets." 

But we'd really rather use Struts2!

Cheers,

Ossie



Nils-Helge Garli wrote:
> 
> I think you should be able to write an interceptor to do this. Take a
> look at [1] and [2] for some information about how it works and how to
> write custom interceptors. All the information you need to access
> should be available in the invocation context. You should also take a
> look at the PortletActionContext class.
> 
> Nils-H
> 
> [1] - http://struts.apache.org/2.x/docs/interceptors.html
> [2] - http://struts.apache.org/2.x/docs/writing-interceptors.html
> 
> 
>> I want to intercept the dispatching of the "Render" and "Action" phase of
>> the
>> portlet, to inject SecurityContext of Spring Security, like its done with
>> spring portlet mvc framework (there are HandlerAdapters which do that).
>>
>> Is this possible using interceptors?
>> How do i know if its a doAction or doRender request from interceptors
>> point of
>> view ? And how do i know if its "before" or "after"?
>> Afaik see interceptor does not know this as ActionProxy Chain does call
>> them
>> which is invoked from Jsr168Dispatcher, am i right?
>> If this is the case, i don't know "where" i am and can't do this with
>> interceptors.
>>
>> If its not possible, what would be the "best" way to do so?
>>
>> Torsten
>>
>> --
>> Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
>> Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html
>>
>> Really, I'm not out to destroy Microsoft. That will just be a
>> completely unintentional side effect."
>>        -- Linus Torvalds
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Struts2-Portlet---pre-post-render%2C-pre-post-action-hooks--tp18980787p19031431.html
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