On 21.05.2004 21:36, Joerg Heinicke wrote:

Can anybody tell me what can cause the invalid content length?

Found at least the reason: A stylesheet is imported via cocoon:/ and in
this pipeline the stylesheet is *read* from disk, the ResourceReader also sets the content-length header, the 919 bytes are the length of the stylesheet.

Now the question how to fix it. Referencing the stylesheet in the same way directly from the sitemap would result in a ProcessingException:
"Streaming of an internal pipeline is not possible with a reader." (AbstractProcessingPipeline, line 678).


1st issue: That this exception is not thrown when the stylesheet is imported by another stylesheet via cocoon:/ is 1.) somewhat inconsistent and 2.) hints on a bigger problem (why is this internal request not recognized as an internal request?).

On the one hand we could for simplification throw an exception for this case too - however this case will be recognized as internal request. On the other hand there is no need for it as transformers don't need to be streamed - otherwise it would not work using the reader as it did. This would allow to write partly shorter sitemaps, but I don't know if it's worth the effort to recognize internal requests sent by transformer steps.

2nd issue: Letting the reader set the headers "unasked" does not sound like IoC. The SitemapOutputComponent has a method shouldSetContentLength(), the AbstractReader implements it by returning false, but the ResourceReader sets it? Thinking in code smells [1] this stinks :)

Just another issue I want to nag you. Nobody cares or has an opinion? I would like to have solved both issues: 1. correct recognition of internal pipelines. 2. the reader is explicitely asked for setting the headers or this tasks is completely removed from it and put into the pipeline - but no auto magic.


Joerg

Reply via email to