简体   繁体   English

JNDI API如何运作

[英]JNDI API how it works

Let we have use JNDI API. 让我们使用JNDI API。 We trying to connect to te directory server: 我们尝试连接到te目录服务器:

Hashtable<String, Object> env = new Hashtable<String, Object>();
env.put(Context.PROVIDER_URL, "ldap://ldap.wiz.com:389");
env.put(Context.SECURITY_PRINCIPAL, "joeuser");
env.put(Context.SECURITY_CREDENTIALS, "joepassword");
env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial");

how it works when application execute? 应用程序执行时如何工作? For what needs SPI ? SPI需要什么? As i understand, client-side JNDI-based application sent request to directory server, whose use specific SPI. 据我了解,基于JNDI的客户端应用程序向目录服务器发送了请求,该服务器使用特定的SPI。 This SPI parse the request from client and responded. 此SPI解析来自客户端的请求并作出响应。 Thus SPI works like servlets in Java EE. 因此,SPI就像Java EE中的servlet一样工作。 Is my understandig right? 我的理解正确吗?

how it works when application execute? 应用程序执行时如何工作?

JNDI finds a JNDI SPI appropriate to the Context.PROVIDER_URL you specify: in this case, the LDAP provider. JNDI找到适合您指定的Context.PROVIDER_URL的JNDI SPI:在这种情况下,是LDAP提供程序。

For what needs SPI? SPI需要什么?

See above. 往上看。

As i understand, client-side JNDI-based application sent request to directory server 据我了解,基于JNDI的客户端应用程序向目录服务器发送了请求

Stop right there. 停在那儿。 The client sends a request to JNDI, which sends it to the JNDI SPI, which sends it to the directory server 客户端将请求发送到JNDI,JNDI将请求发送到JNDI SPI,后者将其发送到目录服务器

whose use specific SPI. 其使用特定的SPI。

No. See above. 否。请参见上文。 The directory server doesn't know anything about the JNDI SPI. 目录服务器对JNDI SPI一无所知。

This SPI parse the request from client and responded. 此SPI解析来自客户端的请求并作出响应。

No. The directory server did that. 否。目录服务器执行了该操作。

Thus SPI works like servlets in Java EE. 因此,SPI就像Java EE中的servlet一样工作。

No. 没有。

Is my understandig right? 我的理解正确吗?

No. 没有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM