Hi Ivy Team

I have the following setup: A process is started to display a dialog. In the dialog (..../MyDialog.xhtml) a redirect to another site is executed and the site calls again .../MyDialog.xhtml?myParam=xyz

myParam should be read in a script box - usually one would use

... FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("myParam")

but looks like this doesn't work. Importantly I can not use the start/param mapping feature.

So is there another way to read the parameter or the request path ?

Thanks & Regards John

asked 22.02.2019 at 05:42

John%20Moser's gravatar image

John Moser
(suspended)
accept rate: 0%

edited 22.02.2019 at 05:45


Ivy.request.getFirstParameterXssAware("myParam")

link

answered 22.02.2019 at 10:10

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

Unfortunately that doesn't work (for my setup).

Solution (seems more like a hack to me - therefore any corrections are welcome):

  • Call ManagedBean in xhtml via p:remoteCommand or similar method
  • Read parameter via FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("myParam") and store it as a param in ManagedBean
  • Read parameter from ManagedBean in ScriptBox
(25.02.2019 at 04:02) John Moser John%20Moser's gravatar image

Yep sounds definitively like a hack. Maybe you can share why and how you trigger the redirect in first place and look for an alternative solution in this area.

(25.02.2019 at 09:42) Reguel Werme... ♦♦ Reguel%20Wermelinger's gravatar image

We are trying to implement a OAuth flow. Usually this is implemented by using redirects in a browser. Also OAuth is adding parameters to the URI. So this means we need to read them from there. Further the OAuth system will check the redirect URI, that means we can't jump from URI_1 and then use redirect URI_2. The implementation currently is as follows ( https://jira.axonivy.com/confluence/display/~jmo/OAuth+flow+with+Ivy ) : - there is a "Display Accounts" process which displays a dialog (xhtml) - in the "xhtml" there are 2 calls which run asynchronously ...

(26.02.2019 at 08:09) John Moser John%20Moser's gravatar image

... a) <f:viewaction> to calculate the URI and read request params if available b) <p:remotecommand> to load the data to be displayed, which also triggers the OAuth flow if necessary -> sub process getAccountData() - as you can see in the gfx, "Redirect to OAuth" redirects to the OAuth uri to start the OAuth flow - after the OAuth flow the "xhtml" is loaded again but the process starts right with getAccountData() ... i guess due to loading of "xhtml"

=> imho - in a "user dialog method start", one should be able to map the request params like in a "request start"

(26.02.2019 at 08:09) John Moser John%20Moser's gravatar image

Hey John,

thanks for your sample flow. I think the issues with it arise as you check the OAuth token within an existing UserDialog. And you can't safely redirect to another page within that JSF Dialog without loosing context information.

To work around for that problem: I think it would be easier to work with extra screens/Ui Dialogs in case the OAuth token is not present/valid. You could even stick to your current solution and leave the already running dialog with an ErrorEnd event, which you catch outside the dialog and if necessary delegate the request to the OAuth form UI.

A solution very similar to my proposal can be found in the official 'ConnectivityDemos', which are shipped as Designer sample. See Import -> Axon.ivy > Samples > ConnectivityDemos : alt text

link

answered 01.03.2019 at 09:41

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

edited 04.03.2019 at 09:51

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×5

Asked: 22.02.2019 at 05:42

Seen: 2,000 times

Last updated: 04.03.2019 at 09:51