URL Generator Processor

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

URL Generator Processor

Jonathan J Wright
Hi,

I'm using the pipeline API to invoke a custom processor. The scheme of the URL for the XPL file, which uses the custom processor, could be ftp, http, or file.

public String run(final String xplUrl) throws Exception {
        final ProcessorDefinition processorDefinition = new ProcessorDefinition();
        processorDefinition.setName(new QName("pipeline", XMLConstants.OXF_PROCESSORS_NAMESPACE));
        processorDefinition.addInput("config", xplUrl);
        final Processor processor = InitUtils.createProcessor(processorDefinition);
        PipelineContext pipelineCtx = new PipelineContext();
        InitUtils.runProcessor(processor, new CommandLineExternalContext(), pipelineCtx, LOG);
       
        ProcessorOutput output = processor.createOutput("data");
        TransformerHandler identity = TransformerUtils.getIdentityTransformerHandler();
        StringWriter writer = new StringWriter();
        identity.setResult(new StreamResult(writer));
        output.read(pipelineCtx, identity);
        return writer.toString();
}

This code works fine with the exception of http scheme URLs. The http server, which is beyond my control, returns a content type other than application/xml. This causes URL Generator to wrap the content a <document> tag because it thinks its text. The then Pipeline Processor complains because the XPL doesn't validate.

How can I force the URL Generator to use the application/xml content type (as per the instructions at http://www.orbeon.com/ops/doc/processors-generators-url) when I don't have a processor definition for it?

Thanks

Jonathan.




--
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: URL Generator Processor

Hank Ratzesberger

Jonathan,

For similar reasons, a couple of us patched an earlier
version to simply parse the response as xml.  Indeed, OF
looks at the content-type to determine how to parse.  But
if you are interested in the patch and discussion, you
can start here:

http://mail-archive.objectweb.org/ops-users/2006-11/msg00220.html


Regards,
Hank


----- Original Message -----
From: "Jonathan J Wright" <[hidden email]>
To: "ops users" <[hidden email]>
Sent: Wednesday, January 10, 2007 8:33 PM
Subject: [ops-users] URL Generator Processor


Hi,

I'm using the pipeline API to invoke a custom processor. The scheme of the URL for the XPL file, which uses the custom processor,
could be ftp, http, or file.

public String run(final String xplUrl) throws Exception {
final ProcessorDefinition processorDefinition = new ProcessorDefinition();
processorDefinition.setName(new QName("pipeline", XMLConstants.OXF_PROCESSORS_NAMESPACE));
processorDefinition.addInput("config", xplUrl);
final Processor processor = InitUtils.createProcessor(processorDefinition);
PipelineContext pipelineCtx = new PipelineContext();
InitUtils.runProcessor(processor, new CommandLineExternalContext(), pipelineCtx, LOG);

ProcessorOutput output = processor.createOutput("data");
TransformerHandler identity = TransformerUtils.getIdentityTransformerHandler();
StringWriter writer = new StringWriter();
identity.setResult(new StreamResult(writer));
output.read(pipelineCtx, identity);
return writer.toString();
}

This code works fine with the exception of http scheme URLs. The http server, which is beyond my control, returns a content type
other than application/xml. This causes URL Generator to wrap the content a <document> tag because it thinks its text. The then
Pipeline Processor complains because the XPL doesn't validate.

How can I force the URL Generator to use the application/xml content type (as per the instructions at
http://www.orbeon.com/ops/doc/processors-generators-url) when I don't have a processor definition for it?

Thanks

Jonathan.





--------------------------------------------------------------------------------


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




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

Xforms secret enable enter key

Abel Carvajal Tapia
In order to enable enter key for xforms:secret
I add test in if sentence
|| ORBEON.util.Dom.hasClass(target, "xforms-secret")
and work fine.

I change:
  keypress: function(event) {
        var target =
ORBEON.xforms.Events._findParentXFormsControl(YAHOO.util.Event.getTarget(event));
        if (target != null) {
            // Input field and auto-complete: trigger DOMActive when
when enter is pressed
            if (ORBEON.util.Dom.hasClass(target, "xforms-select1-open")
                    || ORBEON.util.Dom.hasClass(target, "xforms-input")) {
                if (event.keyCode == 10 || event.keyCode == 13) {
                    // Prevent default handling of enter, which might be
equivalent as a click on some trigger in the form
                    YAHOO.util.Event.preventDefault(event);
                    // Send a value change and DOM activate
                    var events = [
                        xformsCreateEventArray(target,
"xxforms-value-change-with-focus-change",
                            ORBEON.xforms.Controls.getCurrentValue(target)),
                        xformsCreateEventArray(target, "DOMActivate", null)
                    ];
                    xformsFireEvents(events, false);
                }
            }
        }
    },
for
keypress: function(event) {
        var target =
ORBEON.xforms.Events._findParentXFormsControl(YAHOO.util.Event.getTarget(event));
        if (target != null) {
            // Input field and auto-complete: trigger DOMActive when
when enter is pressed
            if (ORBEON.util.Dom.hasClass(target, "xforms-select1-open")
// abel: add xforms:secret enter key press
                    || ORBEON.util.Dom.hasClass(target, "xforms-input")
|| ORBEON.util.Dom.hasClass(target, "xforms-secret")) {
                if (event.keyCode == 10 || event.keyCode == 13) {
                    // Prevent default handling of enter, which might be
equivalent as a click on some trigger in the form
                    YAHOO.util.Event.preventDefault(event);
                    // Send a value change and DOM activate
                    var events = [
                        xformsCreateEventArray(target,
"xxforms-value-change-with-focus-change",
                            ORBEON.xforms.Controls.getCurrentValue(target)),
                        xformsCreateEventArray(target, "DOMActivate", null)
                    ];
                    xformsFireEvents(events, false);
                }
            }
        }
    },

thanks
and sorry for my english




--
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 secret enable enter key

Erik Bruchez
Administrator
Abel,

Thanks for this fix! But it looks like this was fixed back in December
already:

http://forge.objectweb.org/tracker/?group_id=168&atid=350207&func=detail&aid=306538

You can always get the latest fixes in the nightly builds.

-Erik

Abel Carvajal Tapia wrote:

> In order to enable enter key for xforms:secret
> I add test in if sentence
> || ORBEON.util.Dom.hasClass(target, "xforms-secret")
> and work fine.
>
> I change:
>  keypress: function(event) {
>        var target =
> ORBEON.xforms.Events._findParentXFormsControl(YAHOO.util.Event.getTarget(event));
>
>        if (target != null) {
>            // Input field and auto-complete: trigger DOMActive when when
> enter is pressed
>            if (ORBEON.util.Dom.hasClass(target, "xforms-select1-open")
>                    || ORBEON.util.Dom.hasClass(target, "xforms-input")) {
>                if (event.keyCode == 10 || event.keyCode == 13) {
>                    // Prevent default handling of enter, which might be
> equivalent as a click on some trigger in the form
>                    YAHOO.util.Event.preventDefault(event);
>                    // Send a value change and DOM activate
>                    var events = [
>                        xformsCreateEventArray(target,
> "xxforms-value-change-with-focus-change",
>                            ORBEON.xforms.Controls.getCurrentValue(target)),
>                        xformsCreateEventArray(target, "DOMActivate", null)
>                    ];
>                    xformsFireEvents(events, false);
>                }
>            }
>        }
>    },
> for
> keypress: function(event) {
>        var target =
> ORBEON.xforms.Events._findParentXFormsControl(YAHOO.util.Event.getTarget(event));
>
>        if (target != null) {
>            // Input field and auto-complete: trigger DOMActive when when
> enter is pressed
>            if (ORBEON.util.Dom.hasClass(target, "xforms-select1-open")
> // abel: add xforms:secret enter key press
>                    || ORBEON.util.Dom.hasClass(target, "xforms-input")
> || ORBEON.util.Dom.hasClass(target, "xforms-secret")) {
>                if (event.keyCode == 10 || event.keyCode == 13) {
>                    // Prevent default handling of enter, which might be
> equivalent as a click on some trigger in the form
>                    YAHOO.util.Event.preventDefault(event);
>                    // Send a value change and DOM activate
>                    var events = [
>                        xformsCreateEventArray(target,
> "xxforms-value-change-with-focus-change",
>                            ORBEON.xforms.Controls.getCurrentValue(target)),
>                        xformsCreateEventArray(target, "DOMActivate", null)
>                    ];
>                    xformsFireEvents(events, false);
>                }
>            }
>        }
>    },
>
> thanks
> and sorry for my english
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



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