Binary attachments

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

Binary attachments

Taras Bahnyuk
I have an application that can submit Xform and accompanying attachment
to an eXist DB.
Right now it submits base64 encoded attachments.
For easier integration with rest of corporate tools I'm considering
submitting binary attachments instead of base64 encoded.
Could somebody explain what exactly steps need to be taken, for instance
how do I configure the submit pipeline.
And first of all, I'm interested to know If this is possible at all.

I know upload widget example does the similar, but it uses an SQL
database instead.

With kind regards,
-Taras





--
The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.



--
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: Binary attachments

ozenzin
Taras,
I'd propose to look into examples code. If you have downloaded ops.war
look into WEB-INF/resources/examples/xforms/xforms-upload example.
Namely files main-model.xpl, read-uri.xpl and main-view.xsl might be
of your interest.

Regards,
Oleg
--
                           mailto:[hidden email]


Tuesday, May 23, 2006, 10:56:43 AM, your letter:

> I have an application that can submit Xform and accompanying attachment
> to an eXist DB.
> Right now it submits base64 encoded attachments.
> For easier integration with rest of corporate tools I'm considering
> submitting binary attachments instead of base64 encoded.
> Could somebody explain what exactly steps need to be taken, for instance
> how do I configure the submit pipeline.
> And first of all, I'm interested to know If this is possible at all.

> I know upload widget example does the similar, but it uses an SQL
> database instead.

> With kind regards,
> -Taras










--
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: Binary attachments

Alessandro  Vernet
Administrator
In reply to this post by Taras Bahnyuk
Hi Taras,

I am not sure to understand what you mean by "submit binary
attachments". Would you like to save the binary data as a binary file
in eXist instead of a base64-encoded in XML?

Alex

On 5/23/06, Taras Bahnyuk <[hidden email]> wrote:

> I have an application that can submit Xform and accompanying attachment
> to an eXist DB.
> Right now it submits base64 encoded attachments.
> For easier integration with rest of corporate tools I'm considering
> submitting binary attachments instead of base64 encoded.
> Could somebody explain what exactly steps need to be taken, for instance
> how do I configure the submit pipeline.
> And first of all, I'm interested to know If this is possible at all.
>
> I know upload widget example does the similar, but it uses an SQL
> database instead.
>
> With kind regards,
> -Taras
>
>
>
>
>
> --
> The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.
>
>
>
>
> --
> 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: Binary attachments

Taras Bahnyuk
In reply to this post by Taras Bahnyuk
Alex,

Yes, this is exactly what I meant.
Sorry, haven't explained myself clearly the first time.

I need this, because the documents I create with my xForm need to be
"enreached" later by using
customized Epic xml editor.
Next to editing xml content, adding binary attachments may be required.
And since Epic can't base64 encode them, I decide that all attachments
will be stored in eXist
as binary files.

I'm not sure if this is very healthy idea, but this is the only one I
have so far.

Thanks,
-Taras

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Alessandro Vernet
Sent: dinsdag 23 mei 2006 18:58
To: [hidden email]
Subject: Re: [ops-users] Binary attachments

Hi Taras,

I am not sure to understand what you mean by "submit binary
attachments". Would you like to save the binary data as a binary file
in eXist instead of a base64-encoded in XML?

Alex

On 5/23/06, Taras Bahnyuk <[hidden email]> wrote:
> I have an application that can submit Xform and accompanying
attachment
> to an eXist DB.
> Right now it submits base64 encoded attachments.
> For easier integration with rest of corporate tools I'm considering
> submitting binary attachments instead of base64 encoded.
> Could somebody explain what exactly steps need to be taken, for
instance
> how do I configure the submit pipeline.
> And first of all, I'm interested to know If this is possible at all.
>
> I know upload widget example does the similar, but it uses an SQL
> database instead.
>
> With kind regards,
> -Taras
>


--
The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.



--
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: Binary attachments

Taras Bahnyuk
In reply to this post by Taras Bahnyuk
Alex,

Yes, this is exactly what I meant.
Sorry, haven't explained myself clearly the first time.

I need this, because the documents I create with my xForm need to be
"enreached" later by using
customized Epic xml editor.
Next to editing xml content, adding binary attachments may be required.
And since Epic can't base64 encode them, I decide that all attachments
will be stored in eXist
as binary files.

I'm not sure if this is very healthy idea, but this is the only one I
have so far.

Thanks,
-Taras

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Alessandro Vernet
Sent: dinsdag 23 mei 2006 18:58
To: [hidden email]
Subject: Re: [ops-users] Binary attachments

Hi Taras,

I am not sure to understand what you mean by "submit binary
attachments". Would you like to save the binary data as a binary file
in eXist instead of a base64-encoded in XML?

Alex

On 5/23/06, Taras Bahnyuk <[hidden email]> wrote:
> I have an application that can submit Xform and accompanying
attachment
> to an eXist DB.
> Right now it submits base64 encoded attachments.
> For easier integration with rest of corporate tools I'm considering
> submitting binary attachments instead of base64 encoded.
> Could somebody explain what exactly steps need to be taken, for
instance
> how do I configure the submit pipeline.
> And first of all, I'm interested to know If this is possible at all.
>
> I know upload widget example does the similar, but it uses an SQL
> database instead.
>
> With kind regards,
> -Taras
>


--
The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.



--
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: Binary attachments

Taras Bahnyuk
In reply to this post by Taras Bahnyuk
Alex,

Yes, this is exactly what I meant.
Sorry, haven't explained myself clearly the first time.

I need this, because the documents I create with my xForm need to be
"enreached" later by using
customized Epic xml editor.
Next to editing xml content, adding binary attachments may be required.
And since Epic can't base64 encode them, I decide that all attachments
will be stored in eXist
as binary files.

I'm not sure if this is very healthy idea, but this is the only one I
have so far.

Thanks,
-Taras

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Alessandro Vernet
Sent: dinsdag 23 mei 2006 18:58
To: [hidden email]
Subject: Re: [ops-users] Binary attachments

Hi Taras,

I am not sure to understand what you mean by "submit binary
attachments". Would you like to save the binary data as a binary file
in eXist instead of a base64-encoded in XML?

Alex

On 5/23/06, Taras Bahnyuk <[hidden email]> wrote:
> I have an application that can submit Xform and accompanying
attachment
> to an eXist DB.
> Right now it submits base64 encoded attachments.
> For easier integration with rest of corporate tools I'm considering
> submitting binary attachments instead of base64 encoded.
> Could somebody explain what exactly steps need to be taken, for
instance
> how do I configure the submit pipeline.
> And first of all, I'm interested to know If this is possible at all.
>
> I know upload widget example does the similar, but it uses an SQL
> database instead.
>
> With kind regards,
> -Taras
>


--
The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.



--
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: Binary attachments

Alessandro  Vernet
Administrator
In reply to this post by Taras Bahnyuk
Taras,

We don't have something that does this out-of-the box. With the eXist
REST API, if you do a PUT at the URL of your document with a content
type different than text/xml, the resource will be stored as a binary
document. So you would need to write a custom PUT processor for this.
That should be reasonably simple to do if you are comfortable with
Java programming.

Alex

On 5/24/06, Taras Bahnyuk <[hidden email]> wrote:

> Alex,
>
> Yes, this is exactly what I meant.
> Sorry, haven't explained myself clearly the first time.
>
> I need this, because the documents I create with my xForm need to be
> "enreached" later by using
> customized Epic xml editor.
> Next to editing xml content, adding binary attachments may be required.
> And since Epic can't base64 encode them, I decide that all attachments
> will be stored in eXist
> as binary files.
>
> I'm not sure if this is very healthy idea, but this is the only one I
> have so far.
>
> Thanks,
> -Taras
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of
> Alessandro Vernet
> Sent: dinsdag 23 mei 2006 18:58
> To: [hidden email]
> Subject: Re: [ops-users] Binary attachments
>
> Hi Taras,
>
> I am not sure to understand what you mean by "submit binary
> attachments". Would you like to save the binary data as a binary file
> in eXist instead of a base64-encoded in XML?
>
> Alex
>
> On 5/23/06, Taras Bahnyuk <[hidden email]> wrote:
> > I have an application that can submit Xform and accompanying
> attachment
> > to an eXist DB.
> > Right now it submits base64 encoded attachments.
> > For easier integration with rest of corporate tools I'm considering
> > submitting binary attachments instead of base64 encoded.
> > Could somebody explain what exactly steps need to be taken, for
> instance
> > how do I configure the submit pipeline.
> > And first of all, I'm interested to know If this is possible at all.
> >
> > I know upload widget example does the similar, but it uses an SQL
> > database instead.
> >
> > With kind regards,
> > -Taras
> >
>
>
> --
> The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.
>
>
>
>
> --
> 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: Binary attachments

Taras Bahnyuk
In reply to this post by Taras Bahnyuk
Alex,
Thanks for your explanation.

At the moment I'm considering a little different approach.

It's based on number of assumptions, so I'm not sure if this is viable.
 
The upload control (when activated by e.g. a DOMActivate event or
recalculate or something else)
will locate the file as indicated and fill in
- the location as specified in the filename attribute
- the mime type as returned by the browser in the media type attribute
- the size
Moreover, it will copy the file to the server (the actual upload) to the
server directory
/usr/local/asm/var/tomcat/work/Catalina/localhost/exist/cocoon-files/cac
he-dir and it will also fill in this directory in the element contents.

Next processor in the pipeline, most likely XQuery processor,
should take action and copy the file from cache-dir into eXist.

My concern now is may I rely on this behaviour of the upload widget?
Is it a feature or a side effect which may disappear in the future?

-Taras
 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Alessandro Vernet
Sent: vrijdag 26 mei 2006 4:11
To: [hidden email]
Subject: Re: [ops-users] Binary attachments

Taras,

We don't have something that does this out-of-the box. With the eXist
REST API, if you do a PUT at the URL of your document with a content
type different than text/xml, the resource will be stored as a binary
document. So you would need to write a custom PUT processor for this.
That should be reasonably simple to do if you are comfortable with
Java programming.

Alex

On 5/24/06, Taras Bahnyuk <[hidden email]> wrote:
> Alex,
>
> Yes, this is exactly what I meant.
> Sorry, haven't explained myself clearly the first time.
>
> I need this, because the documents I create with my xForm need to be
> "enreached" later by using
> customized Epic xml editor.
> Next to editing xml content, adding binary attachments may be
required.

> And since Epic can't base64 encode them, I decide that all attachments
> will be stored in eXist
> as binary files.
>
> I'm not sure if this is very healthy idea, but this is the only one I
> have so far.
>
> Thanks,
> -Taras
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of
> Alessandro Vernet
> Sent: dinsdag 23 mei 2006 18:58
> To: [hidden email]
> Subject: Re: [ops-users] Binary attachments
>
> Hi Taras,
>
> I am not sure to understand what you mean by "submit binary
> attachments". Would you like to save the binary data as a binary file
> in eXist instead of a base64-encoded in XML?
>
> Alex
>
> On 5/23/06, Taras Bahnyuk <[hidden email]> wrote:
> > I have an application that can submit Xform and accompanying
> attachment
> > to an eXist DB.
> > Right now it submits base64 encoded attachments.
> > For easier integration with rest of corporate tools I'm considering
> > submitting binary attachments instead of base64 encoded.
> > Could somebody explain what exactly steps need to be taken, for
> instance
> > how do I configure the submit pipeline.
> > And first of all, I'm interested to know If this is possible at all.
> >
> > I know upload widget example does the similar, but it uses an SQL
> > database instead.
> >
> > With kind regards,
> > -Taras
> >
>
>
> --
> The information contained in this communication and any attachments is
confidential and may be privileged, and is for the sole use of the
intended recipient(s). Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient,
please notify the sender immediately by replying to this message and
destroy all copies of this message and any attachments. ASML is neither
liable for the proper and complete transmission of the information
contained in this communication, nor for any delay in its receipt.
>
>
>
>
> --
> 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/



--
The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.



--
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: Binary attachments

Erik Bruchez
Administrator
Taras,

Taking the XForms Upload example, this is how upload is hooked up:

<xforms:upload ref=".">
     <xforms:filename ref="@filename"/>
     <xforms:mediatype ref="@mediatype"/>
     <xxforms:size ref="@size"/>
</xforms:upload>

<xforms:bind nodeset="instance('main-instance')/files/file"
type="xs:anyURI"/>

With the exception of xxforms:size, which is an extension, the rest is
pure XForms. The type xs:anyURI will ensure that a URI is stored into
the attribute or element of the instance pointed to, as opposed to a
Base64-encoded version of the file. So this will stay.

You also don't have to care about the fact that a temporary file is
actually stored in the Tomcat work directory. The only thing you
should care about is that you can dereference the URL stored into the
XForms instance (but attention, for the duration of the request only:
then the file will be automatically removed).

So I take it the answer is pretty close from a resounding "yes, you
can count on this behavior, as it is specified by XForms" :-)

The only caveats are xxforms:size and the lifespan of the URL.

-Erik

Taras Bahnyuk wrote:
 > Alex,
 > Thanks for your explanation.
 >
 > At the moment I'm considering a little different approach.
 >
 > It's based on number of assumptions, so I'm not sure if this is viable.
 >
 > The upload control (when activated by e.g. a DOMActivate event or
 > recalculate or something else)
 > will locate the file as indicated and fill in
 > - the location as specified in the filename attribute
 > - the mime type as returned by the browser in the media type attribute
 > - the size
 > Moreover, it will copy the file to the server (the actual upload) to the
 > server directory
 > /usr/local/asm/var/tomcat/work/Catalina/localhost/exist/cocoon-files/cac
 > he-dir and it will also fill in this directory in the element contents.
 >
 > Next processor in the pipeline, most likely XQuery processor,
 > should take action and copy the file from cache-dir into eXist.
 >
 > My concern now is may I rely on this behaviour of the upload widget?
 > Is it a feature or a side effect which may disappear in the future?
 >
 > -Taras
 >
 >
 > -----Original Message-----
 > From: [hidden email] [mailto:[hidden email]] On Behalf Of
 > Alessandro Vernet
 > Sent: vrijdag 26 mei 2006 4:11
 > To: [hidden email]
 > Subject: Re: [ops-users] Binary attachments
 >
 > Taras,
 >
 > We don't have something that does this out-of-the box. With the eXist
 > REST API, if you do a PUT at the URL of your document with a content
 > type different than text/xml, the resource will be stored as a binary
 > document. So you would need to write a custom PUT processor for this.
 > That should be reasonably simple to do if you are comfortable with
 > Java programming.
 >
 > Alex
 >
 > On 5/24/06, Taras Bahnyuk <[hidden email]> wrote:
 >> Alex,
 >>
 >> Yes, this is exactly what I meant.
 >> Sorry, haven't explained myself clearly the first time.
 >>
 >> I need this, because the documents I create with my xForm need to be
 >> "enreached" later by using
 >> customized Epic xml editor.
 >> Next to editing xml content, adding binary attachments may be
 > required.
 >> And since Epic can't base64 encode them, I decide that all attachments
 >> will be stored in eXist
 >> as binary files.
 >>
 >> I'm not sure if this is very healthy idea, but this is the only one I
 >> have so far.
 >>
 >> Thanks,
 >> -Taras
 >>
 >> -----Original Message-----
 >> From: [hidden email] [mailto:[hidden email]] On Behalf Of
 >> Alessandro Vernet
 >> Sent: dinsdag 23 mei 2006 18:58
 >> To: [hidden email]
 >> Subject: Re: [ops-users] Binary attachments
 >>
 >> Hi Taras,
 >>
 >> I am not sure to understand what you mean by "submit binary
 >> attachments". Would you like to save the binary data as a binary file
 >> in eXist instead of a base64-encoded in XML?
 >>
 >> Alex
 >>
 >> On 5/23/06, Taras Bahnyuk <[hidden email]> wrote:
 >>> I have an application that can submit Xform and accompanying
 >> attachment
 >>> to an eXist DB.
 >>> Right now it submits base64 encoded attachments.
 >>> For easier integration with rest of corporate tools I'm considering
 >>> submitting binary attachments instead of base64 encoded.
 >>> Could somebody explain what exactly steps need to be taken, for
 >> instance
 >>> how do I configure the submit pipeline.
 >>> And first of all, I'm interested to know If this is possible at all.
 >>>
 >>> I know upload widget example does the similar, but it uses an SQL
 >>> database instead.
 >>>
 >>> With kind regards,
 >>> -Taras

--
Orbeon - XForms Everywhere:
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