hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: PostMethod - parameter in BASE64String
Date Wed, 06 Dec 2006 16:49:12 GMT
Hello Marcelo,

> Actually I don´t need (and I can´t) encode the whole string, only chars
> considered invalid to base64.
> What I am doing is the same as you: I´m replacing some chars explicitly
> to the corresponding one in base64.
> 
> Example:
> ":" to %3A
> "/" to %2F
> "+" to %2B

This is NOT base64! This is www-url-encoded.

> The problem here, is that I missing some char and getting an error from
> server: "Invalid character in a Base-64 string."

That may be because you're not generating a base64 string at all.

Please follow the instructions in the Client HTTP Programming Primer
to analyze _what_ you should actually be sending. You may have to
install a network sniffer to be sure about what's sent by a browser.
If something needs to be base64-encoded, it is either generated by
the server or you'll find JavaScript that performs base64 encoding.
http://wiki.apache.org/jakarta-httpclient/ForAbsoluteBeginners

If you need www-url-encoding, just add the name/value pairs as parameters
to the PostMethod, the method should take care of the encoding.
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/PostMethod.html#addParameter(org.apache.commons.httpclient.NameValuePair)

hope that helps,
  Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message