我有一个字符串extension_user和一个代码eaba848f6a9240f3ba5a5241a317ecc8
我正在编写一个java代码来附加extension_eaba848f6a9240f3ba5a5241a317ecc8_user。
我正在使用正则表达式从字符串中断开 extension_ 并附加代码和其余部分,或者还有其他方法吗?
public static void main(String []args){
String code = "eaba848f6a9240f3ba5a5241a317ecc8";
String value = "extension_user";
for (String retval: value.split("extension_")) {
System.out.println(retval);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试实现 GraphClient,下面是一个运行良好的示例代码...
ClientCredentialProvider authProvider =
new ClientCredentialProvider(clientId,
scopes,
clientSecret,
b2cTenant,
endpoint);
IGraphServiceClient graphClient = graphClient = GraphServiceClient.builder()
.authenticationProvider(authProvider)
.buildClient();
Run Code Online (Sandbox Code Playgroud)
这工作正常......但在某些情况下,从运行代码的地方,有一个代理,所以我需要设置代理来连接到互联网。我需要设置代理并将其传递给 graphClient 以某种方式告诉通过代理进行调用。
我试图找到一份文件,但找不到任何文件,我得到了这个......
ProxyOptions proxyOptions = new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress(proxyUrl, proxyPort));
proxyOptions.setCredentials(proxyUser, proxyPassword);
final UsernamePasswordCredential usernamePasswordCredential = new UsernamePasswordCredentialBuilder()
.clientId(clientId)
.username(username)
.password(password)
.httpClient(HttpClient.createDefault(new HttpClientOptions().setProxyOptions(proxyOptions)))
.build();
Run Code Online (Sandbox Code Playgroud)
但问题是“ProxyOptions”不在 Maven 中,我不确定它属于哪个库。
任何人都可以提出一个想法。
java proxy azure-ad-graph-api azure-ad-b2c microsoft-graph-api