使用camunda modeler执行base64编码/解码时出错

raogr8fs  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(305)

在使用camunda将字符串转换为base64编码/解码时,出现以下错误。
错误:

Cannot instantiate process definition dciworkflow:1:f44c5806-2f38-11eb-9feb-0242ac15000e: Unable to evaluate script while executing activity 'Activity_nodetoken' in the process definition with id 'dciworkflow:1:f44c5806-2f38-11eb-9feb-0242ac15000e':<eval>:1:0 Expected an operand but found import\nimport java.util.Base64;\n^ in <eval> at line number 1 at column number 0

我在下面解释我的代码。

import java.util.Base64;
var header = new java.util.HashMap();
print(":::From node manager::");
var username = S(S(response).prop('data')).prop('username').value();
var password = S(S(response).prop('data')).prop('password').value();
print('user data', username, password);
byte[] actualByte= Base64.getDecoder().decode(password);
var enPass = new String(actualByte);
print('password', enPass);
var sample = username + ':' + enPass;
var base64 = Base64.getEncoder().encodeToString(sample.getBytes()); 
print('base64', base64);
header.put("Content-Type","application/json");
header.put("accept","application/json");
header.put("Authorization","Basic "+base64);
header;

这里我使用java类来实现base64 encode/decode 我的凭据来自字符串。我在里面用的这个代码 camunda modeler . 这里我需要将字符串转换为base64编码和解码。请帮我解决这个问题。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题