1 /* Copyright (c) 2019 AT&T Intellectual Property. #
\r
3 # Licensed under the Apache License, Version 2.0 (the "License"); #
\r
4 # you may not use this file except in compliance with the License. #
\r
5 # You may obtain a copy of the License at #
\r
7 # http://www.apache.org/licenses/LICENSE-2.0 #
\r
9 # Unless required by applicable law or agreed to in writing, software #
\r
10 # distributed under the License is distributed on an "AS IS" BASIS, #
\r
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
\r
12 # See the License for the specific language governing permissions and #
\r
13 # limitations under the License. #
\r
14 ##############################################################################*/
\r
17 package org.oran.otf.spring.configuration;
\r
19 import org.oran.otf.service.impl.DeleteProcessInstanceServiceImpl;
\r
20 import org.oran.otf.service.impl.DeleteTestDefinitionServiceImpl;
\r
21 import org.oran.otf.service.impl.DeveloperServiceImpl;
\r
22 import org.oran.otf.service.impl.HealthServiceImpl;
\r
23 import org.oran.otf.service.impl.ProcessInstanceCompletionServiceImpl;
\r
24 import org.oran.otf.service.impl.TestControlUnitServiceImpl;
\r
25 import org.oran.otf.service.impl.TestDefinitionDeploymentServiceImpl;
\r
27 import java.util.logging.Logger;
\r
28 import org.glassfish.jersey.logging.LoggingFeature;
\r
29 import org.glassfish.jersey.media.multipart.MultiPartFeature;
\r
30 import org.glassfish.jersey.server.ResourceConfig;
\r
31 import org.glassfish.jersey.server.ServerProperties;
\r
32 import org.glassfish.jersey.servlet.ServletContainer;
\r
33 import org.glassfish.jersey.servlet.ServletProperties;
\r
34 import org.springframework.boot.web.servlet.ServletRegistrationBean;
\r
35 import org.springframework.context.annotation.Bean;
\r
36 import org.springframework.context.annotation.Configuration;
\r
39 * Note: JerseyAutoConfiguration is used to incorporate camunda rest api In this configuration class
\r
40 * we create a new servletregistrationbean to serve at /service/* while camunda serves at /rest/*
\r
43 public class JerseyConfiguration {
\r
45 private static final Logger logger = Logger.getLogger(JerseyConfiguration.class.getName());
\r
48 public ServletRegistrationBean<ServletContainer> applicationJersey() {
\r
49 ServletRegistrationBean<ServletContainer> applicationJersey =
\r
50 new ServletRegistrationBean<>(new ServletContainer(new ApplicationJerseyConfig()));
\r
51 applicationJersey.addUrlMappings("/otf/*");
\r
52 applicationJersey.setName("Open Test Framework - Test Control Unit");
\r
53 applicationJersey.setLoadOnStartup(0);
\r
54 return applicationJersey;
\r
57 public class ApplicationJerseyConfig extends ResourceConfig {
\r
59 public ApplicationJerseyConfig() {
\r
60 register(MultiPartFeature.class);
\r
62 // new OTFLoggingFeature(
\r
63 // Logger.getLogger(getClass().getName()),
\r
65 // LoggingFeature.Verbosity.PAYLOAD_ANY,
\r
68 logger.info("Registering REST resources.");
\r
69 register(TestControlUnitServiceImpl.class);
\r
70 register(HealthServiceImpl.class);
\r
71 register(DeleteTestDefinitionServiceImpl.class);
\r
72 register(ProcessInstanceCompletionServiceImpl.class);
\r
73 register(TestDefinitionDeploymentServiceImpl.class);
\r
74 register(DeleteProcessInstanceServiceImpl.class);
\r
75 register(DeveloperServiceImpl.class);
\r
77 property(ServletProperties.FILTER_FORWARD_ON_404, true);
\r
78 property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, true);
\r
79 register(new LoggingFeature(logger));
\r
80 logger.info("Finished registering REST resources.");
\r