当前位置: 首页 > news >正文

洛阳市网站建设_网站建设公司_jQuery_seo优化

华为做网站,足球世界积分榜,上海公司网站seo,网站续费模版java实现ldap服务器本教程将向您展示如何编写Java代码以与LDAP交互。 但是在执行此操作之前#xff0c;我们需要在计算机上设置LDAP服务器和客户端。 如果此时您不确定到底是什么LDAP#xff0c;建议您使用这篇文章#xff0c;其中提供了一个很好的定义示例。 #xff08;… java实现ldap服务器 本教程将向您展示如何编写Java代码以与LDAP交互。 但是在执行此操作之前我们需要在计算机上设置LDAP服务器和客户端。 如果此时您不确定到底是什么LDAP建议您使用这篇文章其中提供了一个很好的定义示例。 简而言之将LDAP服务器视为专门的数据库很有帮助。 安装LDAP服务器 我在MBP上运行。 环顾了一会后我发现最容易安装的LDAP服务器是ApacheDirectory您可以从此处下载。 安装和启动服务器应少于5分钟 安装完成后它将自动启动守护程序。 然后您可以使用此命令运行服务器。 sudo launchctl start org.apache.directory.server 有关更多安装说明请参见此处 。 LDAP客户端 您将要查看LDAP服务器的内容。 最容易安装的LDAP客户端是Apache Directory Studio可以从此处下载。 下载完成后您需要创建与服务器的连接-有关说明请参见此处 。 连接后Apache Directory Studio应该如下所示 现在可以从Java程序访问LDAP。 向您展示如何执行此操作的最佳方法是通过示例程序。 该程序将执行以下任务 创建一个新的LDAP对象 查看LDAP对象 将新属性添加到LDAP对象 修改LDAP对象上的属性 删除LDAP对象上的属性 删除LDAP对象 注意此类将在其自身之后进行清除即它将LDAP服务器保持在其被发现的状态。 如果要查看正在执行的各种任务只需运行其中一项任务然后通过LDAP客户端查看LDAP对象。 不要忘记您可以在LDAP客户端中修改对象并进行测试。 package test;import java.util.Properties; import javax.naming.Context; import javax.naming.NamingException; import javax.naming.directory.*;public class LDAPTest {public void run() {try {DirContext context getContext();String name employeeNumber00001,ousystem;createLDAPObject(context, name);createAttribute(context, name, displayName, JOBS);viewAttribute(context, name, displayName);updateAttribute(context, name, displayName, STEVE);viewAttribute(context, name, displayName);removeAttribute(context, name, displayName);removeLDAPObject(context, name);} catch (NamingException e) {e.printStackTrace();}}private void removeLDAPObject(DirContext context, String name) throws NamingException {context.destroySubcontext(name);}private void createLDAPObject(DirContext context, String name) throws NamingException {Attributes attributes new BasicAttributes();Attribute attribute new BasicAttribute(objectClass);attribute.add(inetOrgPerson);attributes.put(attribute);Attribute sn new BasicAttribute(sn);sn.add(Steve);attributes.put(sn);Attribute cn new BasicAttribute(cn);cn.add(Jobs);attributes.put(cn);attributes.put(telephoneNumber, 123456);context.createSubcontext(name, attributes);}private void removeAttribute(DirContext context, String name , String attrName) throws NamingException {Attribute attribute new BasicAttribute(attrName);ModificationItem[] item new ModificationItem[1];item[0] new ModificationItem(DirContext.REMOVE_ATTRIBUTE, attribute);context.modifyAttributes(name, item);}private void createAttribute(DirContext context, String name , String attrName, Object attrValue) throws NamingException {Attribute attribute new BasicAttribute(attrName, attrValue);ModificationItem[] item new ModificationItem[1];item[0] new ModificationItem(DirContext.ADD_ATTRIBUTE, attribute);context.modifyAttributes(name, item);}private void updateAttribute(DirContext context, String name , String attrName, Object attrValue) throws NamingException {Attribute attribute new BasicAttribute(attrName, attrValue);ModificationItem[] item new ModificationItem[1];item[0] new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attribute);context.modifyAttributes(name, item);}private void viewAttribute(DirContext context, String name , String attrName) throws NamingException {Attributes attrs context.getAttributes(name);System.out.println(attrName : attrs.get(attrName).get());}private DirContext getContext() throws NamingException {Properties properties new Properties();properties.put(Context.INITIAL_CONTEXT_FACTORY,com.sun.jndi.ldap.LdapCtxFactory);properties.put(Context.PROVIDER_URL, ldap://localhost:10389);return new InitialDirContext(properties);}public static void main(String[] args) {new LDAPTest().run();} } 该代码在下面应该可以自我解释。 翻译自: https://www.javacodegeeks.com/2015/09/java-to-ldap-tutorial-including-how-to-install-an-ldap-server-client.htmljava实现ldap服务器
http://www.ihoyoo.com/news/61539.html

相关文章:

  • 本地生活网站建设免费个人网站注册
  • 网站数据报表网站平台建设是什么
  • 海南省建设注册中心网站网站建设管理属于职业资格吗
  • 网站内页标题城市建设灯具网站
  • 建设一个网站主要受哪些因素的影响会员登录wordpress
  • 自己免费做网站有什么用购物商城网站建设
  • 网站建设合同附加协议做网站生意买螃蟹
  • 大学生网站设计作品创建免费论坛的10个网站
  • 企业网站建设对网络营销有哪些影响工程机械网
  • 个人网站 百度收录wordpress 去掉版权
  • 长春网站建设模板制作北京网页设计机构
  • p网站建设二级域名需要备案吗
  • 做任务的网站有那些旅游类网站建设
  • 中力建设网站个人网站 建设
  • 建筑工程分为哪几类台州seo排名扣费
  • 做技术分享网站 盈利河南省公共资源交易中心
  • 网站服务内容怎么写北京平台网站建设报价
  • 如何做优秀的视频网站设计湛江做建站软仿
  • 响应式网站代码规范怎样查看网站服务商
  • 永久免费的ppt网站海沧网站建设
  • 站长平台验证网站东莞做网站公司首选
  • 怎么制作网站详细流程做网站模板
  • 搭建影视网站海外建站流程
  • 临海网站建设公司网页设计与制作实例教程第2版答案
  • 如何用PS制作网站首页用国外服务器做网站网站
  • 企业免费自助建站平台网站开发软件、
  • 基于dw的动物网站设计论文如何做com的网站
  • 企业网站建设教程视频廊坊企业网站团队
  • 福清市城乡建设局网站建筑人才网哪些
  • 瑞丽航空公司官方网站网站gzip压缩