0

I've REST-based service on resygwt with API like this:

@Path("/search")
@GET
List<User> search(@QueryParam("login") String loginMask) throws RemoteException;

And I receive "malformed URI sequence" for this request:

http://devsys23:8080/rest/search?login=%25spa%20ce%25

This is rather strange, since in JavaDoc mentioned, that such requests should be supported by default:

  • Binds the value(s) of a HTTP query parameter to a resource method parameter,
  • resource class field, or resource class bean property.
  • Values are URL decoded unless this is disabled using the {@link Encoded}
  • annotation. A default value can be specified using the {@link DefaultValue}
  • annotation.

I've try to edit tomcat connector in server.xml with useBodyEncodingForURI and URIEncoding="UTF-8". Also org.springframework.web.filter.CharacterEncodingFilter was included and forceEncoding set, but it still doesn't work =(

What should I do to specify that login param should be decoded? Thank you for your advice if any.

  • Is your problem realy related to RestyGWT ? From what I understand the problem is more a tomcat problem for decoding query param values. Do you want resty not to encode query param or do you want your backend to decode them ? – Ronan Quillevere Sep 22 '14 at 11:38

1 Answers1

0

If you want to decode the value, you can create a ContainerResponseFilter, register it in your ResourceConfig and do something like

String loginValue= queryParams.get("login");
loginValue= URLDecoder.decode(loginValue, "UTF-8");

Maybe RestyGWT is encoding all the params by default.

Need to ask on the restyGWT google discussion : https://groups.google.com/forum/#!forum/restygwt

Ronan Quillevere
  • 3,699
  • 1
  • 29
  • 44