You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Suzan Foster <su...@nerocmediaware.nl> on 2004/05/26 17:05:06 UTC
Problem using processPipelineTo()
Consider the following FlowScript code:
<code-snippet>
form newFile(form) {
<!-- uninteresting form handling code -->
...
if (form.getSubmitId() == "new") {
var uri = bean.name.replace(/\s/g, "_").toLowerCase() + ".xml";
var file = folder.newFile(uri);
var os = new java.io.ByteArrayOutputStream();
cocoon.processPipelineTo("templates/" + bean.type + ".xml",
null, os);
file.content = os.toString();
os.close();
...
}
cocoon.sendPage('content/' + cocoon.request.path, null);
}
</code-snippet>
The code executes properly, but results in the sendPage only returning a
portion of the generated page from the pipeline:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:xlink="http://www.w3.org/1999/xlink">
<head>
<META http-equiv="Content-Ty
Anybody any idea how i can fix this short of dumping the processPipelineTo?
groetjes, su.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Problem using processPipelineTo()
Posted by Suzan Foster <su...@nerocmediaware.nl>.
Joerg Heinicke wrote:
>>Sorry, a case of not enough coffee.. ;) However, the code is now failing
>>on pipelineUtil.processToDOM() reporting: Streaming of an internal
>>pipeline is not possible with a reader. Changing the pipeline to
>>internal-only="false" doesn't solve the problem.
>>
>>
>
>That's exactly what I feared when I talking about wrong content-length:
>a reader is involved. I had a similar problem last week:
>http://marc.theaimsgroup.com/?t=108491743200003&r=1&w=4. A reader sets
>the content-length header. In general readers are prevented from being
>used in internal requests.
>
>This has nothing todo with "internal-only" directly. "internal-only"
>determines whether a pipeline can be accessed from external or not.
>
>You have an internal request for example when using cocoon:/ or when
>accessing a pipeline by using processPipeline (for both the old way and
>the new way using PipelineUtil). The question is only if it is
>recognized as internal request.
>
>If you want to use processPipelineToDOM I guess you have XML. So instead
>of the reader you can use the file generator and a XML serializer.
>
Yes, this was exactly the problem. I changed my pipeline and it's
working perfectly now. This also explains a couple of problems I was
having with other pipelines which were reading a file from the fs,
transforming and then writing them back with the write-source
transformer. Thanks :)
groetjes, su.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Problem using processPipelineTo()
Posted by Joerg Heinicke <jo...@gmx.de>.
On 27.05.2004 12:38, Suzan Foster wrote:
>> When it is sendPage(): Is it correct that the pipeline 'content/' ...
>> works on that file? Then it's maybe a sync problem, the write to disk
>> might not have been finished. Another reason might be the chunking of
>> output if the content-length header is set to a wrong size. Can you
>> see the value of the header on client side?
>>
> If i look at PageInfo in firebird it says it's unknown.
>
>> The error message is obvious IMO.
>>
> Sorry, a case of not enough coffee.. ;) However, the code is now failing
> on pipelineUtil.processToDOM() reporting: Streaming of an internal
> pipeline is not possible with a reader. Changing the pipeline to
> internal-only="false" doesn't solve the problem.
That's exactly what I feared when I talking about wrong content-length:
a reader is involved. I had a similar problem last week:
http://marc.theaimsgroup.com/?t=108491743200003&r=1&w=4. A reader sets
the content-length header. In general readers are prevented from being
used in internal requests.
This has nothing todo with "internal-only" directly. "internal-only"
determines whether a pipeline can be accessed from external or not.
You have an internal request for example when using cocoon:/ or when
accessing a pipeline by using processPipeline (for both the old way and
the new way using PipelineUtil). The question is only if it is
recognized as internal request.
If you want to use processPipelineToDOM I guess you have XML. So instead
of the reader you can use the file generator and a XML serializer.
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Problem using processPipelineTo()
Posted by Suzan Foster <su...@nerocmediaware.nl>.
Joerg Heinicke wrote:
>When it is sendPage(): Is it correct that the pipeline 'content/' ...
>works on that file? Then it's maybe a sync problem, the write to disk
>might not have been finished. Another reason might be the chunking of
>output if the content-length header is set to a wrong size. Can you see
>the value of the header on client side?
>
>
If i look at PageInfo in firebird it says it's unknown.
>The error message is obvious IMO.
>
Sorry, a case of not enough coffee.. ;) However, the code is now failing
on pipelineUtil.processToDOM() reporting: Streaming of an internal
pipeline is not possible with a reader. Changing the pipeline to
internal-only="false" doesn't solve the problem.
groetjes, su.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Problem using processPipelineTo()
Posted by Joerg Heinicke <jo...@gmx.de>.
On 27.05.2004 10:00, Suzan Foster wrote:
>>> The code executes properly, but results in the sendPage only
>>> returning a portion of the generated page from the pipeline:
>>>
>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>>> "http://www.w3.org/TR/html4/loose.dtd">
>>> <html xmlns:xlink="http://www.w3.org/1999/xlink">
>>> <head>
>>> <META http-equiv="Content-Ty
>>
>> Is this the output in the file or of sendPage('content/' + ...) ??
>
> From the sendPage().
When it is sendPage(): Is it correct that the pipeline 'content/' ...
works on that file? Then it's maybe a sync problem, the write to disk
might not have been finished. Another reason might be the chunking of
output if the content-length header is set to a wrong size. Can you see
the value of the header on client side?
>> Do you know of PipelineUtil class. The above one might be deprecated
>> and removed.
>> http://wiki.cocoondev.org/Wiki.jsp?page=FOM_Cocoon
>>
> org.mozilla.javascript.EvaluatorException:
> "file:/usr/local/tomcat/webapps/cocoon/documents/flow/documents.js",
> line 3: Function importPackage must be called with a package;
> had "[JavaClass org.apache.cocoon.components.flow.util.PipelineUtil]"
> instead.
The error message is obvious IMO. You use importPackage, but import a
class. So either importClass or import the package.
> I expect this means i'm running a version of cocoon which doesn't have
> this class (2.1.4)? Is there a way of updating my cocoon without having
> to switch to 2.1.5? I am using JxForms, and understood they wern't
> present in the latest 2.1.5 release.
No, I used it in 2.1.4 too.
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Problem using processPipelineTo()
Posted by Suzan Foster <su...@nerocmediaware.nl>.
Joerg Heinicke wrote:
>On 26.05.2004 17:05, Suzan Foster wrote:
>
>
>>The code executes properly, but results in the sendPage only returning a
>>portion of the generated page from the pipeline:
>>
>><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>>"http://www.w3.org/TR/html4/loose.dtd">
>><html xmlns:xlink="http://www.w3.org/1999/xlink">
>><head>
>><META http-equiv="Content-Ty
>>
>>
>
>Is this the output in the file or of sendPage('content/' + ...) ??
>
>
From the sendPage().
>Do you know of PipelineUtil class. The above one might be deprecated and
>removed.
>http://wiki.cocoondev.org/Wiki.jsp?page=FOM_Cocoon
>
org.mozilla.javascript.EvaluatorException:
"file:/usr/local/tomcat/webapps/cocoon/documents/flow/documents.js",
line 3: Function importPackage must be called with a package;
had "[JavaClass org.apache.cocoon.components.flow.util.PipelineUtil]"
instead.
I expect this means i'm running a version of cocoon which doesn't have
this class (2.1.4)? Is there a way of updating my cocoon without having
to switch to 2.1.5? I am using JxForms, and understood they wern't
present in the latest 2.1.5 release.
groetjes, su.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Problem using processPipelineTo()
Posted by Joerg Heinicke <jo...@gmx.de>.
On 26.05.2004 17:05, Suzan Foster wrote:
> Consider the following FlowScript code:
>
> <code-snippet>
> form newFile(form) {
>
> <!-- uninteresting form handling code -->
> ...
> if (form.getSubmitId() == "new") {
> var uri = bean.name.replace(/\s/g, "_").toLowerCase() + ".xml";
> var file = folder.newFile(uri);
> var os = new java.io.ByteArrayOutputStream();
> cocoon.processPipelineTo("templates/" + bean.type + ".xml", null,
> os);
> file.content = os.toString();
> os.close();
> ... }
>
> cocoon.sendPage('content/' + cocoon.request.path, null);
> }
> </code-snippet>
>
> The code executes properly, but results in the sendPage only returning a
> portion of the generated page from the pipeline:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html xmlns:xlink="http://www.w3.org/1999/xlink">
> <head>
> <META http-equiv="Content-Ty
Is this the output in the file or of sendPage('content/' + ...) ??
> Anybody any idea how i can fix this short of dumping the processPipelineTo?
Do you know of PipelineUtil class. The above one might be deprecated and
removed.
http://wiki.cocoondev.org/Wiki.jsp?page=FOM_Cocoon
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org