Details
-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
3.0.8.Final, 3.0.10.Final
-
None
-
None
Description
When using the ClientProxy to execute a method with a @Path annotation containing an @PathParam, if the parameter is an enum the name is always used even if the enum has an @JsonValue annotation on it.
Example Test:
public class RestEasyClientEnumTest { /////////////////////////////////////////////// // Objects public enum TestEnum { ENUM_VALUE(1); private final int value; private TestEnum(final int val) { value = val; } @JsonValue public String getValue() { return Integer.toString(value); } } public static interface TestInterface { @GET @Path("/{index}") public Response testMethod(@PathParam("index") final TestEnum value); } public static class RequestInterceptor implements ClientRequestFilter { private String requestUri; @Override public void filter(final ClientRequestContext requestContext) throws IOException { requestUri = requestContext.getUri().toString(); } public String getRequestUri() { return requestUri; } } /////////////////////////////////////////////// // Test @Test public void testClientWithEnum() { final ResteasyClient client = new ResteasyClientBuilder().build(); final RequestInterceptor interceptor = new RequestInterceptor(); final TestInterface proxy = client.target("http://localhost") .register(interceptor) .proxy(TestInterface.class); try { proxy.testMethod(TestEnum.ENUM_VALUE); } catch (Exception e) { // Can't actually connect to localhost; don't care } Assert.assertEquals("http://localhost/" + TestEnum.ENUM_VALUE.getValue(), interceptor.getRequestUri()); } }