You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de> on 2008/11/21 13:41:33 UTC

How to generate PortletURL in Event / Action Phase?

Hi. I need to programmatically create an PortletURL to include in an email.

Trying to use the PortletHelper to build the URL does not help because it does 
fail with this exception:

RenderRequest cannot be obtained in event phase

RenderRequest request = PortletActionContext.getRenderRequest();

If it can not be obtained, how can i generate an action url in the event 
phase?



-- 
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

Re: How to generate PortletURL in Event / Action Phase?

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Yhea, I noticed a JIRA issue for that. However, it should be possible
to construct the urls "by hand".

Nils-H

On Fri, Nov 21, 2008 at 3:14 PM, Torsten Krah
<tk...@fachschaft.imn.htwk-leipzig.de> wrote:
> Am Freitag, 21. November 2008 14:16:31 schrieb Nils-Helge Garli Hegvik:
>> Yes, I would handle this outside the portlet. As you say, it's not
>> than uncommon, and it should be easily solved using a servlet.
>
> I used buildResourceUrl on PortletUrlHelper to generate my servlet urls
> handled by FilterDispatcher.
> This won't work either.
> Some Ideas how to build the url otherwise with struts2?
>
>
>
> --
> 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


Re: How to generate PortletURL in Event / Action Phase?

Posted by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>.
Am Freitag, 21. November 2008 14:16:31 schrieb Nils-Helge Garli Hegvik:
> Yes, I would handle this outside the portlet. As you say, it's not
> than uncommon, and it should be easily solved using a servlet.

I used buildResourceUrl on PortletUrlHelper to generate my servlet urls 
handled by FilterDispatcher.
This won't work either.
Some Ideas how to build the url otherwise with struts2?



-- 
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

Re: How to generate PortletURL in Event / Action Phase?

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Yes, I would handle this outside the portlet. As you say, it's not
than uncommon, and it should be easily solved using a servlet.

Nils-H

On Fri, Nov 21, 2008 at 2:07 PM, Torsten Krah
<tk...@fachschaft.imn.htwk-leipzig.de> wrote:
> Am Friday 21 November 2008 13:57:26 schrieben Sie:
>> You can't. It's a limitation of the portlet spec.
>
> Ok. Lets take this scenario:
>
> User fill out some registration form (portlet) and want to receive a optin
> email with a activation "link".
> How would this be done with portlets (spec v1)? Is it not possible? Do i need
> to use some servlet for this?
> How to solve this scenario, which i guess is not that uncommon?
>
> --
> 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


Re: How to generate PortletURL in Event / Action Phase?

Posted by Torsten Krah <tk...@fachschaft.imn.htwk-leipzig.de>.
Am Friday 21 November 2008 13:57:26 schrieben Sie:
> You can't. It's a limitation of the portlet spec.

Ok. Lets take this scenario:

User fill out some registration form (portlet) and want to receive a optin 
email with a activation "link".
How would this be done with portlets (spec v1)? Is it not possible? Do i need 
to use some servlet for this?
How to solve this scenario, which i guess is not that uncommon?

-- 
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

Re: How to generate PortletURL in Event / Action Phase?

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
You can't. It's a limitation of the portlet spec. URLs can only be
created (in a portable manner) through the RenderResponse (or
MimeResponse in the 2.0 spec) interface which is only available in the
render phase. I'm not even sure that it's guaranteed that the
generated url would be "static" anyway. Depending on your requirement,
your portal server might have some sort of support for "bookmarkable
urls" that might can be used instead.

Nils-H

On Fri, Nov 21, 2008 at 1:41 PM, Torsten Krah
<tk...@fachschaft.imn.htwk-leipzig.de> wrote:
> Hi. I need to programmatically create an PortletURL to include in an email.
>
> Trying to use the PortletHelper to build the URL does not help because it does
> fail with this exception:
>
> RenderRequest cannot be obtained in event phase
>
> RenderRequest request = PortletActionContext.getRenderRequest();
>
> If it can not be obtained, how can i generate an action url in the event
> phase?
>
>
>
> --
> 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