I have the following
public synchronized Restlet createRoot() {
Router router = new Router(getContext());
router.attach("/search/{query}", SearchResource.class);
return router;
}
So query is the search query (variable)
I am trying to get this variable from my resource but I am always returned null.
public SearchResource() {
searchQuery = (String) getRequestAttributes().get("query");
}
I am getting a null pointer at getRequestAttributes() or if I try getRequest().getAttributes()
Am I doing something wrong?
This works for me :