Merge branch 'Feature/Add_Rest_Api_with_Java_client' of https://github.com/bsinno/hawkbit.git into Feature/Add_Rest_Api_with_Java_client

Conflicts:
	hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/web/ResourceControllerAutoConfiguration.java


Signed-off-by: Jonathan Philip Knoblauch <JonathanPhilip.Knoblauch@bosch-si.com>
This commit is contained in:
Jonathan Philip Knoblauch
2016-04-22 18:19:20 +02:00
9 changed files with 209 additions and 18 deletions

View File

@@ -71,6 +71,11 @@
<artifactId>feign-jackson</artifactId>
<version>8.14.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<artifactId>hibernate-validator</artifactId>
<groupId>org.hibernate</groupId>

View File

@@ -19,6 +19,10 @@ import org.eclipse.hawkbit.mgmt.client.resource.MgmtSoftwareModuleTypeClientReso
import org.eclipse.hawkbit.mgmt.client.resource.MgmtTargetClientResource;
import org.eclipse.hawkbit.mgmt.client.resource.MgmtTargetTagClientResource;
import org.springframework.cloud.netflix.feign.support.ResponseEntityDecoder;
import org.springframework.hateoas.hal.Jackson2HalModule;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import feign.Feign;
import feign.Feign.Builder;
@@ -47,10 +51,14 @@ public class MgmtDefaultFeignClient {
private final String baseUrl;
public MgmtDefaultFeignClient(final String baseUrl) {
final ObjectMapper mapper = new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.registerModule(new Jackson2HalModule());
feignBuilder = Feign.builder().contract(new IgnoreMultipleConsumersProducersSpringMvcContract())
.requestInterceptor(new ApplicationJsonRequestHeaderInterceptor()).logLevel(Level.FULL)
.logger(new Logger.ErrorLogger()).encoder(new JacksonEncoder())
.decoder(new ResponseEntityDecoder(new JacksonDecoder()));
.decoder(new ResponseEntityDecoder(new JacksonDecoder(mapper)));
this.baseUrl = baseUrl;
}
@@ -93,7 +101,7 @@ public class MgmtDefaultFeignClient {
public MgmtSoftwareModuleClientResource getMgmtSoftwareModuleClientResource() {
if (mgmtSoftwareModuleClientResource == null) {
mgmtSoftwareModuleClientResource = feignBuilder.target(MgmtSoftwareModuleClientResource.class,
MgmtSoftwareModuleClientResource.PATH);
this.baseUrl + MgmtSoftwareModuleClientResource.PATH);
}
return mgmtSoftwareModuleClientResource;
}