Merge changes from topics "VID-30", "VID-37"
[vid.git] / vid-app-common / src / main / java / org / onap / vid / client / HttpBasicClient.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.vid.client;
22
23
24 import javax.servlet.ServletContext;
25 import javax.ws.rs.client.Client;
26 import javax.ws.rs.client.ClientBuilder;
27 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
28 import org.springframework.beans.factory.annotation.Autowired;
29
30 /**
31  *  General HTTP client.
32  */
33
34 public class HttpBasicClient{
35         
36         /** The servlet context. */
37         @Autowired 
38         private ServletContext servletContext;
39         
40         /** The logger. */
41         EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HttpBasicClient.class);
42         
43         /**
44          * Obtain a basic HTTP client .
45          *
46          * @return Client client object
47          * @throws Exception the exception
48          */
49         public static Client getClient() {
50                 
51                 return ClientBuilder
52                         .newClient()
53                         .register(org.onap.vid.aai.util.CustomJacksonJaxBJsonProvider.class);
54         }       
55 }