Hello,

I have the following service (ContentManager):

    @WebMethod
    @GET
    @Path("/list/{contentType}/{id}")
    @Secured("ROLE_RESTCLIENT")
public Contents browse(@PathParam("id") String idVal, @PathParam("contentType") RequestContentType contentTypeVal, @QueryParam("page") @DefaultValue("0") String page, @QueryParam("size") @DefaultValue("10") String size,
            @QueryParam("dateFrom") @DefaultValue("0") String dateFrom,
            @QueryParam("dateTo") @DefaultValue("0") String dateTo,
@QueryParam("free") @DefaultValue("false") Boolean freeFilter) throws WSException;

Note the @Path annotation and the arguments order!

I try to perform the following code:

protected <T> T getAuthenticatedProxy(Class<T> clazz) {
        T proxy = JAXRSClientFactory.create(BASE_URL, clazz);
        WebClient.client(proxy).cookie(Cookie.valueOf(sessionCookie));

        return proxy;
}
....

Contents list = getAuthenticatedProxy(ContentManager.class).browse(
                parts[parts.length - 1],
                RequestContentType.vod,
                "0",
                Integer.MAX_VALUE + "",
                null,
                "",
                false);
...

What happens is that the URL Path parameters are send in wrong order (ContentType and Id). Since ContentType is an Enum I get "IllegalArgumentException: No enum const". Here is the server wrong part of the inbound message: /list/*1*/*text*?page=0&size=2147483647&dateTo&free=false

I tried to debug the ClientProxy and what I see is that /*getPathParamValues*/ returns the parameters in the order like in the method signature (id, contentType). After that the URIBuilder is not reordering according to param names. I don't know who should handle the ordering, the UriBuilder or inside the getPathParamValues, but obviously there's something wrong. If I'm doing the call in some strange manner, please let me know how to fix it.

Tested with CXF 2.4.3.

Best regards,
Nikolay

Reply via email to