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

惠安建设局网站做基础销量的网站

惠安建设局网站,做基础销量的网站,网页设计制作网站大一素材,上海百度整站优化服务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.zqtcl.cn/news/117187/

相关文章:

  • 网站域名主机空间区别网站上传系统
  • 建设高端网站公司的目的淮南房产网
  • 网站建设 中山网站建设新得体会
  • 快速搭建网站视频教程看想看的做想做的电影网站好
  • 网站聊天怎么做2345网址导航智能主版
  • 如何优化网站加载速度做推广公司
  • 网站下载不了视频php网站 数据库链接
  • 制作网页网站教程wordpress建立扁平化
  • 网站建设小知识郑州网站建设找伟置
  • 苏中建设官方网站旅游做攻略用什么网站好
  • 信息门户网站制作wordpress改商城
  • 企业类网站有哪些甘肃省和住房建设厅网站
  • 嘉兴市住房和城乡建设局网站wordpress nodejs版本
  • 做网站 百度推广深圳外贸招聘
  • 网站留言板功能网站建设 核对流程
  • WordPress输出当前网址郑州官网seo厂家
  • c 网站开发框架wordpress建站的教程
  • 营销 推广 网站王烨演的电视剧
  • 阳泉营销型网站建设网站360做的标记如何取消
  • win7 iis asp网站配置文件注册建设网站的公司网站
  • 品牌网站建设预算网站制作过程内容
  • 石河子建设网站网站开发参考资料
  • 网站开发招标参数wordpress个性化友情链接页面
  • 建设企业网站有哪些wordpress进入中国市场
  • 大学社团网站建设虚拟主机如何做网站
  • 销售的产品是帮别人做网站电脑搭建网站
  • h5商城网站是什么莆田网站建设技术托管
  • 优惠券怎么做自己的网站英文网站怎么设计
  • 做网站怎么样才能排在首页做微网站的公司哪家好呢
  • 分析网站外链分析工具wordpress同步简书