如何在加载课程时告诉参考路径?(How do you tell the reference path when loading a class?)

我正在尝试使用JavaLoader将java( HttpAsyncClient )类加载到ColdFusion中。

client = loader.create("org.apache.commons.HttpAsyncClient")

我们怎么知道org.apache.commons.HttpAsyncClient的引用? 我想如果你打开jar文件并按照目录结构,它会给你参考路径。 但我不认为这是真的。

我正在尝试使用HttpAsyncClient但我无法加载它:

client = loader.create("org.apache.commons.HttpAsyncClient")返回一个未找到类的错误。

Loader是对JavaLoader的引用,它将Java类加载到CF服务器中。

I'm trying to use JavaLoader to load a java (HttpAsyncClient) class into ColdFusion.

client = loader.create("org.apache.commons.HttpAsyncClient")

How do we know the reference that is org.apache.commons.HttpAsyncClient? I thought if you open the jar file and follow the directory structure, it will give you the reference path. But I don't think this is true.

I'm trying to use the HttpAsyncClient but I'm unable to load it:

client = loader.create("org.apache.commons.HttpAsyncClient") returns a class not found error.

Loader is a reference to JavaLoader, which loads Java classes into your CF server.

最满意答案

为什么不尝试像Mark Mandel的AsyncHTTP库那样的现有工具,而不是重新发明轮子?

更新:从评论中,该工具仅限ACF。 因此,您可以尝试使用异步HTTP Exchange示例中显示的具体类DefaultHttpAsyncClient 。

Rather than reinvent the wheel, why not try an existing tool like Mark Mandel's AsyncHTTP library?

Update: From the comments, that tool is ACF only. So you might try using the concrete class DefaultHttpAsyncClient as shown in the Asynchronous HTTP Exchange example.

更多推荐