I want to redirect in send() to a variable page

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

I want to redirect in send() to a variable page

falba48
Hi,

I would need to be able to redirect from send () to a parameter send by my
servlet app.

The scenario would be:

The user opens the form that is integrated in a JSP, fills it and make a
save-final ()

Orbeon sends the XML to my app, and it returns a redirect or a parameter
(with a variable url depending on the content of the XML).

Orbeon in the process.save-final does a navigate (parameter).

An example of what I have tried:

In the response i send to orbeon have a redirect (Location):

*--- logs from orbeon.log ---*
2020-05-15 13:48:35,698 DEBUG XFormsServer  -                        
response headers {Location:
"http://localhost:8080/formularis/GuardatCorrecte.html", Keep-Alive:
"timeout=20", Connection: "keep-alive", Content-Length: "0", Date: "Fri, 15
May 2020 11:48:35 GMT"}

I tried to put then in process at propierties-local.xml. This is an example
to explain, I know that the get-response-header does not exist.

*--- my config of properties-local.xml ---*
    <property as="xs:string" name="oxf.fr.detail.buttons.Proves.enviaXml">
        save-final
    </property>

    <property as="xs:string"
name="oxf.fr.detail.process.save-final.Proves.enviaXml">
        require-valid
       
        then save
        then send(
            uri        = "http://localhost:8080/formularis/ServletEnviaXml",
            method     = "POST",
            content    = "xml"
        )
        then navigate("{xxf:get-response-header('Location')}")
        recover navigate("http://localhost:8080/formularis/error.html")
    </property>

Greetings and thank


--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1589546158119-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: I want to redirect in send() to a variable page

Alessandro  Vernet
Administrator
Hi,

Currently, in a process, you don't have access to the headers returned by
the service you call with `send()`. This is covered by request for
enhancement #1688 (see 1st link below), and I added a +1 from you. In your
case however, you could maybe use `replace = "all"`, in which case Orbeon
Forms "proxies" what is returned by the service back to the browser, so you
can have a response with an empty body and a `Location: …` telling the
browser where to go next. Would that work for you?

https://github.com/orbeon/orbeon-forms/issues/1688
https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/actions-form-runner/actions-form-runner-send

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1589597989941-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: I want to redirect in send() to a variable page

falba48
This solution works, thanks.

But in the JavaEmbededAPI documentation
(https://doc.orbeon.com/form-runner/link-embed/java-api) it says, you can't
put in a send () a replace = "all".
It means to the send () of the property-local.xml? What problems can be
caused by using replace = "all"?




--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1589703607537-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: I want to redirect in send() to a variable page

falba48
In reply to this post by falba48
This solution works, thanks.

But in the JavaEmbededAPI documentation (https://doc.orbeon.com/form-runner/link-embed/java-api) it says, does not support a send () to replace = "all".
It means  to  the send () of the property-local.xml? What problems can be caused by using replace = "all"?

El viernes, 15 de mayo de 2020, 19:16:16 (UTC+2), Patxi Alba escribió:
Hi,

I would need to be able to redirect from send () to a parameter send by my
servlet app.

The scenario would be:

The user opens the form that is integrated in a JSP, fills it and make a
save-final ()

Orbeon sends the XML to my app, and it returns a redirect or a parameter
(with a variable url depending on the content of the XML).

Orbeon in the process.save-final does a navigate (parameter).

An example of what I have tried:

In the response i send to orbeon have a redirect (Location):

*--- logs from orbeon.log ---*
2020-05-15 13:48:35,698 DEBUG XFormsServer  -                        
response headers {Location:
"<a href="http://localhost:8080/formularis/GuardatCorrecte.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8080%2Fformularis%2FGuardatCorrecte.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFUBJY0MWQa-fE5DgbEuZavHZwRPg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8080%2Fformularis%2FGuardatCorrecte.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFUBJY0MWQa-fE5DgbEuZavHZwRPg&#39;;return true;">http://localhost:8080/formularis/GuardatCorrecte.html", Keep-Alive:
"timeout=20", Connection: "keep-alive", Content-Length: "0", Date: "Fri, 15
May 2020 11:48:35 GMT"}

I tried to put then in process at propierties-local.xml. This is an example
to explain, I know that the get-response-header does not exist.

*--- my config of properties-local.xml ---*
    <property as="xs:string" name="oxf.fr.detail.buttons.Proves.enviaXml">
        save-final
    </property>

    <property as="xs:string"
name="oxf.fr.detail.process.save-final.Proves.enviaXml">
        require-valid
       
        then save
        then send(
            uri        = "<a href="http://localhost:8080/formularis/ServletEnviaXml" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8080%2Fformularis%2FServletEnviaXml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHtGeTKraUfXkwajf1ZE7juJIs1lw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8080%2Fformularis%2FServletEnviaXml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHtGeTKraUfXkwajf1ZE7juJIs1lw&#39;;return true;">http://localhost:8080/formularis/ServletEnviaXml",
            method     = "POST",
            content    = "xml"
        )
        then navigate("{xxf:get-response-header('Location')}")
        recover navigate("<a href="http://localhost:8080/formularis/error.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8080%2Fformularis%2Ferror.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFsg9-yVPt8zR4icD_41Ns16l0_6w&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8080%2Fformularis%2Ferror.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFsg9-yVPt8zR4icD_41Ns16l0_6w&#39;;return true;">http://localhost:8080/formularis/error.html")
    </property>

Greetings and thank


--
Sent from: <a href="http://discuss.orbeon.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;">http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/3d372e59-8908-41fb-84a0-32ab89c1ec6a%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: I want to redirect in send() to a variable page

Alessandro  Vernet
Administrator
You are saying that "this solution works"; so you tried, and you are able to
issue a redirect with a "Location: …" header, correct?

Regarding the `replace="all"` not being supported, in general, when you use
a `replace="all"`, what is being returned is another page (i.e. HTML), or in
the case of Orbeon Forms maybe another form, or the same form in view mode,
or similar. In those cases, you might want your form to be replaced by the
"target page", keeping what is around the form, and that isn't currently
supported.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1589864339617-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: I want to redirect in send() to a variable page

falba48
In reply to this post by falba48
Yes, I have redirected with the Location, and also with a forward ().

Thanks for the answers and clarifications.

El viernes, 15 de mayo de 2020, 19:16:16 (UTC+2), Patxi Alba escribió:
Hi,

I would need to be able to redirect from send () to a parameter send by my
servlet app.

The scenario would be:

The user opens the form that is integrated in a JSP, fills it and make a
save-final ()

Orbeon sends the XML to my app, and it returns a redirect or a parameter
(with a variable url depending on the content of the XML).

Orbeon in the process.save-final does a navigate (parameter).

An example of what I have tried:

In the response i send to orbeon have a redirect (Location):

*--- logs from orbeon.log ---*
2020-05-15 13:48:35,698 DEBUG XFormsServer  -                        
response headers {Location:
"<a href="http://localhost:8080/formularis/GuardatCorrecte.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8080%2Fformularis%2FGuardatCorrecte.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFUBJY0MWQa-fE5DgbEuZavHZwRPg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8080%2Fformularis%2FGuardatCorrecte.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFUBJY0MWQa-fE5DgbEuZavHZwRPg&#39;;return true;">http://localhost:8080/formularis/GuardatCorrecte.html", Keep-Alive:
"timeout=20", Connection: "keep-alive", Content-Length: "0", Date: "Fri, 15
May 2020 11:48:35 GMT"}

I tried to put then in process at propierties-local.xml. This is an example
to explain, I know that the get-response-header does not exist.

*--- my config of properties-local.xml ---*
    <property as="xs:string" name="oxf.fr.detail.buttons.Proves.enviaXml">
        save-final
    </property>

    <property as="xs:string"
name="oxf.fr.detail.process.save-final.Proves.enviaXml">
        require-valid
       
        then save
        then send(
            uri        = "<a href="http://localhost:8080/formularis/ServletEnviaXml" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8080%2Fformularis%2FServletEnviaXml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHtGeTKraUfXkwajf1ZE7juJIs1lw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8080%2Fformularis%2FServletEnviaXml\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHtGeTKraUfXkwajf1ZE7juJIs1lw&#39;;return true;">http://localhost:8080/formularis/ServletEnviaXml",
            method     = "POST",
            content    = "xml"
        )
        then navigate("{xxf:get-response-header('Location')}")
        recover navigate("<a href="http://localhost:8080/formularis/error.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8080%2Fformularis%2Ferror.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFsg9-yVPt8zR4icD_41Ns16l0_6w&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A8080%2Fformularis%2Ferror.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFsg9-yVPt8zR4icD_41Ns16l0_6w&#39;;return true;">http://localhost:8080/formularis/error.html")
    </property>

Greetings and thank


--
Sent from: <a href="http://discuss.orbeon.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fdiscuss.orbeon.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF5V5zfD-87RVoalaG4cqO_RzdDcA&#39;;return true;">http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/a8151166-a53c-44c2-89f0-562dfbe4096c%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: I want to redirect in send() to a variable page

Alessandro  Vernet
Administrator
👍

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1590004566643-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet