0
我正在寻找一种方法以编程方式设置一个HTTP适配器的凭据? 是某人有一个例子吗?编程修改工作灯适配器凭证
是否可以修改适配器实现js来覆盖凭据?
的东西,如:
function getMyAdapters(path) {
var tok = "myuser:mypw";
var hash = Base64Encoder.encode(tok);
var headers="{'User-Agent':'Mozilla'"+"Authentication: Basic }"+hash;
var input = {
method : 'get',
returnedContentType : 'json',
headers: headers,
path : path
};
return WL.Server.invokeHttp(input);
}
但失败了,因为它没有找到Base64Encoder。
任何想法? http://en.wikipedia.org/wiki/Basic_access_authentication
此外,你应该做到以下几点:
感谢您它帮助我理解我的错误;-) – ITDoVe 2013-03-14 15:24:23
很高兴我能帮忙。作为回答请注明这个问题。 – 2013-03-14 16:52:02
最后,我在这里http://stackoverflow.com/questions/15432608/change-http-url-in-worklight-adapter实施的方法,让我也提供REST式API的URL。 – ITDoVe 2013-03-17 13:39:11