我想知道如何为 Azure AD 中的来宾用户调用图形 API。我能够使用此处给出的 API 示例为内部用户实现它,但相同的调用不适用于来宾用户。需要提出请求的方式有什么不同吗?
我有一个RESTful Web服务,采用所有4种HTTP请求方法.当我使用休息客户端(Chrome中的Advanced Rest Client)使用计算机的IP地址向此服务发送请求时,我得到了正确的响应.我的网址是http:// ipaddress:8080/messenger/webapi/messages.但是,当我使用curl触发相同的请求时,我得到卷曲:(56)Recv失败:连接被重置.我在两者中发现的唯一区别是REST客户端从0.0.0.0触发请求,并且从127.0.0.1触发curl请求.但为什么这会有什么不同呢?
当应用程序在触发curl的同一台机器上运行时,相同的curl命令有效.仅当应用程序在另一台计算机上运行时,它才起作用.例如.curl http:// ipaddress:8080/messenger/webapi/messages for GET request.
我尝试在没有运气的应用程序的计算机上禁用防火墙.
我一直在学习Java中的泛型.虽然我理解有关类型推断,参数化类和方法的概念,但在实验时我遇到了一个奇怪的场景.
我已经实现了一个Box类,可用于保存类型为T的项.我使用List作为此抽象的内部数据结构.以下是我的代码:
public class Box<T> {
private List<T> items;
public Box(){
items = new ArrayList<>();
}
public <T> void addItemToBox(T t){
items.add(t);
}
}
Run Code Online (Sandbox Code Playgroud)
我在items.add(t)得到一个编译时错误,说List中的add(T)不能应用于(T).我无法弄清楚这个错误的原因.另外,我不明白为什么我不能将类型为T的项添加到由T参数化的列表中.
我需要向我的 LDAP 添加一个新的用户条目。以下是我的代码:
javax.naming.Name name = new DistinguishedName("cn=" + userName +",ou=Users,dc=wso2,dc=org");
Attribute objectClass = new BasicAttribute("objectClass");
{
objectClass.add("top");
objectClass.add("inetOrgPerson");
objectClass.add("person");
objectClass.add("organizationalPerson");
}
Attributes userAttributes = new BasicAttributes();
userAttributes.put(objectClass);
userAttributes.put("cn", userName);
userAttributes.put("sn", "abctest");
userAttributes.put(ATTRIBUTE_USER_PASSWORD, password);
LdapTemplate ldapTemplate = (LdapTemplate) SpringBeanFactory
.getBean("ldapTemplate");
ldapTemplate.bind(name, null, userAttributes);
Run Code Online (Sandbox Code Playgroud)
尽管执行这段代码时我得到以下异常:
org.apache.cxf.interceptor.Fault: [LDAP: error code 32 - No Such Object];
nested exception is javax.naming.NameNotFoundException:
[LDAP: error code 32 - No Such Object]; remaining name 'cn=myname,ou=Users,dc=wso2,dc=org'
Run Code Online (Sandbox Code Playgroud)
我遵循http://kaustuvmaji.blogspot.in/2014/12/simple-example-of-spring-ldap.html中指定的示例代码。有人可以帮助我理解此错误的根本原因或正确的代码。
我需要传递带有点('.')的字符串作为jquery选择器的一部分.即使在通过添加'\\'来转义点之后,没有任何jquery函数按预期工作.以下是代码:
var id = "www.google.com";
var vgid = id.replace(/\./g, '\\\\.'); //adding '\\' before dot to escape it
var flagged = $('#flagged_'+vgid).val(); // retrieving the value of a field NOT working
Run Code Online (Sandbox Code Playgroud)
上述操作不返回字段的值.但是,如果我使用转义字符对值进行硬编码,则会给出值.
var flagged = $('#flagged_www\\.google\\.com').val(); //this is working
Run Code Online (Sandbox Code Playgroud)