Dear all;
How are you?
I am trying to develop web service for geopolitical ontology.
I created one resources like
ws/neighbors/{ISO3} --> show all neighbors including 6 language translations,
by given country ISO3 code
i.e. ws/neighbors/ken --> show all neighbors including 6 lanuage translations
,by given country kenya.
Then, I also would like to serve another resource like showing neighbor
information only one selected language translation, by given country code"
So, I designed like
ws/neighbors/{iso}/language/{languagecode} such as EN,ES,FR} --> but for me, it
is not a good design, since these hierarchical structure is not logically
correct.
Is it good design in terms of REST?
If so, I think implementation of createRoot() could be like .
==============
Route neighborWithISO3Route = router.attach("/neighbors/{ISO3}",
NeighborsResource.class);
neighborWithISO3Route.getTemplate().getVariables().put("ISO3",
new Variable(Variable.TYPE_ALL));
Route NeighborsByEachLanguageRoute =
router.attach("/neighbors/{ISO3}/language/{lang}",
NeighborsByEachLanguageResource.class);
NeighborsByEachLanguageRoute.getTemplate().getVariables().put("lang",
new Variable(Variable.TYPE_ALL));
==============
But, the first neighborWithISO3Route is working fine. But, the second
NeighborsByEachLanguageRoute is not working. When I tried to GET two arguments
"ISO3" and "lang" in NeighborsByEachLanguageResource with the following codes
=============
this.ISO3 = ((String)request.getAttributes().get("ISO3")).toUpperCase();
this.lang = ((String)request.getAttributes().get("lang")).toUpperCase();
==============
Then, ISO3 had a value like "{ISO3}/language/{lang}" and lang was null.
What was wrong??
Thanks for your answer in advance.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2063049