Java – where can I find the base64encoder class?
•
Java
Hi, I saw an example with this code on stackoverflow:
String encoding = Base64Encoder.encode ("test1:test1"); HttpPost httppost = new HttpPost("http://host:post/test/login"); httppost.setHeader("Authorization","Basic " + encoding); System.out.println("executing request " + httppost.getRequestLine()); HttpResponse response = httpclient.execute(httppost); httpentity entity = response.getEntity();
I have a similar task I try to use the same code, but I can't find the base64encoder class anywhere I use httpclient-4.1 2. Jar and httpcore-4.1 2.jar. Can someone help me with this?
Solution
I think you need to make commons codec use Base64 coding with httpclient This is a link Commons codec link
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码