Worklight http适配器问题 [英] Worklight http adapter questions

查看:166
本文介绍了Worklight http适配器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

2个简单问题:


  1. 所有http请求是否通过http适配器首先通过worklight服务器?

  1. Do all http requests make thru http adapter do go thru the worklight server first?

如果是这样,那么它是否意味着即使是对公共网站的http适配器请求说,向yahoo网站申请股票价格也会先通过worklight服务器然后雅虎网站旁边?如果是这样,那么如何在不通过worklight服务器的情况下发出http请求?我只想直接去雅虎网站而没有中间服务器(即workligth服务器)

If so then does it mean even a http adapter request to a public web site say a request to yahoo site for a stock price would also go thru worklight server first then next to the yahoo web site? If so then how do I make a http request without going thru the worklight server? I just want to go straight to yahoo web site without the "intermediate" server (i.e. workligth server)


推荐答案


1)所有http请求是否通过http适配器首先通过
worklight服务器?

1) Do all http requests make thru http adapter do go thru the worklight server first?

是的。 Worklight Adapters通过使用 Mozilla Rhino 在Worklight Server上执行JavaScript来工作。您可以在 IBM Worklight入门模块中阅读有关适配器的更多信息。有关适配器的详细信息,请参阅模块5和6 。您还可以尝试下一个代码示例。 API文档位于 IBM InfoCenter 中。还有一个 Developer Works文章,讨论了适用于您的适配器找不到。

Yes. Worklight Adapters work by executing JavaScript on the Worklight Server using Mozilla Rhino. You can read more about Adapters in the IBM Worklight Getting Started Modules. Look at Modules 5 and 6 for Adapter specific details. There are also code samples you can try next. The API documentation is in IBM InfoCenter. There is also a Developer Works article that talks about adapters that you may find helpful.


2)如果是这样的话,那就意味着即使是对公共网站的http适配器请求
网站也会提出请求到雅虎网站的股票价格也将通过
工作灯服务器首先然后在雅虎网站旁边?

2) If so then does it mean even a http adapter request to a public web site say a request to yahoo site for a stock price would also go thru worklight server first then next to the yahoo web site?

是。


我只是想直接进入雅虎网站而没有
中间服务器(即workligth服务器)

I just want to go straight to yahoo web site without the "intermediate" server (i.e. workligth server)

IBM Worklight附带jQuery,您可以使用 ajax方法。这是一个例子:

IBM Worklight ships with jQuery, you can use the ajax method. Here's an example:

WLJQ.ajax( "http://finance.yahoo.com/d/quotes.csv?s=DOW+MSFT+AAPL+GOOG&f=snl1" )
.done(function (data) {
    console.log(data);
});

请注意,WLJQ是Worklight提供的jQuery版本的命名空间。你可以使用 jQuery $ var $ = WLJQ; var jQuery = WLJQ;

Note that WLJQ is the namespace for the version of jQuery that Worklight ships. You can use jQuery or $ by doing: var $ = WLJQ; or var jQuery = WLJQ;.

你应该得到这样的东西:

You should get something like this back:

"DOW","Dow Chemical Comp",30.89
"MSFT","Microsoft Corpora",27.37
"AAPL","Apple Inc.",448.97
"GOOG","Google Inc.",790.13

这篇关于Worklight http适配器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆