[cdi-dev] JSF 2.3 and specifying alternatives for build-in producers

Jozef Hartinger jharting at redhat.com
Thu Nov 6 03:08:57 EST 2014


Hi Arjan, comments inline.

On 11/05/2014 07:21 PM, arjan tijms wrote:
> Hi,
>
> For JSF 2.3 we're currently working on providing build-in producers
> for various JSF artefacts.We're basically using the approach that I
> outlined here: http://jdevelopment.nl/dynamic-cdi-producers
>
> I noticed CDI is using a similar approach for its build-in producers,
> e.g. the one for HttpServletRequest (in Weld:
> org.jboss.weld.bean.builtin.ee.HttpServletRequestBean).
>
> Now we're currently putting these producers in an API package, to give
> the user a chance to override them, but I noticed CDI is not doing
> this. All producers are in implementation packages.
Not sure what you mean here. How is a producer in an API package 
supposed to be overriden? A CDI producer is an implementation detail and 
should not be part of the API
>
> After some experimentation I couldn't really succeed in providing an
> alternative producer for the CDI produced HttpServletRequest. I tried
> the obvious things, like an @Produces method in a bean annotated with
> @Alternative but that didn't work. Registered the bean as alternative
> in beans.xml, tried the uhm alternative @Priority method, tried
> different priority ranges, etc but my own producer was never called.
>
> Am I missing something very obvious, or is it not trivial to provide
> an alternative for build-in producers?
This should work. Sounds like an issue with your setup. Can you paste 
your code? It should be something like this: http://pastebin.com/TkzDtaAE

>
> Kind regards,
> Arjan Tijms
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.



More information about the cdi-dev mailing list