diff options
author | kaixiliu <liukaixi@chinamobile.com> | 2023-05-09 16:56:32 +0800 |
---|---|---|
committer | kaixiliu <liukaixi@chinamobile.com> | 2023-05-09 16:56:57 +0800 |
commit | 649af3826678c25a3bd21ee84adb14ed9fe775a8 (patch) | |
tree | d7654c5242e070c9953a3b1151d31bfdcaf5345e /intentanalysis/src/main/java/org/onap | |
parent | d98c1acefe136b31d9bb3af3a92c592399b377f6 (diff) |
Enable uui-intent-analysis support Http requests
Issue-ID: USECASEUI-808
Signed-off-by: kaixiliu <liukaixi@chinamobile.com>
Change-Id: Ia1abf56601d5f09bbafe5b2fd4cbe49b1dcd10e0
Diffstat (limited to 'intentanalysis/src/main/java/org/onap')
-rw-r--r-- | intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/RestfulServices.java | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/RestfulServices.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/RestfulServices.java index a9755bc..c922095 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/RestfulServices.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/RestfulServices.java @@ -49,27 +49,21 @@ public class RestfulServices { public static <T> T create(String baseUrl, Class<T> clazz) { Retrofit retrofit = new Retrofit.Builder().baseUrl(baseUrl) - .addConverterFactory(JacksonConverterFactory.create()).build(); + .addConverterFactory(JacksonConverterFactory.create()).build(); return retrofit.create(clazz); } public static <T> T create(Class<T> clazz, final String userName, final String passWord) { //Set the interface response time - OkHttpClient okHttpClient = new OkHttpClient.Builder().authenticator(new Authenticator() { - @Nullable - @Override - public Request authenticate(@Nullable Route route, Response response) throws IOException { - String authStr = Credentials.basic(userName, passWord); - return response.request().newBuilder().addHeader("Authorization", authStr).build(); - } - }).connectTimeout(300, TimeUnit.SECONDS).readTimeout(300, TimeUnit.SECONDS) - .sslSocketFactory(getSSLSocketFactory(), new CustomTrustManager()).hostnameVerifier(getHostnameVerifier()) - .build(); + OkHttpClient okHttpClient = new OkHttpClient.Builder() + .connectTimeout(300, TimeUnit.SECONDS) + .readTimeout(300, TimeUnit.SECONDS) + .build(); String msbUrl = getMSBIAGAddress(); - Retrofit retrofit = new Retrofit.Builder().baseUrl("https://" + msbUrl + "/").client(okHttpClient) - .addConverterFactory(JacksonConverterFactory.create()).build(); + Retrofit retrofit = new Retrofit.Builder().baseUrl("http://" + msbUrl + "/").client(okHttpClient) + .addConverterFactory(JacksonConverterFactory.create()).build(); return retrofit.create(clazz); } |