Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jaxrs-dev] Another request for extension

HI Marcus,

In RESTEasy we extend the treatment of @HeaderParam to look for HeaderDelegates as well as the usual:

1. Types for which a ParamConverter is available via a registered ParamConverterProvider . See
Javadoc for these classes for more information.
2. Primitive types.
3. Types that have a constructor that accepts a single String argument.
4. Types that have a static method named valueOf or fromString with a single String argument
that return an instance of the type. If both methods are present then valueOf MUST be used unless
the type is an enum in which case fromString MUST be used 1 .
5. List<T> , Set<T> , or SortedSet<T> , where T satisfies 1, 3 or 4 above.

Honestly, I'm not altogether sure what HeaderDelegates are for, given the existence of ParamConverters, but they exist. Just allowing for the "Field of Dreams" principle ("If you build it they will come") ... .

-Ron

On 11/28/18 12:56 AM, Markus KARG wrote:
Can you please provide a real-world use case where an application wants to
register a HeaderDelegate?
-Markus

-----Original Message-----
From: jaxrs-dev-bounces@xxxxxxxxxxx [mailto:jaxrs-dev-bounces@xxxxxxxxxxx]
On Behalf Of Ron Sigal
Sent: Mittwoch, 28. November 2018 01:43
To: jaxrs-dev@xxxxxxxxxxx
Subject: [jaxrs-dev] Another request for extension

Nothing in the JAX-RS 2.1 spec says that
javax.ws.rs.ext.RuntimeDelegate$HeaderDelegate is a provider, which means
that there is no reason to expect that something like
javax.ws.rs.core.Configurable.register(Class<?>) will work for a
HeaderDelegate. Moreover, there is no compulsion to recognize a declaration
of a HeaderDelegate in a META-INF/services/javax.ws.rs.ext.Providers file,
or a definition of a HeaderDelegate annotated with @Provider.

It's much easier to register a HeaderDelegate if it is recognized as a
provider. Moreover, Just as one might want to use an application specific
MessageBodyReader, one might want to use an application specific header, so
it makes sense to think of a HeaderDelegate as a provider.

-Ron

--
My company's smarter than your company (unless you work for Red Hat)

_______________________________________________
jaxrs-dev mailing list
jaxrs-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from
this list, visit https://www.eclipse.org/mailman/listinfo/jaxrs-dev

_______________________________________________
jaxrs-dev mailing list
jaxrs-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/jaxrs-dev
-- 
My company's smarter than your company (unless you work for Red Hat)

Back to the top