Hi Benson
On 01/12/11 18:36, Benson Margulies wrote:
Sergey,
I've hit a snag with preflight. In preflight, the client sends an
OPTIONS with a 'requestMethod' and we have to decide if we like that
method. This is section 6.1.5.
The client sends OPTIONS with the method, a list of custom headers,
and of course the full URL.
I need to map that to the method that would be selected for the actual
request to look at the annotations.
That is, given a method as a string and a URL, I need to obtain the
'annotated method' that would be invoked. Not everything we'd usually
use to select a method will be there. In particular, if the Consumes
is 'interesting', the relevant content-type won't be there. Here's the
list of request headers that will come with the OPTIONS header.
You can use JAXRSUtils.selectResourceClass &
JAXRSUtils.findTargetMethod, create an empty Message
Accept, Accept-Language, Content-Language, or Last-Event-ID, or if it
is an ASCII case-insensitive match for Content-Type and the header
field value media type (excluding parameters) is an ASCII
case-insensitive match for application/x-www-form-urlencoded,
multipart/form-data, or text/plain.
HttpHeaders should help there, lookups are case-insensitive
Does it help a bit ?
Cheers, Sergey
The coward's way out of this is to use only class-level annotations
for preflight, and document that we're doing so. Can you think of any
better alternative?
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com