1

I want to add some custom data in http header and send it to another web application so I can access that data. How can I do that, please help.

2
  • Could you be more specific on what this custom data is? Commented Apr 5, 2013 at 11:48
  • data in key, value format like "name=gkk" Commented Apr 5, 2013 at 11:52

2 Answers 2

1

Have a look to this article

// adds "X-Hello: World" header to the request
httpChannel.setRequestHeader("X-Hello", "World", false);
Sign up to request clarification or add additional context in comments.

1 Comment

As far as I can see this code only works in a firefox extension.
1

Easiest way to do is use java.net.HttpURLConnection.addRequestProperty() method. E.g

httpURLConnection.addRequestProperty("User-Agent", 
    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");

Check documentation for more details.

Comments

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.