xforms-server-submit confusion

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

xforms-server-submit confusion

Adrian Baker-2
I'm having real problems getting a <xforms:submission> with
replace="all" working. I'm not using any OPS page flow at all, I
explicitly forward requests to OPS's XForms processor. Submissions with
replace="instance" work fine.

Firstly I realised I need to map the /xforms-server-submit url to OPS
(because when I hit submit I got a 404).. So without really knowing what
I was doing I added this to my web.xml:
    <servlet>
        <servlet-name>ops-xforms-server-servlet</servlet-name>
        <servlet-class>org.orbeon.oxf.servlet.OPSServlet</servlet-class>
        <!-- Set main processor -->
        <init-param>
            <param-name>oxf.main-processor.name</param-name>
           
<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
        </init-param>
        <init-param>
            <param-name>oxf.main-processor.input.config</param-name>
           
<param-value>oxf:/ops/xforms/xforms-server-submit.xpl</param-value>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>ops-xforms-server-submit-servlet</servlet-name>
        <url-pattern>/xforms-server-submit</url-pattern>
    </servlet-mapping>  

This didn't work: I got bizarre problems with submissions occuring twice
(!) and the response wasn't outputted to the browser. Should this work?

So next I started trying to understand how the OPS examples portal
works. I couldn't see how the /xforms-server-submit url was ever being
mapped to the xforms-server-submit.xpl. Then I found this bit of
trickery in org.orbeon.oxf.processor.PageFlowControllerProcessor:

    final String xformsSubmissionPath =
getPropertySet().getString(XFORMS_SUBMISSION_PATH_PROPERTY_NAME);
    final String xformsSubmissionModel =
getPropertySet().getStringOrURIAsString(XFORMS_SUBMISSION_MODEL_PROPERTY_NAME);
    ...
    }
    if (xformsSubmissionPath != null) {
        final Element firstPageElement =
controllerDocument.getRootElement().element("page");
        if (firstPageElement != null) {
            final List allElements =
controllerDocument.getRootElement().elements();
            final int firstPageElementIndex =
allElements.indexOf(firstPageElement);
            final Element newElement = Dom4jUtils.createElement("page",
CONTROLLER_NAMESPACE_URI);
            newElement.addAttribute("path-info", xformsSubmissionPath);
            newElement.addAttribute("model", xformsSubmissionModel);
            allElements.add(firstPageElementIndex, newElement);
        }
    }

So... for any page flow that has a <page> element, it adds another
<page> which points to the xforms-server-submit url & xpl specified in
properties.xml. Okay... The first problem I found with this is that the
URL in properties.xml isn't respected by outputted HTML - it's hardcoded
in org.orbeon.oxf.xforms.processor.handlers.XHTMLBodyHandler to
/xforms-server-submit:

    helper.startElement(prefix, XMLConstants.XHTML_NAMESPACE_URI,
"form", new String[]{
            "id", "xforms-form", "class", "xforms-form",
            "action", "/xforms-server-submit, "method", "POST",
"onsubmit", "return false",
            hasUpload ? "enctype" : null, hasUpload ?
"multipart/form-data" : null});

So it needs a bit of code like
    final String xformsServerUrl = OXFProperties.instance().getPropertySet(
            new
QName("page-flow",XMLConstants.OXF_PROCESSORS_NAMESPACE)).getString(
                   
PageFlowControllerProcessor.XFORMS_SUBMISSION_PATH_PROPERTY_NAME,
"/xforms-server-submit");
   
    helper.startElement(prefix, XMLConstants.XHTML_NAMESPACE_URI,
"form", new String[]{
            "id", "xforms-form", "class", "xforms-form",
            "action", xformsServerUrl, "method", "POST", "onsubmit",
"return false",
            hasUpload ? "enctype" : null, hasUpload ?
"multipart/form-data" : null});  

Except that the QName being constructed should be put in XMLConstants,
and the XFORMS_SUBMISSION_PATH_PROPERTY_NAME static is private.

To see if I should be using this automatically added reference to
xforms-server-subimt, I created a not quite empty page-flow, and ensured
that the /xforms-server-submit mapping pointed to it:

<config xmlns="http://www.orbeon.com/oxf/controller"
        xmlns:xu="http://www.xmldb.org/xupdate"
        xmlns:oxf="http://www.orbeon.com/oxf/processors">
       
        <page id="dummy" path-info="/this-should-never-match"
model="oxf:/ops/dont-care.xpl"/>
       
</config>

And at the end of all this, I still got the double submission problem, I
guess because this is just a different way of stating what I'd done in
my first attempt. So I really have no idea what to try from here... Any
hints?

If it's at all relevant, the submission is being fired by a trigger
displayed as an anchor, with a composite action:

<xforms:trigger appearance="xxforms:link">
    <xforms:label>Create</xforms:label>
    <xforms:action ev:event="DOMActivate">
        <xforms:setvalue ref="instance('new')/name"
value="instance('name')/name" />
        <xforms:send submission="submit-new-field" />
    </xforms:action>
</xforms:trigger>

Adrian




   



--
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: xforms-server-submit confusion

Alessandro  Vernet
Administrator
Hi Adrian,

You're saying that your page is not displayed through the PFC. How it
is displayed then? Is it another servlet generating XForms that gets
transformed with a servlet filter?

Very... let say /interesting/ things happen when pages are displayed
through the portal. But things are much more straightforward when the
portal is not used. Are your pages displayed through the portal? If
they are not, you should see a query going directly to /xforms-server.

Alex

On 3/14/06, Adrian Baker <[hidden email]> wrote:

> I'm having real problems getting a <xforms:submission> with
> replace="all" working. I'm not using any OPS page flow at all, I
> explicitly forward requests to OPS's XForms processor. Submissions with
> replace="instance" work fine.
>
> Firstly I realised I need to map the /xforms-server-submit url to OPS
> (because when I hit submit I got a 404).. So without really knowing what
> I was doing I added this to my web.xml:
>     <servlet>
>         <servlet-name>ops-xforms-server-servlet</servlet-name>
>         <servlet-class>org.orbeon.oxf.servlet.OPSServlet</servlet-class>
>         <!-- Set main processor -->
>         <init-param>
>             <param-name>oxf.main-processor.name</param-name>
>
> <param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
>         </init-param>
>         <init-param>
>             <param-name>oxf.main-processor.input.config</param-name>
>
> <param-value>oxf:/ops/xforms/xforms-server-submit.xpl</param-value>
>         </init-param>
>     </servlet>
>
>     <servlet-mapping>
>         <servlet-name>ops-xforms-server-submit-servlet</servlet-name>
>         <url-pattern>/xforms-server-submit</url-pattern>
>     </servlet-mapping>
>
> This didn't work: I got bizarre problems with submissions occuring twice
> (!) and the response wasn't outputted to the browser. Should this work?
>
> So next I started trying to understand how the OPS examples portal
> works. I couldn't see how the /xforms-server-submit url was ever being
> mapped to the xforms-server-submit.xpl. Then I found this bit of
> trickery in org.orbeon.oxf.processor.PageFlowControllerProcessor:
>
>     final String xformsSubmissionPath =
> getPropertySet().getString(XFORMS_SUBMISSION_PATH_PROPERTY_NAME);
>     final String xformsSubmissionModel =
> getPropertySet().getStringOrURIAsString(XFORMS_SUBMISSION_MODEL_PROPERTY_NAME);
>     ...
>     }
>     if (xformsSubmissionPath != null) {
>         final Element firstPageElement =
> controllerDocument.getRootElement().element("page");
>         if (firstPageElement != null) {
>             final List allElements =
> controllerDocument.getRootElement().elements();
>             final int firstPageElementIndex =
> allElements.indexOf(firstPageElement);
>             final Element newElement = Dom4jUtils.createElement("page",
> CONTROLLER_NAMESPACE_URI);
>             newElement.addAttribute("path-info", xformsSubmissionPath);
>             newElement.addAttribute("model", xformsSubmissionModel);
>             allElements.add(firstPageElementIndex, newElement);
>         }
>     }
>
> So... for any page flow that has a <page> element, it adds another
> <page> which points to the xforms-server-submit url & xpl specified in
> properties.xml. Okay... The first problem I found with this is that the
> URL in properties.xml isn't respected by outputted HTML - it's hardcoded
> in org.orbeon.oxf.xforms.processor.handlers.XHTMLBodyHandler to
> /xforms-server-submit:
>
>     helper.startElement(prefix, XMLConstants.XHTML_NAMESPACE_URI,
> "form", new String[]{
>             "id", "xforms-form", "class", "xforms-form",
>             "action", "/xforms-server-submit, "method", "POST",
> "onsubmit", "return false",
>             hasUpload ? "enctype" : null, hasUpload ?
> "multipart/form-data" : null});
>
> So it needs a bit of code like
>     final String xformsServerUrl = OXFProperties.instance().getPropertySet(
>             new
> QName("page-flow",XMLConstants.OXF_PROCESSORS_NAMESPACE)).getString(
>
> PageFlowControllerProcessor.XFORMS_SUBMISSION_PATH_PROPERTY_NAME,
> "/xforms-server-submit");
>
>     helper.startElement(prefix, XMLConstants.XHTML_NAMESPACE_URI,
> "form", new String[]{
>             "id", "xforms-form", "class", "xforms-form",
>             "action", xformsServerUrl, "method", "POST", "onsubmit",
> "return false",
>             hasUpload ? "enctype" : null, hasUpload ?
> "multipart/form-data" : null});
>
> Except that the QName being constructed should be put in XMLConstants,
> and the XFORMS_SUBMISSION_PATH_PROPERTY_NAME static is private.
>
> To see if I should be using this automatically added reference to
> xforms-server-subimt, I created a not quite empty page-flow, and ensured
> that the /xforms-server-submit mapping pointed to it:
>
> <config xmlns="http://www.orbeon.com/oxf/controller"
>         xmlns:xu="http://www.xmldb.org/xupdate"
>         xmlns:oxf="http://www.orbeon.com/oxf/processors">
>
>         <page id="dummy" path-info="/this-should-never-match"
> model="oxf:/ops/dont-care.xpl"/>
>
> </config>
>
> And at the end of all this, I still got the double submission problem, I
> guess because this is just a different way of stating what I'd done in
> my first attempt. So I really have no idea what to try from here... Any
> hints?
>
> If it's at all relevant, the submission is being fired by a trigger
> displayed as an anchor, with a composite action:
>
> <xforms:trigger appearance="xxforms:link">
>     <xforms:label>Create</xforms:label>
>     <xforms:action ev:event="DOMActivate">
>         <xforms:setvalue ref="instance('new')/name"
> value="instance('name')/name" />
>         <xforms:send submission="submit-new-field" />
>     </xforms:action>
> </xforms:trigger>
>
> Adrian
>
>
>
>
>
>
>
>
>
> --
> 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
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: xforms-server-submit confusion

Adrian Baker-2
Actually it's not a filter, but similar. I'm making a direct Java API
call to orbeon:

    (once only)
    processorDefinition = new ProcessorDefinition();
    processorDefinition.setName(new QName("pipeline",
XMLConstants.OXF_PROCESSORS_NAMESPACE));

    processorDefinition.addInput("config",
"oxf:/orbeon/render-form-from-request.xpl");

    (per request)
    request.setAttribute("orion-xform", formDefinition);
    PipelineEngineFactory.instance().executePipeline(
        processorDefinition,
        new
ServletExternalContext(request.getSession().getServletContext(),
pipelineContext,
            new HashMap(), request, response), pipelineContext, LOGGER);

The render-form-from-request pipeline simply takes it input from the
request attribute using the scope generator:

    <p:processor name="oxf:scope-generator">
        <p:input name="config">
            <config>
                <key>orion-xform</key>
                <scope>request</scope>
            </config>
        </p:input>
        <p:output name="data" id="orion-xform"/>
    </p:processor>
    <p:processor name="oxf:pipeline">
        <p:input name="config" href="config/epilogue.xpl"/>
        <p:input name="data" href="#orion-xform"/>
       
        <p:input name="xforms-instance"><dummy/></p:input>
        <p:input name="xforms-model"><dummy/></p:input>
    </p:processor>

I'm not using the portal in any way no, I was just trying to look at it
to understand xforms-server-submit.

When I interact with the form, and when I submit a form using
replace="instance" everything runs through /xforms-server happily. It's
when I trigger a submission with replace="all" that I get the
/xforms-server-submit url being hit.

Adrian

Alessandro Vernet wrote:

> Hi Adrian,
>
> You're saying that your page is not displayed through the PFC. How it
> is displayed then? Is it another servlet generating XForms that gets
> transformed with a servlet filter?
>
> Very... let say /interesting/ things happen when pages are displayed
> through the portal. But things are much more straightforward when the
> portal is not used. Are your pages displayed through the portal? If
> they are not, you should see a query going directly to /xforms-server.
>
> Alex
>
> On 3/14/06, Adrian Baker <[hidden email]> wrote:
>  
>> I'm having real problems getting a <xforms:submission> with
>> replace="all" working. I'm not using any OPS page flow at all, I
>> explicitly forward requests to OPS's XForms processor. Submissions with
>> replace="instance" work fine.
>>
>> Firstly I realised I need to map the /xforms-server-submit url to OPS
>> (because when I hit submit I got a 404).. So without really knowing what
>> I was doing I added this to my web.xml:
>>     <servlet>
>>         <servlet-name>ops-xforms-server-servlet</servlet-name>
>>         <servlet-class>org.orbeon.oxf.servlet.OPSServlet</servlet-class>
>>         <!-- Set main processor -->
>>         <init-param>
>>             <param-name>oxf.main-processor.name</param-name>
>>
>> <param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
>>         </init-param>
>>         <init-param>
>>             <param-name>oxf.main-processor.input.config</param-name>
>>
>> <param-value>oxf:/ops/xforms/xforms-server-submit.xpl</param-value>
>>         </init-param>
>>     </servlet>
>>
>>     <servlet-mapping>
>>         <servlet-name>ops-xforms-server-submit-servlet</servlet-name>
>>         <url-pattern>/xforms-server-submit</url-pattern>
>>     </servlet-mapping>
>>
>> This didn't work: I got bizarre problems with submissions occuring twice
>> (!) and the response wasn't outputted to the browser. Should this work?
>>
>> So next I started trying to understand how the OPS examples portal
>> works. I couldn't see how the /xforms-server-submit url was ever being
>> mapped to the xforms-server-submit.xpl. Then I found this bit of
>> trickery in org.orbeon.oxf.processor.PageFlowControllerProcessor:
>>
>>     final String xformsSubmissionPath =
>> getPropertySet().getString(XFORMS_SUBMISSION_PATH_PROPERTY_NAME);
>>     final String xformsSubmissionModel =
>> getPropertySet().getStringOrURIAsString(XFORMS_SUBMISSION_MODEL_PROPERTY_NAME);
>>     ...
>>     }
>>     if (xformsSubmissionPath != null) {
>>         final Element firstPageElement =
>> controllerDocument.getRootElement().element("page");
>>         if (firstPageElement != null) {
>>             final List allElements =
>> controllerDocument.getRootElement().elements();
>>             final int firstPageElementIndex =
>> allElements.indexOf(firstPageElement);
>>             final Element newElement = Dom4jUtils.createElement("page",
>> CONTROLLER_NAMESPACE_URI);
>>             newElement.addAttribute("path-info", xformsSubmissionPath);
>>             newElement.addAttribute("model", xformsSubmissionModel);
>>             allElements.add(firstPageElementIndex, newElement);
>>         }
>>     }
>>
>> So... for any page flow that has a <page> element, it adds another
>> <page> which points to the xforms-server-submit url & xpl specified in
>> properties.xml. Okay... The first problem I found with this is that the
>> URL in properties.xml isn't respected by outputted HTML - it's hardcoded
>> in org.orbeon.oxf.xforms.processor.handlers.XHTMLBodyHandler to
>> /xforms-server-submit:
>>
>>     helper.startElement(prefix, XMLConstants.XHTML_NAMESPACE_URI,
>> "form", new String[]{
>>             "id", "xforms-form", "class", "xforms-form",
>>             "action", "/xforms-server-submit, "method", "POST",
>> "onsubmit", "return false",
>>             hasUpload ? "enctype" : null, hasUpload ?
>> "multipart/form-data" : null});
>>
>> So it needs a bit of code like
>>     final String xformsServerUrl = OXFProperties.instance().getPropertySet(
>>             new
>> QName("page-flow",XMLConstants.OXF_PROCESSORS_NAMESPACE)).getString(
>>
>> PageFlowControllerProcessor.XFORMS_SUBMISSION_PATH_PROPERTY_NAME,
>> "/xforms-server-submit");
>>
>>     helper.startElement(prefix, XMLConstants.XHTML_NAMESPACE_URI,
>> "form", new String[]{
>>             "id", "xforms-form", "class", "xforms-form",
>>             "action", xformsServerUrl, "method", "POST", "onsubmit",
>> "return false",
>>             hasUpload ? "enctype" : null, hasUpload ?
>> "multipart/form-data" : null});
>>
>> Except that the QName being constructed should be put in XMLConstants,
>> and the XFORMS_SUBMISSION_PATH_PROPERTY_NAME static is private.
>>
>> To see if I should be using this automatically added reference to
>> xforms-server-subimt, I created a not quite empty page-flow, and ensured
>> that the /xforms-server-submit mapping pointed to it:
>>
>> <config xmlns="http://www.orbeon.com/oxf/controller"
>>         xmlns:xu="http://www.xmldb.org/xupdate"
>>         xmlns:oxf="http://www.orbeon.com/oxf/processors">
>>
>>         <page id="dummy" path-info="/this-should-never-match"
>> model="oxf:/ops/dont-care.xpl"/>
>>
>> </config>
>>
>> And at the end of all this, I still got the double submission problem, I
>> guess because this is just a different way of stating what I'd done in
>> my first attempt. So I really have no idea what to try from here... Any
>> hints?
>>
>> If it's at all relevant, the submission is being fired by a trigger
>> displayed as an anchor, with a composite action:
>>
>> <xforms:trigger appearance="xxforms:link">
>>     <xforms:label>Create</xforms:label>
>>     <xforms:action ev:event="DOMActivate">
>>         <xforms:setvalue ref="instance('new')/name"
>> value="instance('name')/name" />
>>         <xforms:send submission="submit-new-field" />
>>     </xforms:action>
>> </xforms:trigger>
>>
>> Adrian
>>    



--
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: xforms-server-submit confusion

Adrian Baker-2
Adrian Baker wrote:
Actually it's not a filter, but similar. I'm making a direct Java API call to orbeon:

   (once only)
   processorDefinition = new ProcessorDefinition();
   processorDefinition.setName(new QName("pipeline", XMLConstants.OXF_PROCESSORS_NAMESPACE));

   processorDefinition.addInput("config", "oxf:/orbeon/render-form-from-request.xpl");

   (per request)
   request.setAttribute("orion-xform", formDefinition);
   PipelineEngineFactory.instance().executePipeline(
       processorDefinition,
       new ServletExternalContext(request.getSession().getServletContext(), pipelineContext,
           new HashMap(), request, response), pipelineContext, LOGGER);

To see if the above approach was the problem, rather than using the processor API, I just tried forwarding the request to a servlet configured to run the pipeline below - same result.


The render-form-from-request pipeline simply takes it input from the request attribute using the scope generator:

   <p:processor name="oxf:scope-generator">
       <p:input name="config">
           <config>
               <key>orion-xform</key>
               <scope>request</scope>
           </config>
       </p:input>
       <p:output name="data" id="orion-xform"/>
   </p:processor>
   <p:processor name="oxf:pipeline">
       <p:input name="config" href="config/epilogue.xpl"/>
       <p:input name="data" href="#orion-xform"/>
             <p:input name="xforms-instance"><dummy/></p:input>
       <p:input name="xforms-model"><dummy/></p:input>
   </p:processor>

I'm not using the portal in any way no, I was just trying to look at it to understand xforms-server-submit.

When I interact with the form, and when I submit a form using replace="instance" everything runs through /xforms-server happily. It's when I trigger a submission with replace="all" that I get the /xforms-server-submit url being hit.

Adrian

Alessandro Vernet wrote:
Hi Adrian,

You're saying that your page is not displayed through the PFC. How it
is displayed then? Is it another servlet generating XForms that gets
transformed with a servlet filter?

Very... let say /interesting/ things happen when pages are displayed
through the portal. But things are much more straightforward when the
portal is not used. Are your pages displayed through the portal? If
they are not, you should see a query going directly to /xforms-server.

Alex

On 3/14/06, Adrian Baker [hidden email] wrote:
 
I'm having real problems getting a <xforms:submission> with
replace="all" working. I'm not using any OPS page flow at all, I
explicitly forward requests to OPS's XForms processor. Submissions with
replace="instance" work fine.

Firstly I realised I need to map the /xforms-server-submit url to OPS
(because when I hit submit I got a 404).. So without really knowing what
I was doing I added this to my web.xml:
    <servlet>
        <servlet-name>ops-xforms-server-servlet</servlet-name>
        <servlet-class>org.orbeon.oxf.servlet.OPSServlet</servlet-class>
        <!-- Set main processor -->
        <init-param>
            <param-name>oxf.main-processor.name</param-name>

<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
        </init-param>
        <init-param>
            <param-name>oxf.main-processor.input.config</param-name>

<param-value>oxf:/ops/xforms/xforms-server-submit.xpl</param-value>
        </init-param>
    </servlet>

    <servlet-mapping>
        <servlet-name>ops-xforms-server-submit-servlet</servlet-name>
        <url-pattern>/xforms-server-submit</url-pattern>
    </servlet-mapping>

This didn't work: I got bizarre problems with submissions occuring twice
(!) and the response wasn't outputted to the browser. Should this work?

So next I started trying to understand how the OPS examples portal
works. I couldn't see how the /xforms-server-submit url was ever being
mapped to the xforms-server-submit.xpl. Then I found this bit of
trickery in org.orbeon.oxf.processor.PageFlowControllerProcessor:

    final String xformsSubmissionPath =
getPropertySet().getString(XFORMS_SUBMISSION_PATH_PROPERTY_NAME);
    final String xformsSubmissionModel =
getPropertySet().getStringOrURIAsString(XFORMS_SUBMISSION_MODEL_PROPERTY_NAME);
    ...
    }
    if (xformsSubmissionPath != null) {
        final Element firstPageElement =
controllerDocument.getRootElement().element("page");
        if (firstPageElement != null) {
            final List allElements =
controllerDocument.getRootElement().elements();
            final int firstPageElementIndex =
allElements.indexOf(firstPageElement);
            final Element newElement = Dom4jUtils.createElement("page",
CONTROLLER_NAMESPACE_URI);
            newElement.addAttribute("path-info", xformsSubmissionPath);
            newElement.addAttribute("model", xformsSubmissionModel);
            allElements.add(firstPageElementIndex, newElement);
        }
    }

So... for any page flow that has a <page> element, it adds another
<page> which points to the xforms-server-submit url & xpl specified in
properties.xml. Okay... The first problem I found with this is that the
URL in properties.xml isn't respected by outputted HTML - it's hardcoded
in org.orbeon.oxf.xforms.processor.handlers.XHTMLBodyHandler to
/xforms-server-submit:

    helper.startElement(prefix, XMLConstants.XHTML_NAMESPACE_URI,
"form", new String[]{
            "id", "xforms-form", "class", "xforms-form",
            "action", "/xforms-server-submit, "method", "POST",
"onsubmit", "return false",
            hasUpload ? "enctype" : null, hasUpload ?
"multipart/form-data" : null});

So it needs a bit of code like
    final String xformsServerUrl = OXFProperties.instance().getPropertySet(
            new
QName("page-flow",XMLConstants.OXF_PROCESSORS_NAMESPACE)).getString(

PageFlowControllerProcessor.XFORMS_SUBMISSION_PATH_PROPERTY_NAME,
"/xforms-server-submit");

    helper.startElement(prefix, XMLConstants.XHTML_NAMESPACE_URI,
"form", new String[]{
            "id", "xforms-form", "class", "xforms-form",
            "action", xformsServerUrl, "method", "POST", "onsubmit",
"return false",
            hasUpload ? "enctype" : null, hasUpload ?
"multipart/form-data" : null});

Except that the QName being constructed should be put in XMLConstants,
and the XFORMS_SUBMISSION_PATH_PROPERTY_NAME static is private.

To see if I should be using this automatically added reference to
xforms-server-subimt, I created a not quite empty page-flow, and ensured
that the /xforms-server-submit mapping pointed to it:

<config xmlns="http://www.orbeon.com/oxf/controller"
        xmlns:xu="http://www.xmldb.org/xupdate"
        xmlns:oxf="http://www.orbeon.com/oxf/processors">

        <page id="dummy" path-info="/this-should-never-match"
model="oxf:/ops/dont-care.xpl"/>

</config>

And at the end of all this, I still got the double submission problem, I
guess because this is just a different way of stating what I'd done in
my first attempt. So I really have no idea what to try from here... Any
hints?

If it's at all relevant, the submission is being fired by a trigger
displayed as an anchor, with a composite action:

<xforms:trigger appearance="xxforms:link">
    <xforms:label>Create</xforms:label>
    <xforms:action ev:event="DOMActivate">
        <xforms:setvalue ref="instance('new')/name"
value="instance('name')/name" />
        <xforms:send submission="submit-new-field" />
    </xforms:action>
</xforms:trigger>

Adrian
   




______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email ______________________________________________________________________

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



--
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: xforms-server-submit confusion

Adrian Baker-2
In reply to this post by Adrian Baker-2
Adrian Baker wrote:

> I'm having real problems getting a <xforms:submission> with
> replace="all" working. I'm not using any OPS page flow at all, I
> explicitly forward requests to OPS's XForms processor. Submissions
> with replace="instance" work fine.
>
> Firstly I realised I need to map the /xforms-server-submit url to OPS
> (because when I hit submit I got a 404).. So without really knowing
> what I was doing I added this to my web.xml:
>    <servlet>
>        <servlet-name>ops-xforms-server-servlet</servlet-name>
>        <servlet-class>org.orbeon.oxf.servlet.OPSServlet</servlet-class>
>        <!-- Set main processor -->
>        <init-param>
>            <param-name>oxf.main-processor.name</param-name>
>            
> <param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
>        </init-param>
>        <init-param>
>            <param-name>oxf.main-processor.input.config</param-name>
>            
> <param-value>oxf:/ops/xforms/xforms-server-submit.xpl</param-value>
>        </init-param>
>    </servlet>
>
>    <servlet-mapping>
>        <servlet-name>ops-xforms-server-submit-servlet</servlet-name>
>        <url-pattern>/xforms-server-submit</url-pattern>
>    </servlet-mapping>  
> This didn't work: I got bizarre problems with submissions occuring
> twice (!) and the response wasn't outputted to the browser. Should
> this work?
Well the double submission problem is still bizarre, but it seems
limited to my own machine. Using fiddler shows two hits to
xforms-server-submit, on the machine next to me, one. So my IE must be
hosed somehow.

Still can't get the response displayed on any machine however: fiddler
seems to report the response written correctly, but IE just displays a
page cannot be displayed message.

So perhaps my OPS configuration is ok, since as far as it's concerned
it's writing out the response ok.

I am using quite a recent version of ops (2 - 3 days old from CVS) - any
idea if the unstable build might have issues with replace="all" submissions?

Adrian



--
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: xforms-server-submit confusion

Adrian Baker-2
Adrian Baker wrote:

> Adrian Baker wrote:
>> I'm having real problems getting a <xforms:submission> with
>> replace="all" working. I'm not using any OPS page flow at all, I
>> explicitly forward requests to OPS's XForms processor. Submissions
>> with replace="instance" work fine.
>>
>> Firstly I realised I need to map the /xforms-server-submit url to OPS
>> (because when I hit submit I got a 404).. So without really knowing
>> what I was doing I added this to my web.xml:
>>    <servlet>
>>        <servlet-name>ops-xforms-server-servlet</servlet-name>
>>        <servlet-class>org.orbeon.oxf.servlet.OPSServlet</servlet-class>
>>        <!-- Set main processor -->
>>        <init-param>
>>            <param-name>oxf.main-processor.name</param-name>
>>            
>> <param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
>>
>>        </init-param>
>>        <init-param>
>>            <param-name>oxf.main-processor.input.config</param-name>
>>            
>> <param-value>oxf:/ops/xforms/xforms-server-submit.xpl</param-value>
>>        </init-param>
>>    </servlet>
>>
>>    <servlet-mapping>
>>        <servlet-name>ops-xforms-server-submit-servlet</servlet-name>
>>        <url-pattern>/xforms-server-submit</url-pattern>
>>    </servlet-mapping>  This didn't work: I got bizarre problems with
>> submissions occuring twice (!) and the response wasn't outputted to
>> the browser. Should this work?
>
> Well the double submission problem is still bizarre, but it seems
> limited to my own machine. Using fiddler shows two hits to
> xforms-server-submit, on the machine next to me, one. So my IE must be
> hosed somehow.
>
> Still can't get the response displayed on any machine however: fiddler
> seems to report the response written correctly, but IE just displays a
> page cannot be displayed message.
>
> So perhaps my OPS configuration is ok, since as far as it's concerned
> it's writing out the response ok.
>
> I am using quite a recent version of ops (2 - 3 days old from CVS) -
> any idea if the unstable build might have issues with replace="all"
> submissions?
>
Ok, apologies for the ongoing spam, but the problem goes away if I set
xforms.optimize-local-submission to true:
    <property as="xs:boolean"
name="oxf.xforms.optimize-local-submission" value="true"/>

Previously I'd had this set to false because of the earlier problem I
mentioned regarding mapping wildcard url paths - looks like I'll have to
find another workaround.

So it appears there may be a bug with non-optimised local submissions in
combination with replace="all" - the response does not get displayed.
Let me know if there's any more information I can provide.

Adrian




--
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: xforms-server-submit confusion

Alessandro  Vernet
Administrator
Adrian,

The problem looks a little bit abstract to me at this point :). If
there is any code that you can share with us and that we can run
locally to reproduce the problem, then we will have a look at it.

Alex

On 3/14/06, Adrian Baker <[hidden email]> wrote:

> Adrian Baker wrote:
> > Adrian Baker wrote:
> >> I'm having real problems getting a <xforms:submission> with
> >> replace="all" working. I'm not using any OPS page flow at all, I
> >> explicitly forward requests to OPS's XForms processor. Submissions
> >> with replace="instance" work fine.
> >>
> >> Firstly I realised I need to map the /xforms-server-submit url to OPS
> >> (because when I hit submit I got a 404).. So without really knowing
> >> what I was doing I added this to my web.xml:
> >>    <servlet>
> >>        <servlet-name>ops-xforms-server-servlet</servlet-name>
> >>        <servlet-class>org.orbeon.oxf.servlet.OPSServlet</servlet-class>
> >>        <!-- Set main processor -->
> >>        <init-param>
> >>            <param-name>oxf.main-processor.name</param-name>
> >>
> >> <param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>
> >>
> >>        </init-param>
> >>        <init-param>
> >>            <param-name>oxf.main-processor.input.config</param-name>
> >>
> >> <param-value>oxf:/ops/xforms/xforms-server-submit.xpl</param-value>
> >>        </init-param>
> >>    </servlet>
> >>
> >>    <servlet-mapping>
> >>        <servlet-name>ops-xforms-server-submit-servlet</servlet-name>
> >>        <url-pattern>/xforms-server-submit</url-pattern>
> >>    </servlet-mapping>  This didn't work: I got bizarre problems with
> >> submissions occuring twice (!) and the response wasn't outputted to
> >> the browser. Should this work?
> >
> > Well the double submission problem is still bizarre, but it seems
> > limited to my own machine. Using fiddler shows two hits to
> > xforms-server-submit, on the machine next to me, one. So my IE must be
> > hosed somehow.
> >
> > Still can't get the response displayed on any machine however: fiddler
> > seems to report the response written correctly, but IE just displays a
> > page cannot be displayed message.
> >
> > So perhaps my OPS configuration is ok, since as far as it's concerned
> > it's writing out the response ok.
> >
> > I am using quite a recent version of ops (2 - 3 days old from CVS) -
> > any idea if the unstable build might have issues with replace="all"
> > submissions?
> >
>
> Ok, apologies for the ongoing spam, but the problem goes away if I set
> xforms.optimize-local-submission to true:
>     <property as="xs:boolean"
> name="oxf.xforms.optimize-local-submission" value="true"/>
>
> Previously I'd had this set to false because of the earlier problem I
> mentioned regarding mapping wildcard url paths - looks like I'll have to
> find another workaround.
>
> So it appears there may be a bug with non-optimised local submissions in
> combination with replace="all" - the response does not get displayed.
> Let me know if there's any more information I can provide.
>
> Adrian
>
>
>
>
>
> --
> 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
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: xforms-server-submit confusion

Adrian Baker-2
You should be able to duplicate the first problem by submitting to a struts action matched by a wildcard url, and the second by forwarding from the action to a velocity template.

I could forward the various config file snippets to you, but it invovles the form, a web.xml servlet + servlet mapping, the struts-config.xml, and you'll need the struts & velocity libraries - a bit of  a fiddle to set up. It may be quicker to just submit to an arbitrary servlet which is matched by a wildcard url, and compare the path of OPS's 'artificial' request to a genuine request from the browser (they are different, but they shouldn't be).

Adrian

Alessandro Vernet wrote:
Adrian,

The problem looks a little bit abstract to me at this point :). If
there is any code that you can share with us and that we can run
locally to reproduce the problem, then we will have a look at it.

Alex

On 3/14/06, Adrian Baker [hidden email] wrote:
  
Adrian Baker wrote:
    
Adrian Baker wrote:
      
I'm having real problems getting a <xforms:submission> with
replace="all" working. I'm not using any OPS page flow at all, I
explicitly forward requests to OPS's XForms processor. Submissions
with replace="instance" work fine.

Firstly I realised I need to map the /xforms-server-submit url to OPS
(because when I hit submit I got a 404).. So without really knowing
what I was doing I added this to my web.xml:
   <servlet>
       <servlet-name>ops-xforms-server-servlet</servlet-name>
       <servlet-class>org.orbeon.oxf.servlet.OPSServlet</servlet-class>
       <!-- Set main processor -->
       <init-param>
           <param-name>oxf.main-processor.name</param-name>

<param-value>{http://www.orbeon.com/oxf/processors}pipeline</param-value>

       </init-param>
       <init-param>
           <param-name>oxf.main-processor.input.config</param-name>

<param-value>oxf:/ops/xforms/xforms-server-submit.xpl</param-value>
       </init-param>
   </servlet>

   <servlet-mapping>
       <servlet-name>ops-xforms-server-submit-servlet</servlet-name>
       <url-pattern>/xforms-server-submit</url-pattern>
   </servlet-mapping>  This didn't work: I got bizarre problems with
submissions occuring twice (!) and the response wasn't outputted to
the browser. Should this work?
        
Well the double submission problem is still bizarre, but it seems
limited to my own machine. Using fiddler shows two hits to
xforms-server-submit, on the machine next to me, one. So my IE must be
hosed somehow.

Still can't get the response displayed on any machine however: fiddler
seems to report the response written correctly, but IE just displays a
page cannot be displayed message.

So perhaps my OPS configuration is ok, since as far as it's concerned
it's writing out the response ok.

I am using quite a recent version of ops (2 - 3 days old from CVS) -
any idea if the unstable build might have issues with replace="all"
submissions?

      
Ok, apologies for the ongoing spam, but the problem goes away if I set
xforms.optimize-local-submission to true:
    <property as="xs:boolean"
name="oxf.xforms.optimize-local-submission" value="true"/>

Previously I'd had this set to false because of the earlier problem I
mentioned regarding mapping wildcard url paths - looks like I'll have to
find another workaround.

So it appears there may be a bug with non-optimised local submissions in
combination with replace="all" - the response does not get displayed.
Let me know if there's any more information I can provide.

Adrian





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



    


--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/

  

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



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