| 1 | /* | |
| 2 | * Copyright (c) 2015 Maxim Yunusov | |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 | * you may not use this file except in compliance with the License. | |
| 5 | * You may obtain a copy of the License at | |
| 6 | * | |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 | * | |
| 9 | * Unless required by applicable law or agreed to in writing, software | |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 | * See the License for the specific language governing permissions and | |
| 13 | * limitations under the License. | |
| 14 | */ | |
| 15 | ||
| 16 | package org.maxur.perfmodel.backend.rest; | |
| 17 | ||
| 18 | import org.glassfish.jersey.ServiceLocatorProvider; | |
| 19 | import org.glassfish.jersey.jackson.JacksonFeature; | |
| 20 | import org.glassfish.jersey.server.ResourceConfig; | |
| 21 | ||
| 22 | import javax.ws.rs.core.Feature; | |
| 23 | import javax.ws.rs.core.FeatureContext; | |
| 24 | ||
| 25 | /** | |
| 26 | * Rest Service Configuration | |
| 27 | * | |
| 28 | * @author myunusov | |
| 29 | * @version 1.0 | |
| 30 | * @since <pre>30.08.2015</pre> | |
| 31 | */ | |
| 32 | public class RestServiceConfig extends ResourceConfig { | |
| 33 | ||
| 34 | public RestServiceConfig() { | |
| 35 | packages("org.maxur.perfmodel.backend.rest.resources"); | |
| 36 | register(JacksonFeature.class); | |
| 37 | register(PmcObjectMapperProvider.class); | |
| 38 | register(RuntimeExceptionHandler.class); | |
| 39 | register(new ServiceLocatorFeature()); | |
| 40 | } | |
| 41 | ||
| 42 | static class ServiceLocatorFeature implements Feature { | |
| 43 | ||
| 44 | @Override | |
| 45 | public boolean configure(FeatureContext context) { | |
| 46 | ServiceLocatorProvider.getServiceLocator(context); | |
| 47 |
1
1. configure : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
| 48 | } | |
| 49 | } | |
| 50 | ||
| 51 | } | |
Mutations | ||
| 47 |
1.1 |