Hi Dave,

Not really sure why the bean validation stuff doesn't work but in order to
bind form params you probably need to configure your resource method and
binding class in a different way. Try the following:

@GET
public <my object class, not important>
resourceMethod(@Valid @*BeanParam* MyParams params)
{
...
}

public class MyParams {

    @FormParam("a")
    private ArrayList<String> stringList = new ArrayList<>();

...
}

This should bind your form params into your MyParams class.

A minor side note: The convention many frameworks use when binding http
params at method level is the POJO one (i.e. *set*This()/*get*This() rather
than addThis() etc)

HTF,
Savvas

On 19 February 2015 at 19:48, Dave J <devdevdata...@gmail.com> wrote:

> Hello,
>
> After some nontrivial research I thought I would try this list in the
> hopes more expert users could help me figure out where I am going wrong.
> I am using RESTeasy 3.0.9. I am trying to affect validation of a parameter
> coming in on the URL for a GET request.
>
> I use a class to aggregate validation & storage of the set of parameters
> coming in on the URL.
>
> I start with this:
>
> @GET
> public <my object class, not important>
> resourceMethod(@Valid @Form MyParams params)
> {
> ...
> }
>
> The parameter of interest is a String, and can occur more than once. Let's
> name it "a".
> I would like to validate each occurrence (I want to check that its length
> is within a certain range), and if valid, I would like to add the String to
> a list. Otherwise, stop and report the error.
>
> So within the MyParams class....
>
> public class MyParams {
>
>     private ArrayList<String> stringList = new ArrayList<String>();
>
> ...
>
>     // Would rather this return void, but validation doesn't like
> constraints on void methods
>     @QueryParam('a")
>     public String addString(@Size(min=8,max=10) String str) {
>         stringList.add(str);
>         return null;
>      }
> }
>
>
> However in this scenario, the incoming string is neither validated nor
> added to the list.
>
> Is it possible to do this within RESTeasy? I'm happy to provide more info
> if needed.
>
> Thanks.
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
> _______________________________________________
> Resteasy-users mailing list
> Resteasy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to