Hi Sam,
you could also create a resource for /lastRiskEval (without slash at the
end) that handles the requests for the collection of persons.
best regards
Stephan
Bao,Sam schrieb:
Ah, I gotcha. My previous application could match because I actually had "/results/" that was
attached to a resource. In this case "/lastRiskEval/" is not attached to any resource.
LastRiskEvaluationResource only supports GET when given a 'personid', nothing else, so I didn't think there
would be a need to attach the uri pattern "/lastRiskEva/" to anything. That makes sense to me now.
Thanks.
-----Original Message-----
From: Thierry Boileau [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 13, 2008 10:42 AM
To: [email protected]
Subject: Re: URI won't match what's attached to the router
Hi Sam,
by default a variable is supposed to "eat" at least one character. In your case, the route
"/lastRiskEval/{personid}" cannot match the URI "/lastRiskEval/".
Another question is what is the resource behind "/lastRiskEval/"? Does this URI really
correspond to a "LastRiskEvaluationResource" instance?
best regards,
Thierry Boileau
I can try this, but I'm curious as to am I declaring the variable wrong? Is the example below the proper way to do that? Thanks.
-----Original Message-----
From: Thierry Boileau [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 13, 2008 10:03 AM
To: [email protected]
Subject: Re: URI won't match what's attached to the router
Hello Sam,
you can update the "personid" variable in order to make it facultative:
Route route = router.attach("/lastRiskEval/{personid}",
LastRiskEvaluationResource.class);
// You can use other Variable.TYPE_...
Variable variable = new Variable(Variable.TYPE_ALPHA_DIGIT, "", false,
false); route.getTemplate().getVariables().put("personid", variable);
best regards,
Thierry Boileau
I've got the following resource attached to my router:
Router router = new Router(getContext());
router.attach("/conditions", ConditionsResource.class);
router.attach("/facts", FactsResource.class);
router.attach("/risks", RisksResource.class);
router.attach("/riskEval", RiskEvaluationResource.class);
router.attach("/lastRiskEval/{personid}",
LastRiskEvaluationResource.class);
However, when I try to go to the LastRiskEvaluationResource without giving it a
person id, I get a 404.
I'm just running the http server locally, and so the url I'm using is:
http://localhost:8182/lastRiskEval/
However, I get a 404. I traced it down to where the Decoder.handle() tries to
getNext() and doesn't find the 'next' because when getting routes, it uses the
BEST method, but never matches my URI. I'm using 1.0.9, does anyone have a
clue on what I should try?
I've had this work before on another Application where I had
"/results/{personid}" and it'd work.