Add Custom Header Parameters to Http Header

3.2k views Asked by At

Is there any working way to add custom attributes into the Http Header in the Http Request. So far
I have tried putting in Servlet filter response, httpRequest doesn't have a addHeader method. I tried Phase Listener in JSF. Nothing seems to work at all. Is there any way at all?
I use Weblogic, is there any Weblogic specific way, say some tag which can can be used to set custom header. Suggestions please.
In short, I want custom attributes in request of Http Header.

Is there any way I do something like below which is available for IIS server

<system.webServer> 
    <httpProtocol>
        <customHeaders>
            <clear />
            <add name="X-UA-Compatible" value="IE=EmulateIE7" />
        </customHeaders>
    </httpProtocol>
</system.webServer>      
1

There are 1 answers

6
Ramesh PVK On

Request headers are sent by the client who is invoking the Servlet/JSP, That is why Servlet Spec does not allow you to add any headers to the Request. If you want to set any custom attributes to the request, the only way to do is using HttpServletRequest.setAttribute() method.