Extracting URL parameters

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

Extracting URL parameters

Waseem Quraishi
Hello all,

I have a quick, relatively simple question in regards to extracting parameters from the URL.  I have a process where an external application will be calling an XFORM url and passing in a returnURL parameter.  I want to be able to extract that from the URL and create a return button using the address.

I read the documentation regarding setting up a default submission but have had no luck getting it to work.  This is what I have:

1.  In page-flow.xml I added:
    <page id="pw-reset" path-info="/pwreset"
        view="/apps/sitc-fs/view
/signup-view.xhtml"
        default-submission="/apps/sitc-fs/model/parameters.xml">
         <setvalue ref="/submission/return-url" parameter="return-url"/>
    </page>   

2. In the model directory, I created a new parameters.xml file:
<parameters>
  <return-url/>
</parameters>

3.  In model.xml, I added a new parameters-instance model:
    <xforms:instance id="parameters-instance">       
        <xi:include href="input:instance" xxi:omit-xml-base="true"/>   
    </xforms:instance>   

The page properly shows the signup-view.xhtml but the parameters instance defined in #2 is not populated wth any values.  The URL I'm using is:
<a href="http://localhost:8080/ops/pwreset?return-url=google.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://localhost:8080/ops/pwreset?return-url=google.com . 


When I look at parameters.xml, I see:
<xi :include href="input:instance " xxi:omit-xml-base="true " xmlns:xhtml="<a href="http://www.w3.org/1999/xhtml" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://www.w3.org/1999/xhtml" xmlns:xxi=" <a href="http://orbeon.org/oxf/xml/xinclude" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://orbeon.org/oxf/xml/xinclude" xmlns :xsl="<a href="http://www.w3.org/1999/XSL/Transform" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/1999/XSL/Transform " xmlns:xs="<a href="http://www.w3.org/2001/XMLSchema" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://www.w3.org/2001/XMLSchema" xmlns:xforms ="<a href="http://www.w3.org/2002/xforms" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/2002/xforms" xmlns :ev="<a href="http://www.w3.org/2001/xml-events" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/2001/xml-events " xmlns:xxforms="<a href="http://orbeon.org/oxf/xml/xforms" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://orbeon.org/oxf/xml/xforms" xmlns:exforms ="<a href="http://www.exforms.org/exf/1-0" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.exforms.org/exf/1-0" xmlns :xi="<a href="http://www.w3.org/2001/XInclude" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/2001/XInclude" xmlns:f="<a href="http://orbeon.org/oxf/xml/formatting" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://orbeon.org/oxf/xml/formatting"/>


I'd appreciate any feedback as to how to extract the parameters passed in the URL.  Thanks for your help.

w


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Extracting URL parameters

Waseem Quraishi
Hi everyone,

I got this working.  For those that are interested....

Modified page-flow.xml as such:
    <page id="pw-reset" path-info="/pwreset"
        view="/apps/sitc-fs/view/signup- ext-view.xhtml"
        default-submission="/apps/sitc-fs/model/parameters.xml">
         <setvalue ref="/parameters/return-url" parameter="return-url"/>
    </page>       

Created a new file called signup-ext-view.xhtml as such:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd "> 
<html xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xforms="http://www.w3.org/2002/xforms "
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms "
    xmlns:exforms="http://www.exforms.org/exf/1-0"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:f="http://orbeon.org/oxf/xml/formatting"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.w3.org/1999/xhtml" xsl:version="2.0">
    <head>
          <xforms:model>
              <xforms:instance>
                  <xsl:copy-of select="doc('input:instance')"/>
              </xforms:instance>
          </xforms:model>
      </head>
      <body>
          <h2>Some XForms Controls</h2>
          <xforms:output ref="return-url"/>
          <h2>Entire XML Instance</h2>
          <f:xml-source>
              <xsl:copy-of select="doc('input:instance')"/>
          </f:xml-source>
         
           <widget:xforms-instance-inspector xmlns:widget="http://orbeon.org/oxf/xml/widget" />
      </body>   
</html>


Called the file like this: 
http://localhost:8080/ops/pwreset?return-url=http://www.google.com

Got this document:



On 8/13/07, Waseem Quraishi <[hidden email]> wrote:
Hello all,

I have a quick, relatively simple question in regards to extracting parameters from the URL.  I have a process where an external application will be calling an XFORM url and passing in a returnURL parameter.  I want to be able to extract that from the URL and create a return button using the address.

I read the documentation regarding setting up a default submission but have had no luck getting it to work.  This is what I have:

1.  In page-flow.xml I added:
    <page id="pw-reset" path-info="/pwreset"
        view="/apps/sitc-fs/view
/signup-view.xhtml"
        default-submission="/apps/sitc-fs/model/parameters.xml">
         <setvalue ref="/submission/return-url" parameter="return-url"/>
    </page>   

2. In the model directory, I created a new parameters.xml file:
<parameters>
  <return-url/>
</parameters>

3.  In model.xml, I added a new parameters-instance model:
    <xforms:instance id="parameters-instance">       
        <xi:include href="input:instance" xxi:omit-xml-base="true"/>   
    </xforms:instance>   

The page properly shows the signup-view.xhtml but the parameters instance defined in #2 is not populated wth any values.  The URL I'm using is:
<a href="http://localhost:8080/ops/pwreset?return-url=google.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://localhost:8080/ops/pwreset?return-url=google.com . 


When I look at parameters.xml, I see:
<xi :include href="input:instance " xxi:omit-xml-base="true " xmlns:xhtml="<a href="http://www.w3.org/1999/xhtml" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://www.w3.org/1999/xhtml" xmlns:xxi=" <a href="http://orbeon.org/oxf/xml/xinclude" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://orbeon.org/oxf/xml/xinclude" xmlns :xsl="<a href="http://www.w3.org/1999/XSL/Transform" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/1999/XSL/Transform " xmlns:xs="<a href="http://www.w3.org/2001/XMLSchema" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://www.w3.org/2001/XMLSchema" xmlns:xforms ="<a href="http://www.w3.org/2002/xforms" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/2002/xforms" xmlns :ev="<a href="http://www.w3.org/2001/xml-events" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/2001/xml-events " xmlns:xxforms="<a href="http://orbeon.org/oxf/xml/xforms" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://orbeon.org/oxf/xml/xforms" xmlns:exforms ="<a href="http://www.exforms.org/exf/1-0" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.exforms.org/exf/1-0" xmlns :xi="<a href="http://www.w3.org/2001/XInclude" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/2001/XInclude" xmlns:f="<a href="http://orbeon.org/oxf/xml/formatting" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://orbeon.org/oxf/xml/formatting"/>


I'd appreciate any feedback as to how to extract the parameters passed in the URL.  Thanks for your help.

w



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws