RESTXQ : returning application/zip data
Tuesday, 25 February 2014 · 4 messages · last reply 26 Feb 2014
FE
Fabrice Etanchaud25 Feb 2014 17:42 #
Dear all,
I 'm trying to return a zip from a restxq request with a (simplified) function like :
declare %restxq:path("cnfull/aozip/{$doc-number}/{$kind}")
%restxq:GET
%output:media-type("application/zip")
function questel:zipped-ao-request-by-doc-number-kind($doc-number as xs:string, $kind as xs:string) {
archive:create(
element archive:entry { 'blabla.xml' },
fn:serialize(<xml-here/>))
};But the result is an invalid zip archive...
Am I missing something ?
Best regards,
And thank you for the wonderful peace of software BaseX is.
Fabrice
CG
Christian Grün25 Feb 2014 17:52 #
Hi Fabrice,
Quoted text · Fabrice Etanchaud · 1 line
> But the result is an invalid zip archive...
You will have to add the following annotation:
%output:method("raw")
It enforces binary64 and hex data to be passed on in its original byte representation.
I have extended some info in our Wiki RESTXQ entry.
Best,
Christian
[1] http://docs.basex.org/wiki/RESTXQ#Response_Element
FE
Fabrice Etanchaud26 Feb 2014 09:30 #
Once again thank you Christian !
I wrote a servlet in my young days to do that...
Now A single XQuery line does it !
Do you plan to offer 'user defined' indexes in near future ? (Indexing only a giving xpath attribute, text or ft)
Have a nice day.
Best regards,
Fabrice
-----Message d'origine-----
Quoted text · Christian Grün · 14 lines
De : Christian Grün [mailto:christian.gruen at gmail.com] Envoyé : mardi 25 février 2014 17:53 À : Fabrice Etanchaud Cc : basex-talk at mailman.uni-konstanz.de Objet : Re: [basex-talk] RESTXQ : returning application/zip data Hi Fabrice, > But the result is an invalid zip archive... You will have to add the following annotation: %output:method("raw") It enforces binary64 and hex data to be passed on in its original byte representation. I have extended some info in our Wiki RESTXQ entry. Best, Christian [1] http://docs.basex.org/wiki/RESTXQ#Response_Element
CG
Christian Grün26 Feb 2014 09:41 #
Quoted text · Fabrice Etanchaud · 2 lines
> Do you plan to offer 'user defined' indexes in near future ? > (Indexing only a giving xpath attribute, text or ft)
Feel free to add your voting to the oldest, still open GitHub issue [1] :)
Christian
[1] https://github.com/BaseXdb/basex/issues/59
Quoted text · Fabrice Etanchaud · 30 lines
> Have a nice day. > > Best regards, > Fabrice > > > > -----Message d'origine----- > De : Christian Grün [mailto:christian.gruen at gmail.com] > Envoyé : mardi 25 février 2014 17:53 > À : Fabrice Etanchaud > Cc : basex-talk at mailman.uni-konstanz.de > Objet : Re: [basex-talk] RESTXQ : returning application/zip data > > Hi Fabrice, > >> But the result is an invalid zip archive... > > You will have to add the following annotation: > > %output:method("raw") > > It enforces binary64 and hex data to be passed on in its original byte representation. > > I have extended some info in our Wiki RESTXQ entry. > > Best, > Christian > > [1] http://docs.basex.org/wiki/RESTXQ#Response_Element
Written for BaseX 7.8. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery