Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jaxrs-dev] Integrating JAX-RS, CDI and bean validation

Hi Niklas,

I already commented on the GitHub issue. But here are some additional notes:


So what I'd like to achieve is to implement a validation message interpolator that uses the locale from the JAX-RS Headers (HelloResource.java). But since the message interpolator is global in the application it has to work for servlet requests and outside of request processing as well (TestServlet.java / SomeSingleton.java).

Why is the message interpolator global? Basically it would be possible for JAX-RS implementations or application developers to build a custom ValidatorFactory.

 
This fields are actually successfully injected. From my understanding of the specs it should not actually be possible to inject HttpHeaders into a CDI-bBean. Is this correct?

I don't think so. This class can be injected via @Context, but the spec doesn't enforce that CDI's @Inject is supported. Although Jersey seems to handle it this way.


The HttpServletRequest injection also works. But I could not find anything in the spec, that indicates that the CDI request scope is actually active while a JAX-RS request is executed. Is this up to the implementors to decide?

Well, the CDI request scope is always active for HTTP requests. So that's basically not something the JAX-RS implementor could change, even if he wants to. ;-)


Christian


--

Back to the top