json - Converting data sent from the client with RESTeasy -
i developing rest services, in j2ee environment, using resteasy library. if have @post rest method:
@post @path("/filter") @produces(mediatype.application_json) @consumes(mediatype.application_form_urlencoded) public list<order> findorders( @formparam("orderfiltercriteria") orderfiltercriteria orderfiltercriteria, @formparam("readcontext") orderreadcontext readcontext, @formparam("querycontrol") querycontrol querycontrol, @formparam("fetchpattern") fetchpattern fetchpattern, @formparam("loadpattern") loadpattern loadpattern) { ... }
supposing client sends these data through form, , supposing these json string, how can convert (server-side) these json strings in correct way? example, json string "readcontext" field, how can converted orderreadcontext object?
i using widlfly 8.2 deploy. in advance.
from @formparam documentation:
the type t of annotated parameter must either:
- be primitive type
- have constructor accepts single string argument
- have static method named valueof or fromstring accepts single >string argument (see, example, integer.valueof(string))
- be list, set or sortedset, t satisfies 2 or 3 above. resulting collection read-only.
Comments
Post a Comment