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