Greetings.

I am trying to get a multi-value input part working in my resteasy 
service.  On the inbound side, I'm expecting a multipart/formdata post, 
where an input part named "propertyName" may appear multiple times.  I 
need to read that in as a Collection of some sort.  Some sample code 
that may or may not be right:

@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_ATOM_XML_FEED)
public Feed queryFromPost(MultipartFormDataInput input) {
   String query = input.getFormDataPart("query",
         new GenericType<String>() { });
   Set<String> propNames = input.getFormDataPart("propertyName",
         new GenericType<Set<String>>() { });
   return doQuery(query, propNames);
}

I'm also using resteasy on the client-side.  Not sure how to submit the 
POST with multiple values.  Currently I have:

   String url = ...
   String query = ...
   Set<String> propertyNames = ...
   ClientRequest request = new ClientRequest(url);
   MultipartFormDataOutput formData = new MultipartFormDataOutput();
   formData.addFormData("query", query, MediaType.TEXT_PLAIN_TYPE);
   formData.addFormData("propertyName", propertyNames,
         MediaType.TEXT_PLAIN_TYPE);
   request.body(MediaType.MULTIPART_FORM_DATA_TYPE, formData);
   ClientResponse<Feed> response = request.post(Feed.class);

Clearly this isn't right.  Any thoughts on how this should be done?

Thanks!

-Eric

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to