You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "joao tiago a. m. viegas" <jt...@gmail.com> on 2009/10/17 10:34:09 UTC

problem showing pdf as text/plain with resourcereader

Hello everyone,

i'm having this problem where i want to read static pdf files in the server
and "supply" them to the browser for being read by the acrobat pdf plugin.
The plugin always complains about it being a text/plain file.
I'm using the default resource reader and specifying the mime-type, just
like in the user documentation, strictly by the book.
I've seen this message thread which states that it is something that is not
yet implemented, but it was 6 years ago:
http://www.mail-archive.com/users@cocoon.apache.org/msg04668.html

the cocoon version is 2.1 on a centos 5.
Do you have any information regarding this question?

Best Regards
joão tiago viegas

Re: problem showing pdf as text/plain with resourcereader

Posted by Jasha Joachimsthal <j....@onehippo.com>.
Yes there won't be much logic involved. See
http://cocoon.apache.org/2.1/userdocs/flow/index.html for more info about
flow.

2009/10/20 joao tiago a. m. viegas <jt...@gmail.com>

> ...err...wait, but thinking about it,
>
> alll i have to do is to embed the javascript and use the cocoon object in
> the request invocation, right?
>
>
> com os melhores cumprimentos
> joão tiago viegas
>
>
> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>
>> You don't have to use XSP if you use flowscript for your logic. I've never
>> used XSP because it has been a bit outdated for a while but some people
>> still like using it.
>> Jasha
>>
>>
>> 2009/10/20 joao tiago a. m. viegas <jt...@gmail.com>
>>
>>> thank you Jasha,
>>> i did never use it  but i'll have a go with flowscript, i'll read the
>>> docs and say something later.
>>> I presume i have to change the xsp file, right?
>>>
>>>
>>>
>>> com os melhores cumprimentos
>>> joão tiago viegas
>>>
>>>
>>> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>>>
>>>> You could solve it with flowscript.
>>>> function writeandread() {
>>>> cocoon.processPipelineTo("pipelineThatWritesTheFile", NullOutputStream);
>>>> // executes the pipeline that does the writing, but does not return a
>>>> response
>>>> cocoon.sendPage("pipelineThatReadsTheFile"); // executes the pipeline
>>>> with the map:read for the newly created file and sends the response to the
>>>> browser
>>>> }
>>>>
>>>>
>>>> 2009/10/20 joao tiago a. m. viegas <jt...@gmail.com>
>>>>
>>>> Thank you very much Jasha,
>>>>>
>>>>> that explains some questions i've had.
>>>>>
>>>>> But can't i do a redirection within my serializer implementer code, or
>>>>> it just ends in there and no more processing is done in the pipeline?
>>>>>
>>>>> com os melhores cumprimentos
>>>>> joão tiago viegas
>>>>>
>>>>>
>>>>> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>>>>>
>>>>> After<map:serialize type="invoice2filesys">
>>>>>>                                         <map:parameter name="path"
>>>>>> value="{path}"/>
>>>>>>                                         <map:parameter name="file"
>>>>>> value="{file}"/>
>>>>>>                                 </map:serialize>
>>>>>>
>>>>>> Your pipeline is done so it will not reach
>>>>>>                                  <map:read type="resource"
>>>>>> src="{path}/{file}" mime-type="application/pdf" />
>>>>>>
>>>>>> But you could change it into some flowscript function call that
>>>>>> handles the saving and then responds with the PDF.
>>>>>>
>>>>>> Jasha Joachimsthal
>>>>>>
>>>>>> j.joachimsthal@onehippo.com - jasha@apache.org
>>>>>>
>>>>>> www.onehippo.com
>>>>>> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
>>>>>> San Francisco - Hippo USA Inc. 185 H Street, suite B, Petaluma CA
>>>>>> 94952 +1 (707) 7734646
>>>>>>
>>>>>>
>>>>>> 2009/10/19 joao tiago a. m. viegas <jt...@gmail.com>
>>>>>>
>>>>>> Thank you very much Alexander,
>>>>>>>
>>>>>>> i've discovered with LiveHTTPHeaders addon that the content-length is
>>>>>>> = 0 !!!
>>>>>>>
>>>>>>> the pipeline section is this:
>>>>>>>
>>>>>>>                 <map:act type="invoice-save-action">
>>>>>>>                         <map:select type="parameter">
>>>>>>>                         <map:parameter name="parameter-selector-test"
>>>>>>> value="{savepdf}"/>
>>>>>>>                         <map:when test="1">
>>>>>>>                                 <map:serialize
>>>>>>> type="invoice2filesys">
>>>>>>>                                         <map:parameter name="path"
>>>>>>> value="{path}"/>
>>>>>>>                                         <map:parameter name="file"
>>>>>>> value="{file}"/>
>>>>>>>                                 </map:serialize>
>>>>>>>                                  <map:read type="resource"
>>>>>>> src="{path}/{file}" mime-type="application/pdf" />
>>>>>>>                         </map:when>
>>>>>>>                         <map:otherwise>
>>>>>>>                                 <map:serialize type="fo2pdf"/>
>>>>>>>                         </map:otherwise>
>>>>>>>
>>>>>>>                         </map:select>
>>>>>>>         </map:act>
>>>>>>>
>>>>>>>
>>>>>>> it tests if it's desired to save the file in the filesystem, and if
>>>>>>> so, saves it (it does gets saved allright though), but the reader simply
>>>>>>> does not work!
>>>>>>>
>>>>>>> i'm I overlooking something here?
>>>>>>>
>>>>>>> com os melhores cumprimentos
>>>>>>> joão tiago viegas
>>>>>>>
>>>>>>>
>>>>>>> 2009/10/18 Alexander Daniel <al...@gmx.at>
>>>>>>>
>>>>>>> On 17.10.2009, at 10:34, joao tiago a. m. viegas wrote:
>>>>>>>>
>>>>>>>>  Hello everyone,
>>>>>>>>>
>>>>>>>>> i'm having this problem where i want to read static pdf files in
>>>>>>>>> the server and "supply" them to the browser for being read by the acrobat
>>>>>>>>> pdf plugin. The plugin always complains about it being a text/plain file.
>>>>>>>>> I'm using the default resource reader and specifying the mime-type,
>>>>>>>>> just like in the user documentation, strictly by the book.
>>>>>>>>>
>>>>>>>>
>>>>>>>> For analysis you could check with Firefox Add-on Live HTTP Headers
>>>>>>>> [1] whether the HTTP response headers are sent correctly to the browser.
>>>>>>>>
>>>>>>>> Alex
>>>>>>>>
>>>>>>>> [1] https://addons.mozilla.org/en-US/firefox/addon/3829
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: problem showing pdf as text/plain with resourcereader

Posted by "joao tiago a. m. viegas" <jt...@gmail.com>.
...err...wait, but thinking about it,

alll i have to do is to embed the javascript and use the cocoon object in
the request invocation, right?

com os melhores cumprimentos
joão tiago viegas


2009/10/20 Jasha Joachimsthal <j....@onehippo.com>

> You don't have to use XSP if you use flowscript for your logic. I've never
> used XSP because it has been a bit outdated for a while but some people
> still like using it.
> Jasha
>
>
> 2009/10/20 joao tiago a. m. viegas <jt...@gmail.com>
>
>> thank you Jasha,
>> i did never use it  but i'll have a go with flowscript, i'll read the docs
>> and say something later.
>> I presume i have to change the xsp file, right?
>>
>>
>>
>> com os melhores cumprimentos
>> joão tiago viegas
>>
>>
>> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>>
>>> You could solve it with flowscript.
>>> function writeandread() {
>>> cocoon.processPipelineTo("pipelineThatWritesTheFile", NullOutputStream);
>>> // executes the pipeline that does the writing, but does not return a
>>> response
>>> cocoon.sendPage("pipelineThatReadsTheFile"); // executes the pipeline
>>> with the map:read for the newly created file and sends the response to the
>>> browser
>>> }
>>>
>>>
>>> 2009/10/20 joao tiago a. m. viegas <jt...@gmail.com>
>>>
>>> Thank you very much Jasha,
>>>>
>>>> that explains some questions i've had.
>>>>
>>>> But can't i do a redirection within my serializer implementer code, or
>>>> it just ends in there and no more processing is done in the pipeline?
>>>>
>>>> com os melhores cumprimentos
>>>> joão tiago viegas
>>>>
>>>>
>>>> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>>>>
>>>> After<map:serialize type="invoice2filesys">
>>>>>                                         <map:parameter name="path"
>>>>> value="{path}"/>
>>>>>                                         <map:parameter name="file"
>>>>> value="{file}"/>
>>>>>                                 </map:serialize>
>>>>>
>>>>> Your pipeline is done so it will not reach
>>>>>                                  <map:read type="resource"
>>>>> src="{path}/{file}" mime-type="application/pdf" />
>>>>>
>>>>> But you could change it into some flowscript function call that handles
>>>>> the saving and then responds with the PDF.
>>>>>
>>>>> Jasha Joachimsthal
>>>>>
>>>>> j.joachimsthal@onehippo.com - jasha@apache.org
>>>>>
>>>>> www.onehippo.com
>>>>> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
>>>>> San Francisco - Hippo USA Inc. 185 H Street, suite B, Petaluma CA 94952
>>>>> +1 (707) 7734646
>>>>>
>>>>>
>>>>> 2009/10/19 joao tiago a. m. viegas <jt...@gmail.com>
>>>>>
>>>>> Thank you very much Alexander,
>>>>>>
>>>>>> i've discovered with LiveHTTPHeaders addon that the content-length is
>>>>>> = 0 !!!
>>>>>>
>>>>>> the pipeline section is this:
>>>>>>
>>>>>>                 <map:act type="invoice-save-action">
>>>>>>                         <map:select type="parameter">
>>>>>>                         <map:parameter name="parameter-selector-test"
>>>>>> value="{savepdf}"/>
>>>>>>                         <map:when test="1">
>>>>>>                                 <map:serialize type="invoice2filesys">
>>>>>>                                         <map:parameter name="path"
>>>>>> value="{path}"/>
>>>>>>                                         <map:parameter name="file"
>>>>>> value="{file}"/>
>>>>>>                                 </map:serialize>
>>>>>>                                  <map:read type="resource"
>>>>>> src="{path}/{file}" mime-type="application/pdf" />
>>>>>>                         </map:when>
>>>>>>                         <map:otherwise>
>>>>>>                                 <map:serialize type="fo2pdf"/>
>>>>>>                         </map:otherwise>
>>>>>>
>>>>>>                         </map:select>
>>>>>>         </map:act>
>>>>>>
>>>>>>
>>>>>> it tests if it's desired to save the file in the filesystem, and if
>>>>>> so, saves it (it does gets saved allright though), but the reader simply
>>>>>> does not work!
>>>>>>
>>>>>> i'm I overlooking something here?
>>>>>>
>>>>>> com os melhores cumprimentos
>>>>>> joão tiago viegas
>>>>>>
>>>>>>
>>>>>> 2009/10/18 Alexander Daniel <al...@gmx.at>
>>>>>>
>>>>>> On 17.10.2009, at 10:34, joao tiago a. m. viegas wrote:
>>>>>>>
>>>>>>>  Hello everyone,
>>>>>>>>
>>>>>>>> i'm having this problem where i want to read static pdf files in the
>>>>>>>> server and "supply" them to the browser for being read by the acrobat pdf
>>>>>>>> plugin. The plugin always complains about it being a text/plain file.
>>>>>>>> I'm using the default resource reader and specifying the mime-type,
>>>>>>>> just like in the user documentation, strictly by the book.
>>>>>>>>
>>>>>>>
>>>>>>> For analysis you could check with Firefox Add-on Live HTTP Headers
>>>>>>> [1] whether the HTTP response headers are sent correctly to the browser.
>>>>>>>
>>>>>>> Alex
>>>>>>>
>>>>>>> [1] https://addons.mozilla.org/en-US/firefox/addon/3829
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: problem showing pdf as text/plain with resourcereader

Posted by Jasha Joachimsthal <j....@onehippo.com>.
You don't have to use XSP if you use flowscript for your logic. I've never
used XSP because it has been a bit outdated for a while but some people
still like using it.
Jasha

2009/10/20 joao tiago a. m. viegas <jt...@gmail.com>

> thank you Jasha,
> i did never use it  but i'll have a go with flowscript, i'll read the docs
> and say something later.
> I presume i have to change the xsp file, right?
>
>
>
> com os melhores cumprimentos
> joão tiago viegas
>
>
> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>
>> You could solve it with flowscript.
>> function writeandread() {
>> cocoon.processPipelineTo("pipelineThatWritesTheFile", NullOutputStream);
>> // executes the pipeline that does the writing, but does not return a
>> response
>> cocoon.sendPage("pipelineThatReadsTheFile"); // executes the pipeline with
>> the map:read for the newly created file and sends the response to the
>> browser
>> }
>>
>>
>> 2009/10/20 joao tiago a. m. viegas <jt...@gmail.com>
>>
>> Thank you very much Jasha,
>>>
>>> that explains some questions i've had.
>>>
>>> But can't i do a redirection within my serializer implementer code, or it
>>> just ends in there and no more processing is done in the pipeline?
>>>
>>> com os melhores cumprimentos
>>> joão tiago viegas
>>>
>>>
>>> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>>>
>>> After<map:serialize type="invoice2filesys">
>>>>                                         <map:parameter name="path"
>>>> value="{path}"/>
>>>>                                         <map:parameter name="file"
>>>> value="{file}"/>
>>>>                                 </map:serialize>
>>>>
>>>> Your pipeline is done so it will not reach
>>>>                                  <map:read type="resource"
>>>> src="{path}/{file}" mime-type="application/pdf" />
>>>>
>>>> But you could change it into some flowscript function call that handles
>>>> the saving and then responds with the PDF.
>>>>
>>>> Jasha Joachimsthal
>>>>
>>>> j.joachimsthal@onehippo.com - jasha@apache.org
>>>>
>>>> www.onehippo.com
>>>> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
>>>> San Francisco - Hippo USA Inc. 185 H Street, suite B, Petaluma CA 94952
>>>> +1 (707) 7734646
>>>>
>>>>
>>>> 2009/10/19 joao tiago a. m. viegas <jt...@gmail.com>
>>>>
>>>> Thank you very much Alexander,
>>>>>
>>>>> i've discovered with LiveHTTPHeaders addon that the content-length is =
>>>>> 0 !!!
>>>>>
>>>>> the pipeline section is this:
>>>>>
>>>>>                 <map:act type="invoice-save-action">
>>>>>                         <map:select type="parameter">
>>>>>                         <map:parameter name="parameter-selector-test"
>>>>> value="{savepdf}"/>
>>>>>                         <map:when test="1">
>>>>>                                 <map:serialize type="invoice2filesys">
>>>>>                                         <map:parameter name="path"
>>>>> value="{path}"/>
>>>>>                                         <map:parameter name="file"
>>>>> value="{file}"/>
>>>>>                                 </map:serialize>
>>>>>                                  <map:read type="resource"
>>>>> src="{path}/{file}" mime-type="application/pdf" />
>>>>>                         </map:when>
>>>>>                         <map:otherwise>
>>>>>                                 <map:serialize type="fo2pdf"/>
>>>>>                         </map:otherwise>
>>>>>
>>>>>                         </map:select>
>>>>>         </map:act>
>>>>>
>>>>>
>>>>> it tests if it's desired to save the file in the filesystem, and if so,
>>>>> saves it (it does gets saved allright though), but the reader simply does
>>>>> not work!
>>>>>
>>>>> i'm I overlooking something here?
>>>>>
>>>>> com os melhores cumprimentos
>>>>> joão tiago viegas
>>>>>
>>>>>
>>>>> 2009/10/18 Alexander Daniel <al...@gmx.at>
>>>>>
>>>>> On 17.10.2009, at 10:34, joao tiago a. m. viegas wrote:
>>>>>>
>>>>>>  Hello everyone,
>>>>>>>
>>>>>>> i'm having this problem where i want to read static pdf files in the
>>>>>>> server and "supply" them to the browser for being read by the acrobat pdf
>>>>>>> plugin. The plugin always complains about it being a text/plain file.
>>>>>>> I'm using the default resource reader and specifying the mime-type,
>>>>>>> just like in the user documentation, strictly by the book.
>>>>>>>
>>>>>>
>>>>>> For analysis you could check with Firefox Add-on Live HTTP Headers [1]
>>>>>> whether the HTTP response headers are sent correctly to the browser.
>>>>>>
>>>>>> Alex
>>>>>>
>>>>>> [1] https://addons.mozilla.org/en-US/firefox/addon/3829
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: problem showing pdf as text/plain with resourcereader

Posted by "joao tiago a. m. viegas" <jt...@gmail.com>.
thank you Jasha,
i did never use it  but i'll have a go with flowscript, i'll read the docs
and say something later.
I presume i have to change the xsp file, right?


com os melhores cumprimentos
joão tiago viegas


2009/10/20 Jasha Joachimsthal <j....@onehippo.com>

> You could solve it with flowscript.
> function writeandread() {
> cocoon.processPipelineTo("pipelineThatWritesTheFile", NullOutputStream); //
> executes the pipeline that does the writing, but does not return a response
> cocoon.sendPage("pipelineThatReadsTheFile"); // executes the pipeline with
> the map:read for the newly created file and sends the response to the
> browser
> }
>
>
> 2009/10/20 joao tiago a. m. viegas <jt...@gmail.com>
>
> Thank you very much Jasha,
>>
>> that explains some questions i've had.
>>
>> But can't i do a redirection within my serializer implementer code, or it
>> just ends in there and no more processing is done in the pipeline?
>>
>> com os melhores cumprimentos
>> joão tiago viegas
>>
>>
>> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>>
>> After<map:serialize type="invoice2filesys">
>>>                                         <map:parameter name="path"
>>> value="{path}"/>
>>>                                         <map:parameter name="file"
>>> value="{file}"/>
>>>                                 </map:serialize>
>>>
>>> Your pipeline is done so it will not reach
>>>                                  <map:read type="resource"
>>> src="{path}/{file}" mime-type="application/pdf" />
>>>
>>> But you could change it into some flowscript function call that handles
>>> the saving and then responds with the PDF.
>>>
>>> Jasha Joachimsthal
>>>
>>> j.joachimsthal@onehippo.com - jasha@apache.org
>>>
>>> www.onehippo.com
>>> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
>>> San Francisco - Hippo USA Inc. 185 H Street, suite B, Petaluma CA 94952
>>> +1 (707) 7734646
>>>
>>>
>>> 2009/10/19 joao tiago a. m. viegas <jt...@gmail.com>
>>>
>>> Thank you very much Alexander,
>>>>
>>>> i've discovered with LiveHTTPHeaders addon that the content-length is =
>>>> 0 !!!
>>>>
>>>> the pipeline section is this:
>>>>
>>>>                 <map:act type="invoice-save-action">
>>>>                         <map:select type="parameter">
>>>>                         <map:parameter name="parameter-selector-test"
>>>> value="{savepdf}"/>
>>>>                         <map:when test="1">
>>>>                                 <map:serialize type="invoice2filesys">
>>>>                                         <map:parameter name="path"
>>>> value="{path}"/>
>>>>                                         <map:parameter name="file"
>>>> value="{file}"/>
>>>>                                 </map:serialize>
>>>>                                  <map:read type="resource"
>>>> src="{path}/{file}" mime-type="application/pdf" />
>>>>                         </map:when>
>>>>                         <map:otherwise>
>>>>                                 <map:serialize type="fo2pdf"/>
>>>>                         </map:otherwise>
>>>>
>>>>                         </map:select>
>>>>         </map:act>
>>>>
>>>>
>>>> it tests if it's desired to save the file in the filesystem, and if so,
>>>> saves it (it does gets saved allright though), but the reader simply does
>>>> not work!
>>>>
>>>> i'm I overlooking something here?
>>>>
>>>> com os melhores cumprimentos
>>>> joão tiago viegas
>>>>
>>>>
>>>> 2009/10/18 Alexander Daniel <al...@gmx.at>
>>>>
>>>> On 17.10.2009, at 10:34, joao tiago a. m. viegas wrote:
>>>>>
>>>>>  Hello everyone,
>>>>>>
>>>>>> i'm having this problem where i want to read static pdf files in the
>>>>>> server and "supply" them to the browser for being read by the acrobat pdf
>>>>>> plugin. The plugin always complains about it being a text/plain file.
>>>>>> I'm using the default resource reader and specifying the mime-type,
>>>>>> just like in the user documentation, strictly by the book.
>>>>>>
>>>>>
>>>>> For analysis you could check with Firefox Add-on Live HTTP Headers [1]
>>>>> whether the HTTP response headers are sent correctly to the browser.
>>>>>
>>>>> Alex
>>>>>
>>>>> [1] https://addons.mozilla.org/en-US/firefox/addon/3829
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>>
>>>>>
>>>>
>>>
>>
>

Re: problem showing pdf as text/plain with resourcereader

Posted by Dominic Mitchell <do...@happygiraffe.net>.
On Tue, Dec 29, 2009 at 10:16 AM, joao tiago a. m. viegas <
jtviegas@gmail.com> wrote:

> oh thank you, but I'm not, if you'd read the message till the end you'd see
> there's:
>
>
> and if in the javascript function i change the function invocation for
>> cocoon.processPipelineTo("pagesave",null,nullos);
>> i get
>> processPipelineTo is not a function
>>
>
Doh.  Sorry.  I did miss that.  According to an example in the cocoon source
(sendpage.js<http://svn.apache.org/repos/asf/cocoon/trunk/blocks/cocoon-core-sample/cocoon-core-main-sample/src/main/resources/COB-INF/flow/test/sendpage.js>),
that is the correct invocation.  The only thing that might make a difference
is the type of nullos.  In the example, it's
org.apache.cocoon.util.NullOutputStream, whereas in your code it's
org.apache.cocoon.ant.NullOutputStream.  That may cause rhino to not
correctly match the method you're expecting.

One more thing to note: the example you post doesn't end in a call to
cocoon.sendPage(), so you'll likely get nothing coming back to the browser,
or an error.  Not sure which.

-Dom

Re: problem showing pdf as text/plain with resourcereader

Posted by "joao tiago a. m. viegas" <jt...@gmail.com>.
oh thank you, but I'm not, if you'd read the message till the end you'd see
there's:

and if in the javascript function i change the function invocation for
> cocoon.processPipelineTo("pagesave",null,nullos);
> i get
> processPipelineTo is not a function




2009/12/28 Dominic Mitchell <do...@happygiraffe.net>

> On Thu, Dec 24, 2009 at 7:20 AM, joao tiago a. m. viegas <
> jtviegas@gmail.com> wrote:
>
>> i want to wish everybody an Happy Christmas and an Astounding Happy New
>> Year.
>>
>> in the meantime, somewhere in the lower left corner of Europe, in a cocoon
>> 2.1,
>>
>> i'm still on the flowscript issue and i can't figure out what is wrong
>> with my code:
>>
>>    - i have this block inside the components section in the sitemap
>>
>> <map:flow language="JavaScript">
>>    <map:script src="javascript/flow.js" />
>> </map:flow>
>>
>>    - then i have this match
>>
>> <map:match pattern="page.pdf">
>>    <map:call function="invoicecontroller" />
>> </map:match>
>>
>>    - and then i have this javascript file in javascript/flow.js with a
>>    function
>>
>> function invoicecontroller()
>> {
>>    var nullos = new Packages.org.apache.cocoon.ant.NullOutputStream();
>> processPipelineTo("pagesave",null,nullos);
>> }
>>
>> ..now all i get is
>> "processPipelineTo" is not defined.
>>
>> and if in the javascript function i change the function invocation for
>> cocoon.processPipelineTo("pagesave",null,nullos);
>>
>> i get
>> processPipelineTo is not a function
>>
>> can anybody tell me what am i missing here?
>>
>>
> You're missing a "cocoon." -- there's no global function called
> processPipelineTo(), but there is one in the cocoon object.
>
> -Dom
>
>

Re: problem showing pdf as text/plain with resourcereader

Posted by Dominic Mitchell <do...@happygiraffe.net>.
On Thu, Dec 24, 2009 at 7:20 AM, joao tiago a. m. viegas <jtviegas@gmail.com
> wrote:

> i want to wish everybody an Happy Christmas and an Astounding Happy New
> Year.
>
> in the meantime, somewhere in the lower left corner of Europe, in a cocoon
> 2.1,
>
> i'm still on the flowscript issue and i can't figure out what is wrong with
> my code:
>
>    - i have this block inside the components section in the sitemap
>
> <map:flow language="JavaScript">
>    <map:script src="javascript/flow.js" />
> </map:flow>
>
>    - then i have this match
>
> <map:match pattern="page.pdf">
>    <map:call function="invoicecontroller" />
> </map:match>
>
>    - and then i have this javascript file in javascript/flow.js with a
>    function
>
> function invoicecontroller()
> {
>    var nullos = new Packages.org.apache.cocoon.ant.NullOutputStream();
> processPipelineTo("pagesave",null,nullos);
> }
>
> ..now all i get is
> "processPipelineTo" is not defined.
>
> and if in the javascript function i change the function invocation for
> cocoon.processPipelineTo("pagesave",null,nullos);
>
> i get
> processPipelineTo is not a function
>
> can anybody tell me what am i missing here?
>
>
You're missing a "cocoon." -- there's no global function called
processPipelineTo(), but there is one in the cocoon object.

-Dom

Re: problem showing pdf as text/plain with resourcereader

Posted by "joao tiago a. m. viegas" <jt...@gmail.com>.
Hello everyone,

i want to wish everybody an Happy Christmas and an Astounding Happy New
Year.

in the meantime, somewhere in the lower left corner of Europe, in a cocoon
2.1,

i'm still on the flowscript issue and i can't figure out what is wrong with
my code:

   - i have this block inside the components section in the sitemap

<map:flow language="JavaScript">
   <map:script src="javascript/flow.js" />
</map:flow>

   - then i have this match

<map:match pattern="page.pdf">
   <map:call function="invoicecontroller" />
</map:match>

   - and then i have this javascript file in javascript/flow.js with a
   function

function invoicecontroller()
{
   var nullos = new Packages.org.apache.cocoon.ant.NullOutputStream();
processPipelineTo("pagesave",null,nullos);
}

..now all i get is
"processPipelineTo" is not defined.

and if in the javascript function i change the function invocation for
cocoon.processPipelineTo("pagesave",null,nullos);

i get
processPipelineTo is not a function

can anybody tell me what am i missing here?

thanks in advance

Best Regards
joão tiago viegas


2009/11/6 joao tiago a. m. viegas <jt...@gmail.com>

> Sorry,
> i've sent erroneously the previous message, i'll finish it now;
>
> so...
>
>
> i've read the example at the documentation about flow
> and coded a javascript function in order to process a document and after it
> reading it,
>
> function invoicecontroller()
> {
>    processPipelineTo("
>>
>> invoicecreator", null);
>>    sendPage("filereader");
>> }
>>
>> ...the problem is that the page answer is
>
> "processPipelineTo" is not defined
>
> ...and even the "sendPage" call, i must do it without referencing it
> through the cocoon (cocoon.sendPage())object otherwise i won't get it to
> work.
>
> I must be lacking something here, do you have an idea?
>
>
>
> Best Regards
> joão tiago viegas
>
>
> 2009/11/6 joao tiago a. m. viegas <jt...@gmail.com>
>
> Hello again,
>>
>> i've read the example at the documentation about flow
>> and coded a javascript function in order to process a dicument and after
>> it reading it,
>>
>> function invoicecontroller()
>> {
>>    processPipelineTo("invoicecreator", null);
>>    sendPage("filereader");
>> }
>>
>> ...the problem is that the page answer is
>>
>>
>> com os melhores cumprimentos
>> joão tiago viegas
>>
>>
>> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>>
>>> You could solve it with flowscript.
>>>
>>> function writeandread() {
>>> cocoon.processPipelineTo("pipelineThatWritesTheFile", NullOutputStream);
>>> // executes the pipeline that does the writing, but does not return a
>>> response
>>> cocoon.sendPage("pipelineThatReadsTheFile"); // executes the pipeline
>>> with the map:read for the newly created file and sends the response to the
>>> browser
>>> }
>>>
>>>
>>> 2009/10/20 joao tiago a. m. viegas <jt...@gmail.com>
>>>
>>> Thank you very much Jasha,
>>>>
>>>> that explains some questions i've had.
>>>>
>>>> But can't i do a redirection within my serializer implementer code, or
>>>> it just ends in there and no more processing is done in the pipeline?
>>>>
>>>>
>>>> com os melhores cumprimentos
>>>> joão tiago viegas
>>>>
>>>>
>>>> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>>>>
>>>> After
>>>>> <map:serialize type="invoice2filesys">
>>>>>                                         <map:parameter name="path"
>>>>> value="{path}"/>
>>>>>                                         <map:parameter name="file"
>>>>> value="{file}"/>
>>>>>                                 </map:serialize>
>>>>>
>>>>> Your pipeline is done so it will not reach
>>>>>
>>>>>                                  <map:read type="resource"
>>>>> src="{path}/{file}" mime-type="application/pdf" />
>>>>>
>>>>> But you could change it into some flowscript function call that handles
>>>>> the saving and then responds with the PDF.
>>>>>
>>>>> Jasha Joachimsthal
>>>>>
>>>>> j.joachimsthal@onehippo.com - jasha@apache.org
>>>>>
>>>>> www.onehippo.com
>>>>> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
>>>>> San Francisco - Hippo USA Inc. 185 H Street, suite B, Petaluma CA 94952
>>>>> +1 (707) 7734646
>>>>>
>>>>>
>>>>> 2009/10/19 joao tiago a. m. viegas <jt...@gmail.com>
>>>>>
>>>>> Thank you very much Alexander,
>>>>>>
>>>>>> i've discovered with LiveHTTPHeaders addon that the content-length is
>>>>>> = 0 !!!
>>>>>>
>>>>>> the pipeline section is this:
>>>>>>
>>>>>>                 <map:act type="invoice-save-action">
>>>>>>                         <map:select type="parameter">
>>>>>>                         <map:parameter name="parameter-selector-test"
>>>>>> value="{savepdf}"/>
>>>>>>                         <map:when test="1">
>>>>>>                                 <map:serialize type="invoice2filesys">
>>>>>>                                         <map:parameter name="path"
>>>>>> value="{path}"/>
>>>>>>                                         <map:parameter name="file"
>>>>>> value="{file}"/>
>>>>>>                                 </map:serialize>
>>>>>>                                  <map:read type="resource"
>>>>>> src="{path}/{file}" mime-type="application/pdf" />
>>>>>>                         </map:when>
>>>>>>                         <map:otherwise>
>>>>>>                                 <map:serialize type="fo2pdf"/>
>>>>>>                         </map:otherwise>
>>>>>>
>>>>>>                         </map:select>
>>>>>>         </map:act>
>>>>>>
>>>>>>
>>>>>> it tests if it's desired to save the file in the filesystem, and if
>>>>>> so, saves it (it does gets saved allright though), but the reader simply
>>>>>> does not work!
>>>>>>
>>>>>> i'm I overlooking something here?
>>>>>>
>>>>>> com os melhores cumprimentos
>>>>>> joão tiago viegas
>>>>>>
>>>>>>
>>>>>> 2009/10/18 Alexander Daniel <al...@gmx.at>
>>>>>>
>>>>>> On 17.10.2009, at 10:34, joao tiago a. m. viegas wrote:
>>>>>>>
>>>>>>>  Hello everyone,
>>>>>>>>
>>>>>>>> i'm having this problem where i want to read static pdf files in the
>>>>>>>> server and "supply" them to the browser for being read by the acrobat pdf
>>>>>>>> plugin. The plugin always complains about it being a text/plain file.
>>>>>>>> I'm using the default resource reader and specifying the mime-type,
>>>>>>>> just like in the user documentation, strictly by the book.
>>>>>>>>
>>>>>>>
>>>>>>> For analysis you could check with Firefox Add-on Live HTTP Headers
>>>>>>> [1] whether the HTTP response headers are sent correctly to the browser.
>>>>>>>
>>>>>>> Alex
>>>>>>>
>>>>>>> [1] https://addons.mozilla.org/en-US/firefox/addon/3829
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: problem showing pdf as text/plain with resourcereader

Posted by "joao tiago a. m. viegas" <jt...@gmail.com>.
Sorry,
i've sent erroneously the previous message, i'll finish it now;

so...

i've read the example at the documentation about flow
and coded a javascript function in order to process a document and after it
reading it,

function invoicecontroller()
{
   processPipelineTo("
>
> invoicecreator", null);
>    sendPage("filereader");
> }
>
> ...the problem is that the page answer is

"processPipelineTo" is not defined

...and even the "sendPage" call, i must do it without referencing it through
the cocoon (cocoon.sendPage())object otherwise i won't get it to work.

I must be lacking something here, do you have an idea?


Best Regards
joão tiago viegas


2009/11/6 joao tiago a. m. viegas <jt...@gmail.com>

> Hello again,
>
> i've read the example at the documentation about flow
> and coded a javascript function in order to process a dicument and after it
> reading it,
>
> function invoicecontroller()
> {
>    processPipelineTo("invoicecreator", null);
>    sendPage("filereader");
> }
>
> ...the problem is that the page answer is
>
>
> com os melhores cumprimentos
> joão tiago viegas
>
>
> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>
>> You could solve it with flowscript.
>>
>> function writeandread() {
>> cocoon.processPipelineTo("pipelineThatWritesTheFile", NullOutputStream);
>> // executes the pipeline that does the writing, but does not return a
>> response
>> cocoon.sendPage("pipelineThatReadsTheFile"); // executes the pipeline with
>> the map:read for the newly created file and sends the response to the
>> browser
>> }
>>
>>
>> 2009/10/20 joao tiago a. m. viegas <jt...@gmail.com>
>>
>> Thank you very much Jasha,
>>>
>>> that explains some questions i've had.
>>>
>>> But can't i do a redirection within my serializer implementer code, or it
>>> just ends in there and no more processing is done in the pipeline?
>>>
>>>
>>> com os melhores cumprimentos
>>> joão tiago viegas
>>>
>>>
>>> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>>>
>>> After
>>>> <map:serialize type="invoice2filesys">
>>>>                                         <map:parameter name="path"
>>>> value="{path}"/>
>>>>                                         <map:parameter name="file"
>>>> value="{file}"/>
>>>>                                 </map:serialize>
>>>>
>>>> Your pipeline is done so it will not reach
>>>>
>>>>                                  <map:read type="resource"
>>>> src="{path}/{file}" mime-type="application/pdf" />
>>>>
>>>> But you could change it into some flowscript function call that handles
>>>> the saving and then responds with the PDF.
>>>>
>>>> Jasha Joachimsthal
>>>>
>>>> j.joachimsthal@onehippo.com - jasha@apache.org
>>>>
>>>> www.onehippo.com
>>>> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
>>>> San Francisco - Hippo USA Inc. 185 H Street, suite B, Petaluma CA 94952
>>>> +1 (707) 7734646
>>>>
>>>>
>>>> 2009/10/19 joao tiago a. m. viegas <jt...@gmail.com>
>>>>
>>>> Thank you very much Alexander,
>>>>>
>>>>> i've discovered with LiveHTTPHeaders addon that the content-length is =
>>>>> 0 !!!
>>>>>
>>>>> the pipeline section is this:
>>>>>
>>>>>                 <map:act type="invoice-save-action">
>>>>>                         <map:select type="parameter">
>>>>>                         <map:parameter name="parameter-selector-test"
>>>>> value="{savepdf}"/>
>>>>>                         <map:when test="1">
>>>>>                                 <map:serialize type="invoice2filesys">
>>>>>                                         <map:parameter name="path"
>>>>> value="{path}"/>
>>>>>                                         <map:parameter name="file"
>>>>> value="{file}"/>
>>>>>                                 </map:serialize>
>>>>>                                  <map:read type="resource"
>>>>> src="{path}/{file}" mime-type="application/pdf" />
>>>>>                         </map:when>
>>>>>                         <map:otherwise>
>>>>>                                 <map:serialize type="fo2pdf"/>
>>>>>                         </map:otherwise>
>>>>>
>>>>>                         </map:select>
>>>>>         </map:act>
>>>>>
>>>>>
>>>>> it tests if it's desired to save the file in the filesystem, and if so,
>>>>> saves it (it does gets saved allright though), but the reader simply does
>>>>> not work!
>>>>>
>>>>> i'm I overlooking something here?
>>>>>
>>>>> com os melhores cumprimentos
>>>>> joão tiago viegas
>>>>>
>>>>>
>>>>> 2009/10/18 Alexander Daniel <al...@gmx.at>
>>>>>
>>>>> On 17.10.2009, at 10:34, joao tiago a. m. viegas wrote:
>>>>>>
>>>>>>  Hello everyone,
>>>>>>>
>>>>>>> i'm having this problem where i want to read static pdf files in the
>>>>>>> server and "supply" them to the browser for being read by the acrobat pdf
>>>>>>> plugin. The plugin always complains about it being a text/plain file.
>>>>>>> I'm using the default resource reader and specifying the mime-type,
>>>>>>> just like in the user documentation, strictly by the book.
>>>>>>>
>>>>>>
>>>>>> For analysis you could check with Firefox Add-on Live HTTP Headers [1]
>>>>>> whether the HTTP response headers are sent correctly to the browser.
>>>>>>
>>>>>> Alex
>>>>>>
>>>>>> [1] https://addons.mozilla.org/en-US/firefox/addon/3829
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: problem showing pdf as text/plain with resourcereader

Posted by "joao tiago a. m. viegas" <jt...@gmail.com>.
Hello again,

i've read the example at the documentation about flow
and coded a javascript function in order to process a dicument and after it
reading it,

function invoicecontroller()
{
   processPipelineTo("invoicecreator", null);
   sendPage("filereader");
}

...the problem is that the page answer is


com os melhores cumprimentos
joão tiago viegas


2009/10/20 Jasha Joachimsthal <j....@onehippo.com>

> You could solve it with flowscript.
>
> function writeandread() {
> cocoon.processPipelineTo("pipelineThatWritesTheFile", NullOutputStream); //
> executes the pipeline that does the writing, but does not return a response
> cocoon.sendPage("pipelineThatReadsTheFile"); // executes the pipeline with
> the map:read for the newly created file and sends the response to the
> browser
> }
>
>
> 2009/10/20 joao tiago a. m. viegas <jt...@gmail.com>
>
> Thank you very much Jasha,
>>
>> that explains some questions i've had.
>>
>> But can't i do a redirection within my serializer implementer code, or it
>> just ends in there and no more processing is done in the pipeline?
>>
>>
>> com os melhores cumprimentos
>> joão tiago viegas
>>
>>
>> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>>
>> After
>>> <map:serialize type="invoice2filesys">
>>>                                         <map:parameter name="path"
>>> value="{path}"/>
>>>                                         <map:parameter name="file"
>>> value="{file}"/>
>>>                                 </map:serialize>
>>>
>>> Your pipeline is done so it will not reach
>>>
>>>                                  <map:read type="resource"
>>> src="{path}/{file}" mime-type="application/pdf" />
>>>
>>> But you could change it into some flowscript function call that handles
>>> the saving and then responds with the PDF.
>>>
>>> Jasha Joachimsthal
>>>
>>> j.joachimsthal@onehippo.com - jasha@apache.org
>>>
>>> www.onehippo.com
>>> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
>>> San Francisco - Hippo USA Inc. 185 H Street, suite B, Petaluma CA 94952
>>> +1 (707) 7734646
>>>
>>>
>>> 2009/10/19 joao tiago a. m. viegas <jt...@gmail.com>
>>>
>>> Thank you very much Alexander,
>>>>
>>>> i've discovered with LiveHTTPHeaders addon that the content-length is =
>>>> 0 !!!
>>>>
>>>> the pipeline section is this:
>>>>
>>>>                 <map:act type="invoice-save-action">
>>>>                         <map:select type="parameter">
>>>>                         <map:parameter name="parameter-selector-test"
>>>> value="{savepdf}"/>
>>>>                         <map:when test="1">
>>>>                                 <map:serialize type="invoice2filesys">
>>>>                                         <map:parameter name="path"
>>>> value="{path}"/>
>>>>                                         <map:parameter name="file"
>>>> value="{file}"/>
>>>>                                 </map:serialize>
>>>>                                  <map:read type="resource"
>>>> src="{path}/{file}" mime-type="application/pdf" />
>>>>                         </map:when>
>>>>                         <map:otherwise>
>>>>                                 <map:serialize type="fo2pdf"/>
>>>>                         </map:otherwise>
>>>>
>>>>                         </map:select>
>>>>         </map:act>
>>>>
>>>>
>>>> it tests if it's desired to save the file in the filesystem, and if so,
>>>> saves it (it does gets saved allright though), but the reader simply does
>>>> not work!
>>>>
>>>> i'm I overlooking something here?
>>>>
>>>> com os melhores cumprimentos
>>>> joão tiago viegas
>>>>
>>>>
>>>> 2009/10/18 Alexander Daniel <al...@gmx.at>
>>>>
>>>> On 17.10.2009, at 10:34, joao tiago a. m. viegas wrote:
>>>>>
>>>>>  Hello everyone,
>>>>>>
>>>>>> i'm having this problem where i want to read static pdf files in the
>>>>>> server and "supply" them to the browser for being read by the acrobat pdf
>>>>>> plugin. The plugin always complains about it being a text/plain file.
>>>>>> I'm using the default resource reader and specifying the mime-type,
>>>>>> just like in the user documentation, strictly by the book.
>>>>>>
>>>>>
>>>>> For analysis you could check with Firefox Add-on Live HTTP Headers [1]
>>>>> whether the HTTP response headers are sent correctly to the browser.
>>>>>
>>>>> Alex
>>>>>
>>>>> [1] https://addons.mozilla.org/en-US/firefox/addon/3829
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>>
>>>>>
>>>>
>>>
>>
>

Re: problem showing pdf as text/plain with resourcereader

Posted by Jasha Joachimsthal <j....@onehippo.com>.
You could solve it with flowscript.
function writeandread() {
cocoon.processPipelineTo("pipelineThatWritesTheFile", NullOutputStream); //
executes the pipeline that does the writing, but does not return a response
cocoon.sendPage("pipelineThatReadsTheFile"); // executes the pipeline with
the map:read for the newly created file and sends the response to the
browser
}


2009/10/20 joao tiago a. m. viegas <jt...@gmail.com>

> Thank you very much Jasha,
>
> that explains some questions i've had.
>
> But can't i do a redirection within my serializer implementer code, or it
> just ends in there and no more processing is done in the pipeline?
>
> com os melhores cumprimentos
> joão tiago viegas
>
>
> 2009/10/20 Jasha Joachimsthal <j....@onehippo.com>
>
> After<map:serialize type="invoice2filesys">
>>                                         <map:parameter name="path"
>> value="{path}"/>
>>                                         <map:parameter name="file"
>> value="{file}"/>
>>                                 </map:serialize>
>>
>> Your pipeline is done so it will not reach
>>                                  <map:read type="resource"
>> src="{path}/{file}" mime-type="application/pdf" />
>>
>> But you could change it into some flowscript function call that handles
>> the saving and then responds with the PDF.
>>
>> Jasha Joachimsthal
>>
>> j.joachimsthal@onehippo.com - jasha@apache.org
>>
>> www.onehippo.com
>> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
>> San Francisco - Hippo USA Inc. 185 H Street, suite B, Petaluma CA 94952 +1
>> (707) 7734646
>>
>>
>> 2009/10/19 joao tiago a. m. viegas <jt...@gmail.com>
>>
>> Thank you very much Alexander,
>>>
>>> i've discovered with LiveHTTPHeaders addon that the content-length is = 0
>>> !!!
>>>
>>> the pipeline section is this:
>>>
>>>                 <map:act type="invoice-save-action">
>>>                         <map:select type="parameter">
>>>                         <map:parameter name="parameter-selector-test"
>>> value="{savepdf}"/>
>>>                         <map:when test="1">
>>>                                 <map:serialize type="invoice2filesys">
>>>                                         <map:parameter name="path"
>>> value="{path}"/>
>>>                                         <map:parameter name="file"
>>> value="{file}"/>
>>>                                 </map:serialize>
>>>                                  <map:read type="resource"
>>> src="{path}/{file}" mime-type="application/pdf" />
>>>                         </map:when>
>>>                         <map:otherwise>
>>>                                 <map:serialize type="fo2pdf"/>
>>>                         </map:otherwise>
>>>
>>>                         </map:select>
>>>         </map:act>
>>>
>>>
>>> it tests if it's desired to save the file in the filesystem, and if so,
>>> saves it (it does gets saved allright though), but the reader simply does
>>> not work!
>>>
>>> i'm I overlooking something here?
>>>
>>> com os melhores cumprimentos
>>> joão tiago viegas
>>>
>>>
>>> 2009/10/18 Alexander Daniel <al...@gmx.at>
>>>
>>> On 17.10.2009, at 10:34, joao tiago a. m. viegas wrote:
>>>>
>>>>  Hello everyone,
>>>>>
>>>>> i'm having this problem where i want to read static pdf files in the
>>>>> server and "supply" them to the browser for being read by the acrobat pdf
>>>>> plugin. The plugin always complains about it being a text/plain file.
>>>>> I'm using the default resource reader and specifying the mime-type,
>>>>> just like in the user documentation, strictly by the book.
>>>>>
>>>>
>>>> For analysis you could check with Firefox Add-on Live HTTP Headers [1]
>>>> whether the HTTP response headers are sent correctly to the browser.
>>>>
>>>> Alex
>>>>
>>>> [1] https://addons.mozilla.org/en-US/firefox/addon/3829
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>
>>>>
>>>
>>
>

Re: problem showing pdf as text/plain with resourcereader

Posted by "joao tiago a. m. viegas" <jt...@gmail.com>.
Thank you very much Jasha,

that explains some questions i've had.

But can't i do a redirection within my serializer implementer code, or it
just ends in there and no more processing is done in the pipeline?

com os melhores cumprimentos
joão tiago viegas


2009/10/20 Jasha Joachimsthal <j....@onehippo.com>

> After<map:serialize type="invoice2filesys">
>                                         <map:parameter name="path"
> value="{path}"/>
>                                         <map:parameter name="file"
> value="{file}"/>
>                                 </map:serialize>
>
> Your pipeline is done so it will not reach
>                                  <map:read type="resource"
> src="{path}/{file}" mime-type="application/pdf" />
>
> But you could change it into some flowscript function call that handles the
> saving and then responds with the PDF.
>
> Jasha Joachimsthal
>
> j.joachimsthal@onehippo.com - jasha@apache.org
>
> www.onehippo.com
> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
> San Francisco - Hippo USA Inc. 185 H Street, suite B, Petaluma CA 94952 +1
> (707) 7734646
>
>
> 2009/10/19 joao tiago a. m. viegas <jt...@gmail.com>
>
> Thank you very much Alexander,
>>
>> i've discovered with LiveHTTPHeaders addon that the content-length is = 0
>> !!!
>>
>> the pipeline section is this:
>>
>>                 <map:act type="invoice-save-action">
>>                         <map:select type="parameter">
>>                         <map:parameter name="parameter-selector-test"
>> value="{savepdf}"/>
>>                         <map:when test="1">
>>                                 <map:serialize type="invoice2filesys">
>>                                         <map:parameter name="path"
>> value="{path}"/>
>>                                         <map:parameter name="file"
>> value="{file}"/>
>>                                 </map:serialize>
>>                                  <map:read type="resource"
>> src="{path}/{file}" mime-type="application/pdf" />
>>                         </map:when>
>>                         <map:otherwise>
>>                                 <map:serialize type="fo2pdf"/>
>>                         </map:otherwise>
>>
>>                         </map:select>
>>         </map:act>
>>
>>
>> it tests if it's desired to save the file in the filesystem, and if so,
>> saves it (it does gets saved allright though), but the reader simply does
>> not work!
>>
>> i'm I overlooking something here?
>>
>> com os melhores cumprimentos
>> joão tiago viegas
>>
>>
>> 2009/10/18 Alexander Daniel <al...@gmx.at>
>>
>> On 17.10.2009, at 10:34, joao tiago a. m. viegas wrote:
>>>
>>>  Hello everyone,
>>>>
>>>> i'm having this problem where i want to read static pdf files in the
>>>> server and "supply" them to the browser for being read by the acrobat pdf
>>>> plugin. The plugin always complains about it being a text/plain file.
>>>> I'm using the default resource reader and specifying the mime-type, just
>>>> like in the user documentation, strictly by the book.
>>>>
>>>
>>> For analysis you could check with Firefox Add-on Live HTTP Headers [1]
>>> whether the HTTP response headers are sent correctly to the browser.
>>>
>>> Alex
>>>
>>> [1] https://addons.mozilla.org/en-US/firefox/addon/3829
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>
>

Re: problem showing pdf as text/plain with resourcereader

Posted by Jasha Joachimsthal <j....@onehippo.com>.
After<map:serialize type="invoice2filesys">
                                        <map:parameter name="path"
value="{path}"/>
                                        <map:parameter name="file"
value="{file}"/>
                                </map:serialize>

Your pipeline is done so it will not reach
                                 <map:read type="resource"
src="{path}/{file}" mime-type="application/pdf" />

But you could change it into some flowscript function call that handles the
saving and then responds with the PDF.

Jasha Joachimsthal

j.joachimsthal@onehippo.com - jasha@apache.org

www.onehippo.com
Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
San Francisco - Hippo USA Inc. 185 H Street, suite B, Petaluma CA 94952 +1
(707) 7734646


2009/10/19 joao tiago a. m. viegas <jt...@gmail.com>

> Thank you very much Alexander,
>
> i've discovered with LiveHTTPHeaders addon that the content-length is = 0
> !!!
>
> the pipeline section is this:
>
>                 <map:act type="invoice-save-action">
>                         <map:select type="parameter">
>                         <map:parameter name="parameter-selector-test"
> value="{savepdf}"/>
>                         <map:when test="1">
>                                 <map:serialize type="invoice2filesys">
>                                         <map:parameter name="path"
> value="{path}"/>
>                                         <map:parameter name="file"
> value="{file}"/>
>                                 </map:serialize>
>                                  <map:read type="resource"
> src="{path}/{file}" mime-type="application/pdf" />
>                         </map:when>
>                         <map:otherwise>
>                                 <map:serialize type="fo2pdf"/>
>                         </map:otherwise>
>
>                         </map:select>
>         </map:act>
>
>
> it tests if it's desired to save the file in the filesystem, and if so,
> saves it (it does gets saved allright though), but the reader simply does
> not work!
>
> i'm I overlooking something here?
>
> com os melhores cumprimentos
> joão tiago viegas
>
>
> 2009/10/18 Alexander Daniel <al...@gmx.at>
>
> On 17.10.2009, at 10:34, joao tiago a. m. viegas wrote:
>>
>>  Hello everyone,
>>>
>>> i'm having this problem where i want to read static pdf files in the
>>> server and "supply" them to the browser for being read by the acrobat pdf
>>> plugin. The plugin always complains about it being a text/plain file.
>>> I'm using the default resource reader and specifying the mime-type, just
>>> like in the user documentation, strictly by the book.
>>>
>>
>> For analysis you could check with Firefox Add-on Live HTTP Headers [1]
>> whether the HTTP response headers are sent correctly to the browser.
>>
>> Alex
>>
>> [1] https://addons.mozilla.org/en-US/firefox/addon/3829
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>

Re: problem showing pdf as text/plain with resourcereader

Posted by "joao tiago a. m. viegas" <jt...@gmail.com>.
Thank you very much Alexander,

i've discovered with LiveHTTPHeaders addon that the content-length is = 0
!!!

the pipeline section is this:

                <map:act type="invoice-save-action">
                        <map:select type="parameter">
                        <map:parameter name="parameter-selector-test"
value="{savepdf}"/>
                        <map:when test="1">
                                <map:serialize type="invoice2filesys">
                                        <map:parameter name="path"
value="{path}"/>
                                        <map:parameter name="file"
value="{file}"/>
                                </map:serialize>
                                 <map:read type="resource"
src="{path}/{file}" mime-type="application/pdf" />
                        </map:when>
                        <map:otherwise>
                                <map:serialize type="fo2pdf"/>
                        </map:otherwise>

                        </map:select>
        </map:act>


it tests if it's desired to save the file in the filesystem, and if so,
saves it (it does gets saved allright though), but the reader simply does
not work!

i'm I overlooking something here?

com os melhores cumprimentos
joão tiago viegas


2009/10/18 Alexander Daniel <al...@gmx.at>

> On 17.10.2009, at 10:34, joao tiago a. m. viegas wrote:
>
>  Hello everyone,
>>
>> i'm having this problem where i want to read static pdf files in the
>> server and "supply" them to the browser for being read by the acrobat pdf
>> plugin. The plugin always complains about it being a text/plain file.
>> I'm using the default resource reader and specifying the mime-type, just
>> like in the user documentation, strictly by the book.
>>
>
> For analysis you could check with Firefox Add-on Live HTTP Headers [1]
> whether the HTTP response headers are sent correctly to the browser.
>
> Alex
>
> [1] https://addons.mozilla.org/en-US/firefox/addon/3829
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: problem showing pdf as text/plain with resourcereader

Posted by Alexander Daniel <al...@gmx.at>.
On 17.10.2009, at 10:34, joao tiago a. m. viegas wrote:

> Hello everyone,
>
> i'm having this problem where i want to read static pdf files in the  
> server and "supply" them to the browser for being read by the  
> acrobat pdf plugin. The plugin always complains about it being a  
> text/plain file.
> I'm using the default resource reader and specifying the mime-type,  
> just like in the user documentation, strictly by the book.

For analysis you could check with Firefox Add-on Live HTTP Headers [1]  
whether the HTTP response headers are sent correctly to the browser.

Alex

[1] https://addons.mozilla.org/en-US/firefox/addon/3829

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org