diff --git a/pom.xml b/pom.xml
index be4deca6..e6e1b9a5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -547,7 +547,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 3.5.1
+ 3.5.2
org.apache.maven.plugins
@@ -606,7 +606,7 @@
org.apache.maven.plugins
maven-surefire-report-plugin
- 3.5.1
+ 3.5.2
diff --git a/src/main/java/x1/stomp/boundary/ExceptionMapperBase.java b/src/main/java/x1/stomp/boundary/ExceptionMapperBase.java
index 3ed85739..65eda14a 100644
--- a/src/main/java/x1/stomp/boundary/ExceptionMapperBase.java
+++ b/src/main/java/x1/stomp/boundary/ExceptionMapperBase.java
@@ -9,6 +9,8 @@
import org.slf4j.MDC;
import static x1.stomp.boundary.MDCFilter.HTTP_STATUS_CODE;
+import java.net.URI;
+
/**
* Base class for ExceptionMapper with MDC logging
*/
@@ -16,8 +18,12 @@ public abstract class ExceptionMapperBase {
private final Logger log = LoggerFactory.getLogger(ExceptionMapperBase.class);
@Context
- protected UriInfo uriInfo;
-
+ private UriInfo uriInfo;
+
+ protected URI getRequestUri() {
+ return uriInfo.getRequestUri();
+ }
+
protected void debug(Status status, String message, Object... args) {
try {
MDC.put(HTTP_STATUS_CODE, Integer.toString(status.getStatusCode()));
diff --git a/src/main/java/x1/stomp/boundary/FaultToleranceExceptionMapper.java b/src/main/java/x1/stomp/boundary/FaultToleranceExceptionMapper.java
index 4a08563a..fde7a775 100644
--- a/src/main/java/x1/stomp/boundary/FaultToleranceExceptionMapper.java
+++ b/src/main/java/x1/stomp/boundary/FaultToleranceExceptionMapper.java
@@ -15,7 +15,7 @@ public class FaultToleranceExceptionMapper extends ExceptionMapperBase implement
public Response toResponse(FaultToleranceException e) {
var response = new ErrorResponse(e.getClass().getSimpleName());
var status = SERVICE_UNAVAILABLE;
- response.setRequestUri(uriInfo.getRequestUri().toString());
+ response.setRequestUri(getRequestUri().toString());
response.add(ErrorMessage.from(e));
warn(status, "Service not available due to:\n{}", response.toString());
return Response.status(status).entity(response).build();
diff --git a/src/main/java/x1/stomp/boundary/RuntimeExceptionMapper.java b/src/main/java/x1/stomp/boundary/RuntimeExceptionMapper.java
index 72619d24..44b333f9 100644
--- a/src/main/java/x1/stomp/boundary/RuntimeExceptionMapper.java
+++ b/src/main/java/x1/stomp/boundary/RuntimeExceptionMapper.java
@@ -13,7 +13,7 @@ public class RuntimeExceptionMapper extends ExceptionMapperBase implements Excep
public Response toResponse(RuntimeException e) {
// will be logged by LoggingInterceptor
var response = new ErrorResponse(e.getClass().getSimpleName());
- response.setRequestUri(uriInfo.getRequestUri().toString());
+ response.setRequestUri(getRequestUri().toString());
response.add(ErrorMessage.from(e));
return Response.status(INTERNAL_SERVER_ERROR).entity(response).build();
}
diff --git a/src/main/java/x1/stomp/boundary/ValidationExceptionMapper.java b/src/main/java/x1/stomp/boundary/ValidationExceptionMapper.java
index 030c3de1..5390a567 100644
--- a/src/main/java/x1/stomp/boundary/ValidationExceptionMapper.java
+++ b/src/main/java/x1/stomp/boundary/ValidationExceptionMapper.java
@@ -14,7 +14,7 @@ public class ValidationExceptionMapper extends ExceptionMapperBase implements Ex
public Response toResponse(ConstraintViolationException e) {
var response = new ErrorResponse("Invalid data");
var status = BAD_REQUEST;
- response.setRequestUri(uriInfo.getRequestUri().toString());
+ response.setRequestUri(getRequestUri().toString());
e.getConstraintViolations().forEach(violation -> response.add(ErrorMessage.of(violation)));
info(status, "Request failed because of invalid parameters:\n{}", response.toString());
return Response.status(status).entity(response).build();
diff --git a/src/main/java/x1/stomp/model/JaxbSupport.java b/src/main/java/x1/stomp/model/JaxbSupport.java
index 5ab5eda7..db492564 100644
--- a/src/main/java/x1/stomp/model/JaxbSupport.java
+++ b/src/main/java/x1/stomp/model/JaxbSupport.java
@@ -13,11 +13,12 @@
import jakarta.xml.bind.annotation.adapters.XmlAdapter;
/**
- * copied from jakarta.ws.rs.core where this is deprecated
+ * copied from jakarta.ws.rs.core where this is deprecated
*/
public final class JaxbSupport {
- private JaxbSupport() {}
-
+ private JaxbSupport() {
+ }
+
public static class JaxbLink {
private URI uri;
@@ -90,25 +91,25 @@ public int hashCode() {
}
}
-
+
public static class JaxbAdapter extends XmlAdapter {
@Override
public Link unmarshal(final JaxbLink v) {
- var lb = Link.fromUri(v.getUri());
- for (var e : v.getParams().entrySet()) {
- lb.param(e.getKey().getLocalPart(), e.getValue().toString());
- }
- return lb.build();
+ var lb = Link.fromUri(v.getUri());
+ for (var e : v.getParams().entrySet()) {
+ lb.param(e.getKey().getLocalPart(), e.getValue().toString());
+ }
+ return lb.build();
}
@Override
public JaxbLink marshal(final Link v) {
- var jl = new JaxbLink(v.getUri());
- for (var e : v.getParams().entrySet()) {
- jl.getParams().put(new QName("", e.getKey()), e.getValue());
- }
- return jl;
+ var jl = new JaxbLink(v.getUri());
+ for (var e : v.getParams().entrySet()) {
+ jl.getParams().put(new QName("", e.getKey()), e.getValue());
+ }
+ return jl;
}
-}
+ }
}