diff --git a/boms/bom/pom.xml b/boms/bom/pom.xml
index 2f41c07b..6353a8a4 100644
--- a/boms/bom/pom.xml
+++ b/boms/bom/pom.xml
@@ -18,11 +18,6 @@
2014
- UTF-8
- UTF-8
- 3.3.6
- 8.7.0
- 1.7.28
bom
@@ -73,7 +68,7 @@
javax.inject
1
-
javax.annotation
diff --git a/modules/cxf-client-rest/src/main/java/com/devonfw/module/cxf/common/impl/client/rest/RestServiceExceptionMapper.java b/modules/cxf-client-rest/src/main/java/com/devonfw/module/cxf/common/impl/client/rest/RestServiceExceptionMapper.java
index aa7711c8..a55fc8df 100644
--- a/modules/cxf-client-rest/src/main/java/com/devonfw/module/cxf/common/impl/client/rest/RestServiceExceptionMapper.java
+++ b/modules/cxf-client-rest/src/main/java/com/devonfw/module/cxf/common/impl/client/rest/RestServiceExceptionMapper.java
@@ -1,12 +1,20 @@
package com.devonfw.module.cxf.common.impl.client.rest;
+import java.lang.reflect.Method;
import java.net.URI;
+import java.util.Map;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
import org.apache.cxf.jaxrs.client.ResponseExceptionMapper;
+import org.apache.cxf.jaxrs.impl.ResponseImpl;
+import org.apache.cxf.jaxrs.model.OperationResourceInfo;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.ws.addressing.AttributedURIType;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
import com.devonfw.module.service.common.api.client.ServiceClientErrorFactory;
import com.devonfw.module.service.common.api.client.context.ServiceContext;
@@ -45,13 +53,83 @@ public Throwable fromResponse(Response response) {
String data = response.readEntity(String.class);
if ((data != null) && !data.isEmpty()) {
MediaType mediaType = response.getMediaType();
- URI url = response.getLocation();
- String operation = null;
- String serviceDetails = this.context.getServiceDescription(operation, url.toString());
+ String url = getUrl(response);
+ String operation = getOperation(response);
+ String serviceDetails = this.context.getServiceDescription(operation, url);
return this.errorUnmarshaller.unmarshall(data, mediaType.toString(), response.getStatus(), serviceDetails);
}
}
return null;
}
+ private String getOperation(Response response) {
+
+ if (response instanceof ResponseImpl) {
+ Message message = ((ResponseImpl) response).getOutMessage();
+ if (message != null) {
+ Object invocationContext = message.get(Message.INVOCATION_CONTEXT);
+ Object requestContext = getFromMap(invocationContext, "RequestContext");
+ OperationResourceInfo operation = getFromMap(requestContext, OperationResourceInfo.class);
+ if (operation != null) {
+ Method method = operation.getAnnotatedMethod();
+ if (method != null) {
+ return method.getName();
+ }
+ }
+ }
+ }
+ return "";
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static Object getFromMap(Object map, Object key) {
+
+ if (map instanceof Map) {
+ return ((Map) map).get(key);
+ }
+ return null;
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static T getFromMap(Object map, Class key) {
+
+ if (map instanceof Map) {
+ Object value = ((Map) map).get(key.getName());
+ if (value != null) {
+ try {
+ return key.cast(value);
+ } catch (Exception e) {
+ }
+ }
+ }
+ return null;
+ }
+
+ private String getUrl(Response response) {
+
+ URI url = response.getLocation();
+ if (url != null) {
+ return url.toString();
+ } else if (response instanceof ResponseImpl) {
+ Message message = ((ResponseImpl) response).getOutMessage();
+ if (message != null) {
+ Object uri = message.get(Message.REQUEST_URI);
+ if (uri instanceof String) {
+ return (String) uri;
+ }
+ Conduit conduit = message.get(Conduit.class);
+ if (conduit != null) {
+ EndpointReferenceType target = conduit.getTarget();
+ if (target != null) {
+ AttributedURIType address = target.getAddress();
+ if (address != null) {
+ return address.getValue();
+ }
+ }
+ }
+ }
+ }
+ return "";
+ }
+
}
diff --git a/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/logging/impl/MessageListenerLoggingAspect.java b/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/logging/impl/MessageListenerLoggingAspect.java
index 14b5bc68..1a4176ff 100644
--- a/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/logging/impl/MessageListenerLoggingAspect.java
+++ b/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/logging/impl/MessageListenerLoggingAspect.java
@@ -1,6 +1,6 @@
package com.devonfw.module.kafka.common.messaging.logging.impl;
-import static brave.internal.HexCodec.toLowerHex;
+import static brave.internal.codec.HexCodec.toLowerHex;
import java.lang.reflect.Method;
import java.time.Instant;
diff --git a/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/logging/impl/ProducerLoggingListener.java b/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/logging/impl/ProducerLoggingListener.java
index bb066a77..ebb7ce91 100644
--- a/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/logging/impl/ProducerLoggingListener.java
+++ b/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/logging/impl/ProducerLoggingListener.java
@@ -1,7 +1,6 @@
package com.devonfw.module.kafka.common.messaging.logging.impl;
-import java.util.Optional;
-
+import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -12,8 +11,6 @@
*
* @param The key type
* @param The value type
- *
- *
*/
public class ProducerLoggingListener implements ProducerListener {
@@ -32,23 +29,27 @@ public ProducerLoggingListener(MessageLoggingSupport loggingSupport) {
}
@Override
- public void onSuccess(String topic, Integer partition, Object key, Object value, RecordMetadata recordMetadata) {
+ public void onSuccess(ProducerRecord record, RecordMetadata recordMetadata) {
- String messageKey = (String) Optional.ofNullable(key).orElse("");
+ String messageKey = "";
+ K key = record.key();
+ if (key != null) {
+ messageKey = key.toString();
+ }
if (recordMetadata != null) {
this.loggingSupport.logMessageSent(LOG, messageKey, recordMetadata.topic(), recordMetadata.partition(),
recordMetadata.offset());
} else {
- this.loggingSupport.logMessageSent(LOG, messageKey, topic, partition, null);
+ this.loggingSupport.logMessageSent(LOG, messageKey, record.topic(), record.partition(), null);
}
}
@Override
- public void onError(String topic, Integer partition, Object key, Object value, Exception exception) {
+ public void onError(ProducerRecord record, RecordMetadata recordMetadata, Exception exception) {
- this.loggingSupport.logMessageNotSent(LOG, topic, partition,
+ this.loggingSupport.logMessageNotSent(LOG, record.topic(), record.partition(),
(exception != null ? exception.getLocalizedMessage() : "unknown"));
}
}
diff --git a/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/trace/impl/MessageSpanExtractor.java b/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/trace/impl/MessageSpanExtractor.java
index 9d863eba..c8ca82e3 100644
--- a/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/trace/impl/MessageSpanExtractor.java
+++ b/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/trace/impl/MessageSpanExtractor.java
@@ -1,6 +1,6 @@
package com.devonfw.module.kafka.common.messaging.trace.impl;
-import static brave.internal.HexCodec.lowerHexToUnsignedLong;
+import static brave.internal.codec.HexCodec.lowerHexToUnsignedLong;
import static com.devonfw.module.kafka.common.messaging.util.MessageUtil.getHeaderValue;
import java.util.Optional;
diff --git a/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/trace/impl/MessageSpanInjector.java b/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/trace/impl/MessageSpanInjector.java
index f63c763b..b924aa3b 100644
--- a/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/trace/impl/MessageSpanInjector.java
+++ b/modules/kafka/src/main/java/com/devonfw/module/kafka/common/messaging/trace/impl/MessageSpanInjector.java
@@ -1,6 +1,6 @@
package com.devonfw.module.kafka.common.messaging.trace.impl;
-import static brave.internal.HexCodec.toLowerHex;
+import static brave.internal.codec.HexCodec.toLowerHex;
import static com.devonfw.module.kafka.common.messaging.util.MessageUtil.addHeaderValue;
import java.util.Optional;
diff --git a/modules/kafka/src/test/java/com/devonfw/example/module/MessageRetryOperationsTest.java b/modules/kafka/src/test/java/com/devonfw/example/module/MessageRetryOperationsTest.java
index 6fef0344..077e0b39 100644
--- a/modules/kafka/src/test/java/com/devonfw/example/module/MessageRetryOperationsTest.java
+++ b/modules/kafka/src/test/java/com/devonfw/example/module/MessageRetryOperationsTest.java
@@ -1,9 +1,9 @@
package com.devonfw.example.module;
+import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
-import org.apache.commons.codec.Charsets;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.header.Headers;
@@ -40,10 +40,11 @@ public class MessageRetryOperationsTest extends AbstractKafkaBaseTest {
@Override
protected void doSetUp() {
- this.consumerRecord = new ConsumerRecord<>(AbstractKafkaBaseTest.RETRY_TEST_TOPIC, 0, 0, AbstractKafkaBaseTest.RETRY_TEST_TOPIC, "message");
+ this.consumerRecord = new ConsumerRecord<>(AbstractKafkaBaseTest.RETRY_TEST_TOPIC, 0, 0,
+ AbstractKafkaBaseTest.RETRY_TEST_TOPIC, "message");
Headers headers = this.consumerRecord.headers();
- headers.add(MessageRetryContext.RETRY_COUNT, "0".getBytes(Charsets.UTF_8));
- headers.add(MessageRetryContext.RETRY_STATE, "Pending".getBytes(Charsets.UTF_8));
+ headers.add(MessageRetryContext.RETRY_COUNT, "0".getBytes(StandardCharsets.UTF_8));
+ headers.add(MessageRetryContext.RETRY_STATE, "Pending".getBytes(StandardCharsets.UTF_8));
headers.add(MessageRetryContext.RETRY_NEXT, Instant.now().plus(1, ChronoUnit.MINUTES).toString().getBytes());
headers.add(MessageRetryContext.RETRY_UNTIL, Instant.now().toString().getBytes());
diff --git a/modules/service/src/main/java/com/devonfw/module/service/common/api/client/context/ServiceContext.java b/modules/service/src/main/java/com/devonfw/module/service/common/api/client/context/ServiceContext.java
index 885ec704..2d47d6f2 100644
--- a/modules/service/src/main/java/com/devonfw/module/service/common/api/client/context/ServiceContext.java
+++ b/modules/service/src/main/java/com/devonfw/module/service/common/api/client/context/ServiceContext.java
@@ -63,11 +63,11 @@ default String getServiceDescription(String operation) {
default String getServiceDescription(String operation, String url) {
StringBuilder sb = new StringBuilder(getApi().getName());
- if (operation != null) {
+ if ((operation != null) && !operation.isEmpty()) {
sb.append('#');
sb.append(operation);
}
- if (url != null) {
+ if ((url != null) && !url.isEmpty()) {
sb.append('[');
sb.append(url);
sb.append(']');
diff --git a/pom.xml b/pom.xml
index cf6cb010..edc85f18 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,13 +28,15 @@
-SNAPSHOT
devon4j
${revision}${changelist}
- 2.3.3.RELEASE
+ 2.4.0
- Greenwich.SR6
+ 2020.0.0
2.11.2
- 28.1-jre
- 5.6.1
-
+ 30.0-jre
+ 5.7.0
+ 3.4.1
+ 8.7.0
+ 1.7.30
diff --git a/starters/starter-cxf-client-rest/src/test/java/com/devonfw/module/cxf/common/impl/client/rest/CxfRestClientTest.java b/starters/starter-cxf-client-rest/src/test/java/com/devonfw/module/cxf/common/impl/client/rest/CxfRestClientTest.java
index e88a9ad2..67bec535 100644
--- a/starters/starter-cxf-client-rest/src/test/java/com/devonfw/module/cxf/common/impl/client/rest/CxfRestClientTest.java
+++ b/starters/starter-cxf-client-rest/src/test/java/com/devonfw/module/cxf/common/impl/client/rest/CxfRestClientTest.java
@@ -58,7 +58,7 @@ public void testBusinessError() {
failBecauseExceptionWasNotThrown(ServiceInvocationFailedException.class);
} catch (ServiceInvocationFailedException e) {
assertThat(e.getNlsMessage().getMessage()).matches(
- "While invoking the service com\\.devonfw\\.test\\.app\\.myexample\\.service\\.api\\.rest\\.MyExampleRestService\\[http://localhost:[0-9]+/app/services/rest/my-example/v1/business-error\\] the following error occurred: Test of business error.* Probably the service is temporary unavailable\\. Please try again later\\. If the problem persists contact your system administrator\\.");
+ "While invoking the service com\\.devonfw\\.test\\.app\\.myexample\\.service\\.api\\.rest\\.MyExampleRestService#businessError\\[http://localhost:[0-9]+/app/services/rest/my-example/v1/business-error\\] the following error occurred: Test of business error.* Probably the service is temporary unavailable\\. Please try again later\\. If the problem persists contact your system administrator\\.");
assertThat(e.getCode()).isEqualTo(MyBusinessException.CODE);
assertThat(e.isForUser()).isTrue();
assertThat(e.isTechnical()).isTrue();
@@ -82,7 +82,7 @@ public void testTechnicalError() {
failBecauseExceptionWasNotThrown(ServiceInvocationFailedException.class);
} catch (ServiceInvocationFailedException e) {
assertThat(e.getNlsMessage().getMessage()).matches(
- "While invoking the service com\\.devonfw\\.test\\.app\\.myexample\\.service\\.api\\.rest\\.MyExampleRestService\\[http://localhost:[0-9]+/app/services/rest/my-example/v1/technical-error\\] the following error occurred: An unexpected error has occurred! We apologize any inconvenience\\. Please try again later\\..* Probably the service is temporary unavailable\\. Please try again later\\. If the problem persists contact your system administrator\\.");
+ "While invoking the service com\\.devonfw\\.test\\.app\\.myexample\\.service\\.api\\.rest\\.MyExampleRestService#technicalError\\[http://localhost:[0-9]+/app/services/rest/my-example/v1/technical-error\\] the following error occurred: An unexpected error has occurred! We apologize any inconvenience\\. Please try again later\\..* Probably the service is temporary unavailable\\. Please try again later\\. If the problem persists contact your system administrator\\.");
assertThat(e.getCode()).isEqualTo(TechnicalErrorUserException.CODE);
assertThat(e.isForUser()).isTrue();
assertThat(e.isTechnical()).isTrue();
diff --git a/templates/server/src/main/resources/archetype-resources/core/src/main/java/__packageInPathFormat__/general/service/impl/config/BaseWebSecurityConfig.java b/templates/server/src/main/resources/archetype-resources/core/src/main/java/__packageInPathFormat__/general/service/impl/config/BaseWebSecurityConfig.java
index 8f828943..06fd3396 100644
--- a/templates/server/src/main/resources/archetype-resources/core/src/main/java/__packageInPathFormat__/general/service/impl/config/BaseWebSecurityConfig.java
+++ b/templates/server/src/main/resources/archetype-resources/core/src/main/java/__packageInPathFormat__/general/service/impl/config/BaseWebSecurityConfig.java
@@ -14,7 +14,6 @@
import org.springframework.security.web.authentication.logout.LogoutFilter;
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
-import org.springframework.security.web.csrf.CsrfFilter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
diff --git a/templates/server/src/main/resources/archetype-resources/core/src/main/java/__packageInPathFormat__/general/service/impl/config/WebConfig.java b/templates/server/src/main/resources/archetype-resources/core/src/main/java/__packageInPathFormat__/general/service/impl/config/WebConfig.java
index 1ef96539..0941bf99 100644
--- a/templates/server/src/main/resources/archetype-resources/core/src/main/java/__packageInPathFormat__/general/service/impl/config/WebConfig.java
+++ b/templates/server/src/main/resources/archetype-resources/core/src/main/java/__packageInPathFormat__/general/service/impl/config/WebConfig.java
@@ -28,10 +28,10 @@ public class WebConfig {
* with their duration and status code.
*/
@Bean
- public FilterRegistrationBean performanceLogFilter() {
+ public FilterRegistrationBean performanceLogFilter() {
- FilterRegistrationBean registration = new FilterRegistrationBean();
- Filter performanceLogFilter = new PerformanceLogFilter();
+ FilterRegistrationBean registration = new FilterRegistrationBean<>();
+ PerformanceLogFilter performanceLogFilter = new PerformanceLogFilter();
this.beanFactory.autowireBean(performanceLogFilter);
registration.setFilter(performanceLogFilter);
registration.addUrlPatterns("/*");
@@ -52,10 +52,10 @@ public DiagnosticContextFacade diagnosticContextFacade() {
* correlation id as MDC so it will be included in all associated logs.
*/
@Bean
- public FilterRegistrationBean diagnosticContextFilter() {
+ public FilterRegistrationBean diagnosticContextFilter() {
- FilterRegistrationBean registration = new FilterRegistrationBean();
- Filter diagnosticContextFilter = new DiagnosticContextFilter();
+ FilterRegistrationBean registration = new FilterRegistrationBean<>();
+ DiagnosticContextFilter diagnosticContextFilter = new DiagnosticContextFilter();
this.beanFactory.autowireBean(diagnosticContextFilter);
registration.setFilter(diagnosticContextFilter);
registration.addUrlPatterns(ServiceConstants.URL_PATH_SERVICES + "/*");
@@ -66,9 +66,9 @@ public FilterRegistrationBean diagnosticContextFilter() {
* @return the {@link FilterRegistrationBean} to register the {@link CharacterEncodingFilter} to set the encoding.
*/
@Bean
- public FilterRegistrationBean setCharacterEncodingFilter() {
+ public FilterRegistrationBean setCharacterEncodingFilter() {
- FilterRegistrationBean registration = new FilterRegistrationBean();
+ FilterRegistrationBean registration = new FilterRegistrationBean<>();
CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
characterEncodingFilter.setEncoding("UTF-8");
characterEncodingFilter.setForceEncoding(false);