ClientRequestFilter get PathParameter

803 views Asked by At

I have a JAX-RS rest client with following definition.

@PUT
@Path("/payments/{paymentId}/operation")
void call(@PathParam("paymentId") String paymentId, Object request);

I would like to intercept this outgoing request and read the paymentId value in a ClientRequestFilter.

@Provider
public class TracingInterceptor implements ClientRequestFilter {

    public static final String PAYMENT_ID = "paymentId";

    @Context
    UriInfo info;

    @Override
    public void filter(ClientRequestContext requestContext) {
        // read paymentId
    }
}

I tried with UriInfo which works for ContainerRequestFilter but the context is not available in a ClientRequestFilter.

How can I read a specific path parameter in a ClientRequestFilter?

1

There are 1 answers

2
Roberto Cortez On