triaxrs/RootResourceExecutorImpl could (should) do better pattern matching on 
methods
-------------------------------------------------------------------------------------

                 Key: CLEREZZA-570
                 URL: https://issues.apache.org/jira/browse/CLEREZZA-570
             Project: Clerezza
          Issue Type: New Feature
            Reporter: Henry Story


I am developing a class for a resource that could take or not take certain 
parameters.

@GET def infoPage() : Response = { .. }
@GET def authenticate(@QueryParam("authreqissuer") relyingPartySrvc: URL ): 
Response = { ... }
@GET def authenticate(@QueryParam("authreqissuer") relyingPartySrvc: URL , 
@QueryParam("pause") pause: Boolean): Response = { ... }

So I assumed naively - but that may say something about general newbie 
expectations - that the methods that would match most parameters would be 
selected.

It turns out that it is the first method that is called in 
RootResourceExecutorImpl 

   final MethodAndConsumedAndProducibleTypes firstAcceptable = 
acceptableMethods.first();

This leads to inconsistent and random behavior, as different functions are 
called for different request of the same URI request.
So a GET request on https://localhost:8443/srvc/webidp can call all of the 
above functions. It then furthermore throws exceptions when it does not have 
the data for a method.

As I saw these errors thrown I refactored my code a few times, and finally 
discovered this was a problem in the triaxrs code.

One could make a list of (attribute annotation pairs) and find out which 
methods had the most of the attribtes available in the URI.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to