org.apache.commons.httpclient.NameValuePair in post method

Posted by pushkins on Stack Overflow See other posts from Stack Overflow or by pushkins
Published on 2010-12-24T21:41:27Z Indexed on 2010/12/24 21:54 UTC
Read the original article Hit count: 221

Filed under:
|

I'm writing some code like :

PostMethod p = new PostMethod(someurl);
...
NameValuePair[] data = {
    new NameValuePair("name1", "somevalue1"),
    new NameValuePair("var[3][1]", "10")
};
try {
    hc.executeMethod(p);
}
...

And that's what I get, when I look at my post in Wireshark:

POST /someurl HTTP/1.1
...
type=var&ship%5B3%5D%5B1%5D=10

%5B means [, %5D- ]

So the problem is how I can get square brackets in my post?

© Stack Overflow or respective owner

Related posts about java

Related posts about commons-httpclient