RestDispatch - Strings in request body are wrapped in quotes.

15 views
Skip to first unread message

Richard Wallis

unread,
Jun 20, 2015, 4:35:55 AM6/20/15
to gwt-pl...@googlegroups.com
Whenever I send a String as the body in a POST, PUT or DELETE, it gets wrapped in quotes.

Eg for the following if I send a password "myPassword", the server receives it as ""myPassword""

@Path(ApiPaths.CHANGE_PASSWORD)
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface ChangePasswordResource {
   
   
@POST
   
@Path(ApiPaths.ID)
   
void changePassword(@PathParam(Param.ID) String userId, String password);
   
   
}


How do I fix this?

Christian Goudreau

unread,
Jun 20, 2015, 9:52:25 AM6/20/15
to gwt-pl...@googlegroups.com
It's because it gets serialized as "json" rather than "text". You either need to encapsulate the string in an object or change the mediatype to text

Christian Goudreau | CEO - PDG

--
You received this message because you are subscribed to the Google Groups "GWTP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gwt-platform...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages