Merge "Do not overwrite requestId"
[so.git] / mso-api-handlers / mso-api-handler-infra / src / main / java / org / onap / so / apihandlerinfra / JerseyConfiguration.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 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.so.apihandlerinfra;
22
23 import javax.annotation.PostConstruct;
24 import javax.ws.rs.ApplicationPath;
25
26 import org.glassfish.jersey.server.ResourceConfig;
27 import org.glassfish.jersey.servlet.ServletProperties;
28 import org.onap.so.apihandler.filters.RequestUriFilter;
29 import org.onap.so.apihandler.filters.RequestIdFilter;
30 import org.onap.so.apihandlerinfra.exceptions.ApiExceptionMapper;
31 import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestration;
32 import org.onap.so.apihandlerinfra.tenantisolation.CloudResourcesOrchestration;
33 import org.onap.so.apihandlerinfra.tenantisolation.ModelDistributionRequest;
34 import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
35 import org.onap.so.web.exceptions.RuntimeExceptionMapper;
36 import org.springframework.context.annotation.Configuration;
37
38 import io.swagger.jaxrs.config.BeanConfig;
39 import io.swagger.jaxrs.listing.ApiListingResource;
40 import io.swagger.jaxrs.listing.SwaggerSerializers;
41
42 @Configuration
43 @ApplicationPath("/")
44 public class JerseyConfiguration extends ResourceConfig {
45
46
47
48         @PostConstruct
49         public void setUp() {
50                 register(GlobalHealthcheckHandler.class);               
51                 register(NodeHealthcheckHandler.class);
52                 register(ServiceInstances.class);
53                 register(TasksHandler.class);
54                 register(CloudOrchestration.class);
55                 register(CloudResourcesOrchestration.class);
56                 register(OrchestrationRequests.class);          
57                 register(JaxRsFilterLogging.class);
58                 register(ManualTasks.class);
59                 register(TasksHandler.class);
60                 register(ApiListingResource.class);
61                 register(SwaggerSerializers.class);
62                 register(ApiExceptionMapper.class);
63                 register(RuntimeExceptionMapper.class);
64                 register(RequestUriFilter.class);
65                 register(RequestIdFilter.class);
66                 register(E2EServiceInstances.class);
67                 register(WorkflowSpecificationsHandler.class);
68                 register(InstanceManagement.class);
69                 // this registration seems to be needed to get predictable
70                 // execution behavior for the above JSON Exception Mappers
71                 register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class);
72                 register(ModelDistributionRequest.class);
73                 property(ServletProperties.FILTER_FORWARD_ON_404, true);
74                 BeanConfig beanConfig = new BeanConfig();
75                 beanConfig.setVersion("1.0.2");
76                 beanConfig.setSchemes(new String[] { "https" });
77                 beanConfig.setResourcePackage("org.onap.so.apihandlerinfra");
78                 beanConfig.setPrettyPrint(true);
79                 beanConfig.setScan(true);
80         }
81
82 }