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:

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
    public String addString(@Size(min=8,max=10) String 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.

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
Resteasy-users mailing list

Reply via email to