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

广 做网站蓝光电影下载太原网站建设托管

广 做网站蓝光电影下载,太原网站建设托管,wordpress给用户自动注册,网站仿站本教程将向您展示如何编写Java代码以与LDAP交互。 但是在执行此操作之前#xff0c;我们需要在计算机上设置LDAP服务器和客户端。 如果此时您不确定到底是什么LDAP#xff0c;建议您参考这篇文章#xff0c;其中提供了一个很好的定义示例。 #xff08;简而言之#xff0… 本教程将向您展示如何编写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 Server保留在其被发现的状态。 如果要查看正在执行的各种任务只需运行其中一项任务然后通过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.html
http://www.zqtcl.cn/news/65115/

相关文章:

  • 那个网站有免费模板永州市建设网站
  • 视频互动网站建设photoshop手机版免费破解版
  • 小企业网站建设的基础知识启迪网站建设
  • 广州市做民宿什么网站比较好惠州响应式网站哪家好
  • 佛山网站建设凤软开源 wordpress 主题
  • 微服务网站wordpress怎么用畅言
  • 做网站优化有什么方法设计网站推荐设计酷站
  • 网站开发 脚本怎么写vs设置网站开发环境
  • 舟山建设网站有哪些网站免费学习建设网站的
  • wordpress获取文章类别目录天津网站营销seo电话
  • ppt模板做的好的网站有哪些社交网站建站
  • 重庆网站建设子沃科技熊掌号南京有名的网站建设公司
  • 怎么做国际购物网站公司网站源码
  • 做阅读理解的网站百度搜索热词查询
  • 厦门seo公司网站上海网络推广专员招聘
  • 专注做一家男人最爱的网站中国廉洁建设网是什么正规网站吗
  • 网站建设资金方案seo积分优化
  • 加强网站建设的制度建设项目网站备案申请表
  • 网站建设的来源wordpress 主页修改
  • 丽水网站推广公司nginx wordpress 目录 伪静态
  • 网站优化客户报表长沙人才市场招聘信息
  • 牡丹江哈尔滨网站建设恢复原来的网站
  • 那个网站可免费做推广wordpress问答插件中文免费版
  • 浏览器无法打开住房和建设网站做网站建设赚钱吗
  • 网站站群建设进度网站管理员权限怎么设置
  • 做美团网站代码怎么推广自己的店铺
  • 网站制作的流程有哪些移动网站建设书
  • 有什么字体设计的网站用html能做企业网站吗
  • 平面设计网站有哪些比较好毕业设计餐饮网站建设
  • 鹤壁做网站公司哪家好实惠的制作网站