本文整理了Java中io.sphere.sdk.http.HttpClient.getUserAgent()
方法的一些代码示例,展示了HttpClient.getUserAgent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.getUserAgent()
方法的具体详情如下:
包路径:io.sphere.sdk.http.HttpClient
类名称:HttpClient
方法名:getUserAgent
暂无
代码示例来源:origin: commercetools/commercetools-jvm-sdk
@Nullable
@Override
public String getUserAgent() {
return delegate.getUserAgent();
}
代码示例来源:origin: commercetools/commercetools-jvm-sdk
@Nullable
@Override
public String getUserAgent() {
return httpClient.getUserAgent();
}
代码示例来源:origin: commercetools/commercetools-jvm-sdk
private static String userAgent(final HttpClient httpClient) {
final String template = "${sdkLikeGitHubRepo}/${sdkVersion} (${underlyingHttpClient}) ${runtime}/${runtimeVersion} (${optionalOs}; ${optionalOsarch}) ${solutionInfos}";
final Map<String, String> values = new HashMap<>();
values.put("sdkLikeGitHubRepo", "commercetools-jvm-sdk");
values.put("sdkVersion", BuildInfo.version());
final String underlyingHttpClient = Optional.ofNullable(httpClient.getUserAgent()).orElse("unknown/" + BuildInfo.version());
values.put("underlyingHttpClient", underlyingHttpClient);
values.put("runtime", "Java");
values.put("runtimeVersion", SystemUtils.JAVA_RUNTIME_VERSION);
values.put("optionalOs", SystemUtils.OS_NAME);
values.put("optionalOsarch", SystemUtils.OS_ARCH);
values.put("solutionInfos", getSolutionInfoString());
return new StrSubstitutor(values).replace(template).trim();
}
代码示例来源:origin: com.commercetools.sdk.jvm.core/commercetools-java-client-core
private static String userAgent(final HttpClient httpClient) {
final String template = "${sdkLikeGitHubRepo}/${sdkVersion} (${underlyingHttpClient}) ${runtime}/${runtimeVersion} (${optionalOs}; ${optionalOsarch}) ${solutionInfos}";
final Map<String, String> values = new HashMap<>();
values.put("sdkLikeGitHubRepo", "commercetools-jvm-sdk");
values.put("sdkVersion", BuildInfo.version());
final String underlyingHttpClient = Optional.ofNullable(httpClient.getUserAgent()).orElse("unknown/" + BuildInfo.version());
values.put("underlyingHttpClient", underlyingHttpClient);
values.put("runtime", "Java");
values.put("runtimeVersion", SystemUtils.JAVA_RUNTIME_VERSION);
values.put("optionalOs", SystemUtils.OS_NAME);
values.put("optionalOsarch", SystemUtils.OS_ARCH);
values.put("solutionInfos", getSolutionInfoString());
return new StrSubstitutor(values).replace(template).trim();
}
代码示例来源:origin: commercetools/commercetools-jvm-sdk
@Test
public final void userAgent() throws Exception {
try (final HttpClient client = createClient()) {
assertThat(client.getUserAgent()).matches("\\S+/\\S+");
}
}
代码示例来源:origin: commercetools/commercetools-jvm-sdk
when(sphereApiConfig.getProjectKey()).thenReturn(projectKey);
when(sphereApiConfig.getApiUrl()).thenReturn("http://api.commercetools.de");
when(httpClient.getUserAgent()).thenReturn("user-agent");
when(sphereAccessTokenSupplier.get()).thenReturn(CompletableFutureUtils.successful("token"));
内容来源于网络,如有侵权,请联系作者删除!