2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.ccsdk.apps.ms.neng.core;
23 import com.fasterxml.jackson.annotation.JsonInclude;
24 import com.fasterxml.jackson.databind.DeserializationFeature;
25 import com.fasterxml.jackson.databind.MapperFeature;
26 import com.fasterxml.jackson.databind.ObjectMapper;
27 import com.fasterxml.jackson.databind.SerializationFeature;
28 import javax.ws.rs.ApplicationPath;
29 import org.glassfish.jersey.server.ResourceConfig;
30 import org.glassfish.jersey.servlet.ServletProperties;
31 import org.onap.ccsdk.apps.ms.neng.core.service.rs.RestServiceImpl;
32 import org.springframework.beans.factory.annotation.Autowired;
33 import org.springframework.context.annotation.Bean;
34 import org.springframework.context.annotation.Primary;
35 import org.springframework.stereotype.Component;
38 * Configuration of the REST framework.
42 public class JerseyConfiguration extends ResourceConfig {
45 public JerseyConfiguration() {
46 register(RestServiceImpl.class);
47 property(ServletProperties.FILTER_FORWARD_ON_404, true);
51 * Builds the bean configuring Jackson for JSON serialization.
55 public ObjectMapper objectMapper() {
56 ObjectMapper objectMapper = new ObjectMapper();
57 objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
58 objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
59 objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES);
60 objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);