Hi,

----- Original Message ----- 
From: "Vincent Massol" >
> I'm still wondering. When you do a view source from an XE page, it's
> not very nice and doesn't look very professional.
>

Just some thoughts...

What about creating an optional (configured in web.xml) 
ResponseFormattingFilter which calls
chain.doFilter(request, new PrettyResponse(response));

PrettyResponse would be a wrapper for ServletResponse which would delegate 
all method calls to original response but also wrap its OutputStream with 
PrettyOutputStream.

PrettyOutputStream write() methods would have all necessary logic to 
properly indent html tags on-the-fly and call its underlying (wrapped) 
outputStream write() method whenever possible. This way we can process the 
document in small chunks.

We could also buffer this way the whole document in the filter and pretty 
print it at the end - it would be easier to implement but more memory 
consuming.

Additional possibilities:
- we could use CompactResponse (the output doc would be a one-liner, all 
unnecessary whitespaces removed) in order to lower bandwidth
- we can add the cache directives in response headers (so we won't need 
Apache for doing this - this can be also done in separate filter, in fact I 
already use such a filter)

Kind regards
Lukasz


_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to