user2953119
user2953119

Reputation:

JNDI API how it works

Let we have use JNDI API. We trying to connect to te directory server:

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? As i understand, client-side JNDI-based application sent request to directory server, whose use specific SPI. This SPI parse the request from client and responded. Thus SPI works like servlets in Java EE. Is my understandig right?

Upvotes: 1

Views: 211

Answers (1)

user207421
user207421

Reputation: 310913

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.

For what needs SPI?

See above.

As i understand, client-side JNDI-based application sent request to directory server

Stop right there. The client sends a request to JNDI, which sends it to the JNDI SPI, which sends it to the directory server

whose use specific SPI.

No. See above. The directory server doesn't know anything about the JNDI SPI.

This SPI parse the request from client and responded.

No. The directory server did that.

Thus SPI works like servlets in Java EE.

No.

Is my understandig right?

No.

Upvotes: 1

Related Questions