Awesome, thanks! This works perfectly fine with me. Thanks a ton, @Joakim
Erdfelt <[email protected]>

Best,
Aniruddha
========

ᐧ

On Tue, Jul 6, 2021 at 3:06 PM Joakim Erdfelt <[email protected]> wrote:

> Ah, I missed that you were on Jetty 11.
>
> The request.getHttpFields() is an immutable object starting in Jetty
> 10.0.0.
>
> No worries, do this ...
>
> HttpFields.Mutable replacement = HttpFields.build(request.getHttpFields())
>     .put("X-Request-ID", UUID.randomUUID().toString().toUpperCase());
> request.setHttpFields(replacement);
>
>
> Joakim Erdfelt / [email protected]
>
>
> On Tue, Jul 6, 2021 at 5:00 PM Aniruddha Tekade <[email protected]>
> wrote:
>
>> Hi all,
>>
>> I actually posted this question on stackoverflow earlier. I am using
>> Jetty 11 and I am trying to add a custom header into httpServletRequest in
>> my handler class.
>>
>> Thanks to @Joakim Erdfelt <[email protected]> for introducing me to
>> HttpChannel.Listener. I followed his solution from stack-overflow comment
>> but stuck at finding the put() method. Here are my details:
>>
>>    1. I created a class RequestChannelListener implements
>>    HttpChannel.Listener
>>    2. Created an instance of this class
>>    3. Added as bean into connector in main method of the project
>>    4. Within RequestChannelListener - I implemented method
>>    onRequestBegin(Request request) and used this -
>>
>> public class RequestChannelListener implements HttpChannel.Listener {
>>     @Override
>>     public void onRequestBegin(Request request) {
>>         request.getHttpFields().put("X-Request-ID", 
>> UUID.randomUUID().toString().toUpperCase());
>>     }
>> }
>>
>> But I am not able to find the put method. Any suggestions?
>>
>>
>> Best,
>> Aniruddha
>> ========
>> ᐧ
>>
>
_______________________________________________
jetty-users mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to