如何在jmeter中解码base 64格式?
问题内容:
有谁知道在JMeter中解码基本64格式字符串的解决方案?
我必须解码一个响应,但是我不想重新发明轮子…
我是否必须自己编写代码(不希望如此)?
谢谢
问题答案:
我当前的解决方案是:
import org.apache.commons.codec.binary.Base64;
log.info("Decoding base64 format");
String response = "b3JpZ2luYWwgU3RyaW5nIGJlZm9yZSBiYXNlNjQgZW5jb2RpbmcgaW4gSmF2YQ==";
byte[] decoded_response = Base64.decodeBase64(response);
log.info(new String(decoded_response));
该解决方案基于http://javarevisited.blogspot.pt/2012/02/how-to-encode-decode-string-
in-java.html
提供的解决方案。
编辑:检查Dmitri解决方案以获取更多详细信息。
谢谢