Maybe use a response wrapper and buffer response to prevent the response 
commited issue?

Sendt fra min iPhone

> Den 11. des. 2014 kl. 16.19 skrev Joakim Erdfelt <[email protected]>:
> 
> That can be very tricky.
> 
> First, there's no built-in function to do that.
> So you'll have to write the html parsing & modification routines yourself.
> 
> This could be done via a Servlet Filter or a Jetty HandlerWrapper, in either 
> approach you'll want to wrap the HttpServletResponse to capture & modify the 
> response, and pass that wrapper down into the filter chain (or handler 
> wrapper chain).
> 
> Tip: response isCommitted can be a point of no return (esp for response 
> Content-Length), so keep that mind.
> 
> 
> --
> Joakim Erdfelt <[email protected]>
> webtide.com - intalio.com/jetty
> Expert advice, services and support from from the Jetty & CometD experts
> eclipse.org/jetty - cometd.org
> 
>> On Thu, Dec 11, 2014 at 7:45 AM, Michael Monaghan <[email protected]> wrote:
>> Hi,
>> For testing purposes, I need to modify the <head> element of all the 
>> text/html content generated by a large complicated app.
>> 
>> I need to add a JavaScript include to the <head> element.
>> 
>> The work required to do this in the app itself is likely not trivial. I 
>> don't own the app, and don't fully understand the architecture etc. There's 
>> little or no static HTML here.
>> 
>> Is it possible to have Jetty modify the <head> element of the content that 
>> it serves?
>> 
>> Thanks for your time.
>> 
>> _______________________________________________
>> jetty-users mailing list
>> [email protected]
>> To change your delivery options, retrieve your password, or unsubscribe from 
>> this list, visit
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
> 
> _______________________________________________
> jetty-users mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe from 
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to