On 18.05.2004 23:56, Joerg Heinicke wrote:

Can anybody tell me what can cause the invalid content length? The
first one is html serializer, the latter ones text serializer.

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.


23:45:18.000 WARN!! Invalid length: Content-Length=919 written=186
for
http://127.0.0.1:8888/xfaces/css/html/mozilla/skin/simple/step80-pages/simple/html/common/css.css

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 :)

WDYT?

Joerg

[1] http://c2.com/cgi/wiki?CodeSmell

Reply via email to