52fd8fb1034a23e9dcf3427b38cc444d3bf66520
[so.git] / adapters / mso-vfc-adapter / src / main / java / org / onap / so / adapters / vfc / rest / HealthCheckHandler.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
6  * ================================================================================
7  * Modifications Copyright (c) 2019 Samsung
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.so.adapters.vfc.rest;
24
25 import javax.ws.rs.HEAD;
26 import javax.ws.rs.Path;
27 import javax.ws.rs.Produces;
28 import javax.ws.rs.QueryParam;
29 import javax.ws.rs.core.Response;
30
31 import org.apache.http.HttpStatus;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
34 import org.springframework.stereotype.Component;
35
36 /**
37  * Health Check
38  * <br>
39  * <p>
40  * </p>
41  * 
42  * @author
43  * @version     ONAP Amsterdam Release  2017-08-28
44  */
45 @Path("/")
46 @Component
47 public class HealthCheckHandler {
48
49     private static Logger logger = LoggerFactory.getLogger(HealthCheckHandler.class);
50
51     
52     private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
53
54         public static final Response HEALTH_CHECK_RESPONSE = Response.status (HttpStatus.SC_OK)
55             .entity (CHECK_HTML)
56             .build ();
57
58     @HEAD
59     @Path("/healthcheck")
60     @Produces("text/html")
61     public Response healthcheck(@QueryParam("requestId") String requestId) {
62         return HEALTH_CHECK_RESPONSE;
63     }
64
65 }