Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D56732009C6 for ; Tue, 31 May 2016 14:18:20 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D3FE9160A46; Tue, 31 May 2016 12:18:20 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CD56F160A44 for ; Tue, 31 May 2016 14:18:19 +0200 (CEST) Received: (qmail 14211 invoked by uid 500); 31 May 2016 12:18:18 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 14199 invoked by uid 99); 31 May 2016 12:18:18 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2016 12:18:18 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id E760AC2989 for ; Tue, 31 May 2016 12:18:17 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.821 X-Spam-Level: X-Spam-Status: No, score=-0.821 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id E6DtVwnvfnvN for ; Tue, 31 May 2016 12:18:16 +0000 (UTC) Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 983435FBA5 for ; Tue, 31 May 2016 12:18:15 +0000 (UTC) Received: by mail-wm0-f42.google.com with SMTP id z87so105311677wmh.0 for ; Tue, 31 May 2016 05:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=B3hVG9+SBikTwa47GSu4rmbNh/8KUMCJs4sI8J9ocmQ=; b=b8Yhe6vyh7bW6wgKX49mR7a7D/njc/Nb+UY2JWK27i6qIHRZP6xJ3VGoT6o0uDoOSl oZvUI1yYtGNMxka5N/XqVNHRvJf9/rkcFVQPgL+y76lv4K9D3Y66o0r4AuYTcI1XR9QO XN+PN91EBOvpr70nkQ6oiBEM+HX1cqMBZlKIIJiAuH2FvjKgoPyz34ZASpe/1nWlzQww mUKUQeDtl6LFsB3rTcqNWc2N8Wari1kNAh5MBb3tJW1k8V9VeM1mUWLdhvdw+gDNKerO XkG1UsqXrUbEy3alB6VLi4FYbLMLZbUmEzerveJkLpXnWGQ4z0R24YSww7T5rXDWIF9M i1Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=B3hVG9+SBikTwa47GSu4rmbNh/8KUMCJs4sI8J9ocmQ=; b=lWyvKLqWkNtKohzTtnFK24QXv68pRDUzp5BDjS2lS3XwZ2dwFK/Rpgmto9faCuB/Td cS2GYWWgvBXTkFHbZIhJq3HpyX++E43SVnHG4EszyEscrkP87g78g1UyUfdqnrVSfG/L s1tJxL4nNz0e9CiH5zR7yHPlYmgq6PjX5pY1eW41SPUwiFrzcWXOOOp2HtqZJiMvGLHU 7uMAD6Nf8+vAK2UiYCbrz3/vONBRTGbrM82JzUiPUe5eaErK9kAkpQrxQ6d4H7m0CToX ij+9hhHM71ONLGHM92xGtQ8KMvs68aPmOYk1oi1eeDAskvl30EipG/7aF1pwLZOTE8Yj wnJA== X-Gm-Message-State: ALyK8tJVF11yO3qv+gy/cljFnX4LdqvHK7HL5MX3a9X9Uv35iSkKIuaSuF/Z2QFurwhEiA== X-Received: by 10.28.43.129 with SMTP id r123mr14772888wmr.99.1464697093818; Tue, 31 May 2016 05:18:13 -0700 (PDT) Received: from [192.168.2.7] ([79.97.121.181]) by smtp.googlemail.com with ESMTPSA id u64sm29092643wmd.8.2016.05.31.05.18.12 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 31 May 2016 05:18:12 -0700 (PDT) Subject: Re: Is there a way to control the depth of recursiveness in @QueryParam? To: users@cxf.apache.org References: <2107069606.1057452.1464475186513.JavaMail.yahoo.ref@mail.yahoo.com> <2107069606.1057452.1464475186513.JavaMail.yahoo@mail.yahoo.com> <574C0F8D.3010605@gmail.com> <511025234.1672926.1464626224455.JavaMail.yahoo@mail.yahoo.com> <574CA547.5050508@gmail.com> <784424665.1773473.1464643583065.JavaMail.yahoo@mail.yahoo.com> From: Sergey Beryozkin Message-ID: <574D8104.1050305@gmail.com> Date: Tue, 31 May 2016 13:18:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <784424665.1773473.1464643583065.JavaMail.yahoo@mail.yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit archived-at: Tue, 31 May 2016 12:18:21 -0000 Hi CXF client/server code will only check fields if property getters/setters are available, public fields won't be checked. This is done to make it more effective. I doubt JAX-RS spec will ever enforce that public BeanParam fields need to be supported - it is a bean after all and the accepted patterns need to be observed. FYI, I've just updated WADLGenerator to check BeanParam field annotations (with the restrictions mentioned above) and also check BeanParams containing embedded BeanParams Cheers, Sergey On 30/05/16 22:26, Dongfeng Lu wrote: > Thanks, Sergay, for the hints. > > I tried moving @QueryParam around and it looked like that the generated WADL looked correct only when @QueryParam was placed on the setters. > > I also tested another variation. I changed all attributes to be public and removed all getters and setters. > > > public class MyParamBean { > @QueryParam("start") > public XMLGregorianCalendar start; > @QueryParam("end") > public XMLGregorianCalendar end; > @QueryParam("count") > public BigInteger count; > } > > The generated WADL became > > > > Is this also a bug? > Anyway, thanks for your help. The @BeanParam should work for me now. > Dongfeng > > > > On Monday, May 30, 2016 3:40 PM, Sergey Beryozkin wrote: > > > Hi > > May be WADL generator only checks annotated getters and setters, I'll > check tomorrow, though the runtime will support the annotated fields > too, please move @QueryParam to the getters and it should do it, and > I'll check if WADL generator needs to be tweaked further > > Cheers, Sergey > On 30/05/16 17:37, Dongfeng Lu wrote: >> Thanks, Sergey. >> >> I did try @BeanParam, but it did not generate a correct WADL, although the request worked. Here is my method definition >> >> @GET >> @Path("retrieveBean") >> @Produces({ MediaType.APPLICATION_JSON }) >> public RetrieveResponseType retrieve( >> @BeanParam() MyParamBean paramBean); >> >> where MyParamBean is defined as >> >> >> public class MyParamBean { >> @QueryParam("start") >> private XMLGregorianCalendar start; >> >> @QueryParam("end") >> private XMLGregorianCalendar end; >> >> @QueryParam("count") >> private BigInteger count; >> >> public XMLGregorianCalendar getStart() { >> return start; >> } >> >> public void setStart(XMLGregorianCalendar start) { >> this.start = start; >> } >> >> public XMLGregorianCalendar getEnd() { >> return end; >> } >> >> public void setEnd(XMLGregorianCalendar end) { >> this.end = end; >> } >> >> public BigInteger getCount() { >> return count; >> } >> >> public void setCount(BigInteger count) { >> this.count = count; >> } >> >> } >> >> >> The actual call in the following format actually worked, >> >> /retreiveBean?count=2&start=2014-02-27T21%3A11%3A00.718-06%3A00&end=2014-02-27T21%3A14%3A00.718-06%3A00 >> >> But the generated WADL for this method is >> >> >> >> >> > element="prefix1:RetrieveResponseType" /> >> >> >> >> >> I searched the user group and found discussions around ticket CXF-5989. It seems it had been fixed, so I was confused. Did I do something wrong? >> >> Thanks, >> Dongfeng >> >> On Monday, May 30, 2016 5:02 AM, Sergey Beryozkin wrote: >> >> >> Hi >> >> WADLGenerator is already blocking the recursion for Date properties and >> I've just updated to block for XMlGregorianCalendar. Will work starting >> from CXF 3.1.7. >> >> Can you avoid using QueryParam("") extension and use individual >> QueryParam properties ? if you prefer the 'loose' style offered by a "" >> extension then may be you can try and achieve similar effect with JAX-RS >> 2.0 @BeanParam ? >> >> Cheers, Sergey >> >> >> On 28/05/16 23:39, Dongfeng Lu wrote: >>> I am using CXF 3.1.4. >>> >>> I searched for "queryparam" and "recursive" in the user group archive and found discussions related to JIRA ticket CXF-2153. I understand its purpose, but this recursiveness does not work well for certain classes like javax.xml.datatype.XMLGregorianCalendar. >>> >>> I defined my data structure in XSD like >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> In the generated Java files, "xsd:dateTime" is represented by XMLGregorianCalendar class. I then defined an interface like >>> @GET >>> @Path("retrieve") >>> @Produces({ MediaType.APPLICATION_JSON }) >>> public RetrieveResponseType retrieve(@QueryParam("") Retrieve message) ; >>> >>> The generated WADL has the following resource definition >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> element="prefix1:RetrieveResponseType" /> >>> >>> >>> >>> >>> And CXF JAXRSClientFactory.create() generated client sends the following URL to the server >>> >>> >>> /retrieve?end.valid=true&end.hour=21&end.minute=14&end.second=0&end.timezone=-360&end.month=2&end.year=2014&end.day=27&end.millisecond=718&end.fractionalSecond=0.718&end.eonAndYear=2014&end.xMLSchemaType.prefix&end.xMLSchemaType.namespaceURI=http%3A//www.w3.org/2001/XMLSchema&end.xMLSchemaType.localPart=dateTime&start.valid=true&start.hour=21&start.minute=11&start.second=0&start.timezone=-360&start.month=2&start.year=2014&start.day=27&start.millisecond=718&start.fractionalSecond=0.718&start.eonAndYear=2014&start.xMLSchemaType.prefix&start.xMLSchemaType.namespaceURI=http%3A//www.w3.org/2001/XMLSchema&start.xMLSchemaType.localPart=dateTime&count=1 >>> >>> >>> Clearly this is not what I wanted. I wanted simple queries like >>> >>> >>> /retrieve?start=2014-02-27T21%3A11%3A00.718-06%3A00&end=2014-02-27T21%3A14%3A00.718-06%3A00&count=1 >>> >>> >>> or >>> >>> >>> /retrieve?start=1393557240718&count=2&end=1393558240718 >>> >>> >>> With a customized ParamConverter for XMLGregorianCalendar both simplified queries work well if I just send them directly to the server. However, the WADL is still wrong, and I could not find way to have CXF client to send correct URLs to the server. >>> >>> I believe this is the side effect of the fix for CXF-2153 ticket. Is there a way to configure it so it only goes down one level into Retrieve class, and not into its components' XMLGregorianCalendar classes? >>> >>> Thanks,Dongfeng >>> >> >> > > -- Sergey Beryozkin Talend Community Coders http://coders.talend.com/