+++ /dev/null
-/*-\r
- * ============LICENSE_START=======================================================\r
- * Copyright (C) 2020 Nordix Foundation. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- * SPDX-License-Identifier: Apache-2.0\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.onap.cps.rest.config;\r
-\r
-import io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder;\r
-import io.swagger.v3.jaxrs2.integration.resources.AcceptHeaderOpenApiResource;\r
-import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;\r
-import io.swagger.v3.oas.integration.OpenApiConfigurationException;\r
-import javax.annotation.PostConstruct;\r
-import javax.ws.rs.ApplicationPath;\r
-import org.glassfish.jersey.media.multipart.MultiPartFeature;\r
-import org.glassfish.jersey.server.ResourceConfig;\r
-import org.glassfish.jersey.servlet.ServletProperties;\r
-import org.onap.cps.rest.controller.ModelController;\r
-import org.onap.cps.rest.controller.RestController;\r
-import org.springframework.context.annotation.Configuration;\r
-\r
-@Configuration\r
-@ApplicationPath("api")\r
-public class JerseyConfig extends ResourceConfig {\r
-\r
- /**\r
- * This method is used to setup Jersey related configuration.\r
- */\r
- @PostConstruct\r
- public void init() {\r
- register(MultiPartFeature.class);\r
- register(OpenApiResource.class);\r
- register(AcceptHeaderOpenApiResource.class);\r
-\r
- // Register controllers\r
- register(ModelController.class);\r
- register(RestController.class);\r
-\r
- configureSwagger();\r
- configureSwaggerUI();\r
- }\r
-\r
- private void configureSwagger() {\r
- try {\r
- new JaxrsOpenApiContextBuilder<>().buildContext(true).read();\r
- } catch (final OpenApiConfigurationException e) {\r
- throw new RuntimeException(e.getMessage(), e);\r
- }\r
- }\r
-\r
- private void configureSwaggerUI() {\r
- // Enable Jersey filter forwarding to next filter for 404 responses.\r
- // This configuration lets Jersey servlet container forwarding static swagger ui requests to spring mvc filter\r
- // to be handle by spring mvc dispatcher servlet.\r
- property(ServletProperties.FILTER_FORWARD_ON_404, true);\r
- }\r
-\r
-}\r