0

How to set header with HttpClient? Is there a standard code example?

Andrew

1

1 Answer 1

1

How about using setHeader...

httpRequest.setHeader(headerName, headerValue);
Sign up to request clarification or add additional context in comments.

6 Comments

Emm... And could you show the whole code? httpRequest - is it a client side?
What more do you need? That's all there is to it. If this doesn't make sense then you need to ask a more general how-do-I-use-HttpClient question. Without knowing what else you want I can't possibly provide more code.
I need client to set header :) But as I can see req means a servlet code isn't it?
At this point, I'm lost. This will do what you asked. I don't know where servlets came into the picture.
Emm... is AbstractHttpMessage setHeader("","") better than HttpPost httppost.addHeader("","") ?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.