Add Header to HTTPServletRequest
843841Oct 9 2007 — edited Oct 9 2007Hi,
I need to write a test class that sends an HTTP request to a servlet, this request needs a custom header adding to it, can this be done in java?
I haven't been able to find a way of doing this, HttpServletRequest has no addHeader() method and I've been looking at URL and HttpURLConnection class has no method to add a header (that I can tell).
Does anyone know if:
1. is it possible to add your own headers to http requests in java?
and
2. if so, what objects do I need to use?
Thanks.