Skip to content

Commit e3cc623

Browse files
Verdentjansupol
authored andcommitted
Rest client update to version 1.4.1
Signed-off-by: David Kral <[email protected]>
1 parent 797b435 commit e3cc623

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

ext/microprofile/mp-rest-client/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
55
66
This program and the accompanying materials are made available under the
77
terms of the Eclipse Public License v. 2.0, which is available at
@@ -32,7 +32,7 @@
3232
<dependency>
3333
<groupId>org.eclipse.microprofile.rest.client</groupId>
3434
<artifactId>microprofile-rest-client-api</artifactId>
35-
<version>1.3.3</version>
35+
<version>1.4.1</version>
3636
</dependency>
3737
<dependency>
3838
<groupId>org.eclipse.microprofile.config</groupId>

ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/InterfaceModel.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2019 Payara Foundation and/or its affiliates. All rights reserved.
44
*
55
* This program and the accompanying materials are made available under the
@@ -24,10 +24,13 @@
2424
import java.util.List;
2525
import java.util.Optional;
2626
import java.util.Set;
27+
import java.util.logging.Level;
28+
import java.util.logging.Logger;
2729
import java.util.stream.Collectors;
2830

2931
import javax.enterprise.context.spi.CreationalContext;
3032
import javax.enterprise.inject.spi.BeanManager;
33+
import javax.enterprise.inject.spi.CDI;
3134
import javax.ws.rs.Consumes;
3235
import javax.ws.rs.Path;
3336
import javax.ws.rs.Produces;
@@ -56,6 +59,8 @@
5659
*/
5760
class InterfaceModel {
5861

62+
private static final Logger LOGGER = Logger.getLogger(InterfaceModel.class.getName());
63+
5964
private final InjectionManager injectionManager;
6065
private final Class<?> restClientClass;
6166
private final String[] produces;
@@ -336,9 +341,15 @@ Builder clientHeaders(ClientHeaderParam[] clientHeaderParams) {
336341
}
337342

338343
Builder clientHeadersFactory(RegisterClientHeaders registerClientHeaders) {
339-
clientHeadersFactory = registerClientHeaders != null
340-
? ReflectionUtil.createInstance(registerClientHeaders.value())
341-
: null;
344+
if (registerClientHeaders != null) {
345+
Class<? extends ClientHeadersFactory> value = registerClientHeaders.value();
346+
try {
347+
clientHeadersFactory = CDI.current().select(value).get();
348+
} catch (Exception ex) {
349+
LOGGER.log(Level.FINEST, ex, () -> "This class is not a CDI bean. " + value);
350+
clientHeadersFactory = ReflectionUtil.createInstance(value);
351+
}
352+
}
342353
return this;
343354
}
344355

tests/integration/microprofile/rest-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<dependency>
5656
<groupId>org.eclipse.microprofile.rest.client</groupId>
5757
<artifactId>microprofile-rest-client-tck</artifactId>
58-
<version>1.3.3</version>
58+
<version>1.4.1</version>
5959
<scope>test</scope>
6060
</dependency>
6161
<dependency>

0 commit comments

Comments
 (0)