Filter for javascript files

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Filter for javascript files

Ric 2000
Dear all,

I want to do a really simple task, but running into problems when doing it
in a Tapestry web application:

The task: replace or remove some content in js files sent to the client.

My approach: I wrote a normal servlet filter with a wrapper for the
HttpServletResponse, which allows to put out the content of the
OutputStream as byte array or string, then replace something in it and
write the modified content to the response stream again.

The problem: all inside the output stream is empty, I can not get the
content of the resources sent to the client.

I assume / know that Tapestry does some wrapping around the
HttpServletResponse and -Request and handles it in own services.

The question: can you please tell me, what is the correct way in Tapestry
to modify the content of e.g. static resources (like js files) and write
this modified content to the output stream?

Thanks for your help!

Best Regards