-1

Here is my code

public class JustinApplication extends Application {
  public synchronized Restlet createInboundRoot() {
    Router router = new Router();

    router.attach("/forresource/{id}", JustinResource.class);       
    return router;
  }
}

and am trying to send a JSon data through the URL

{"ID":"324"}.

I want to receive the json data in my resource class. I can get only as a string like this %7B%22ID%22:%22324%22%7D . But I NEED EXACTLY THE SAME DATA. How can I do this with the restlet?

Justin
  • 735
  • 1
  • 15
  • 32

1 Answers1

0

you get this %7B%22ID%22:%22324%22%7D because the value {"ID":"324"} got URL-Enecoded when the request was sent.

you need to URL-Decode that and you will get your value.

String jsonParam = URLDecoder.decode(paramVal, "UTF8");

now you can use jsonParam, it will have {"ID":"324"}

have a look here to find out more

Yazan
  • 6,074
  • 1
  • 19
  • 33