How to configure path parameter in RESTeasy client

I used RESTeasy for server and client. Client-side client service interface with server:

public interface Service { @Path("/start") @GET void start(); } 

The implementation of this service is bound to the /api path, so the start () method is available on the full path /api/start . On the client side, the code is pretty simple:

 RegisterBuiltin.register(ResteasyProviderFactory.getInstance()); Service service = ProxyFactory.create(Service.class, "http://server/api"); service.start(); 

But I want the case insensitive, so I use the path parameter with a regular expression in it:

 public interface Service { @Path("/{start:[Ss]tart}") @GET void start(); } 

Now the ProxyFactory client does not know the value for the replacement path parameter {start} and does not perform any substitutions, and the client ends the exception You did not supply enough values to fill path parameters .

But when I try to use the path parameter as an argument to the method, it works.

 public interface Service { @Path("/{start:[Ss]tart}") @GET void start(@PathParam("start") String param); } 

How to specify a value for a false path parameter in a RESTeasy client?

Thanks.

+4
source share
1 answer

You can see the answer here. Case-insensitive URLs with JAX-RS : No. There is also an RFC attached to this rule.

0
source

Source: https://habr.com/ru/post/1386949/


All Articles