Actually, forgot to ask :

so what stage your custom inInterceptor is using ?


Cheers, Sergey

----- Original Message ----- From: "Sergey Beryozkin" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, November 05, 2008 3:28 PM
Subject: Re: @Resource Injection not working


Hi

That did the trick but the providers which I had written started
complaining, question is are providers different now - my isWriteable()
method complains with AbstractMethodError.

2.1.2 support 0.8 api and I think from 0.8 api the MessageBodyProviders have 
had their signatures changed

I didn't understand your comment
about cxf interceptor but  i'm using inInterceptor to read a specific http
header entry, but I guess you do through Request Filters now.

It's ok if you use cxf input interceptors instead of RequestFilters (which are essentially collocated with a JAXRSInInterceptor which as a cxf input interceptor and it uses a PRE_STREAM phase) as long as they can do what you'd like them to do. You can use RequestFilters if you'd like to block a request, eitehr through a normal Response return or by throwing an exception whcih can be subsequently mapped using ExceptionMappers, etc... Using cxf input interceptors can be handy if you do both jaxrs and jaxws at the same time so you can reuse the same interceptor...


I had to roll back to previous version

I'm sorry :-) about that @Resource disaster - but I can see now you'd need to 
change the signatures anyway.

I'd encourage you to try 2.1.3 - few bugs have been fixed there.

Cheers, Sergey


On Tue, Nov 4, 2008 at 4:14 AM, Sergey Beryozkin <
[EMAIL PROTECTED]> wrote:

Hi
It's a regression. Since 2.1.2, thread local proxies are used when the
field or setter method injection is required, and as part of that work the
@Resource filed injection got broken. I've got it fixed with a test in my
snapshot - but it'll only be available shortly in 2.1.3-SNAPSHOT.

In meantime - please change @Resource to @Context and it will work fine.
Supporting @Resource is still optional AFAIK and I was not paying good
attention to it... Sorry about it

By the way - I can see you're using a CXF interceptor in your configuration
- what stage your custom interceptor sits in - we'll need to update the
JAXRSInInterceptor's phase a bit so we need to be careful not to break some
existing interceptors...

Cheers, Sergey


I just did an upgrade to cxf 2.1.2 and my injection is not working now. I
can't figure out

my beans.xml and sample code is below

<?xml version=*"1.0"* encoding=*"UTF-8"*?>

<beans xmlns=*"http://www.springframework.org/schema/beans"*

xmlns:xsi=*"http://www.w3.org/2001/XMLSchema-instance"*

xmlns:jaxrs=*"http://cxf.apache.org/jaxrs"*

xmlns:cxf=*"http://cxf.apache.org/core"*

xsi:schemaLocation=*"

http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd

http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd

http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"*>

<import resource=*"classpath:META-INF/cxf/cxf.xml"* />

<import
resource=*"classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"*
/>

<import resource=*"classpath:META-INF/cxf/cxf-servlet.xml"* />

<jaxrs:server id=*"documentQ"* address=*"/"*>

<jaxrs:serviceBeans>

<ref bean=*"docQService"*/>

</jaxrs:serviceBeans>

<jaxrs:providers>

<bean class=*"org.gg.providers.MapProvider"* />

</jaxrs:providers>

<jaxrs:inInterceptors>

<bean class=*"org.gg.interceptors.SessionInterceptor"* />

</jaxrs:inInterceptors>

<jaxrs:features><cxf:logging /></jaxrs:features>

</jaxrs:server>

<bean id=*"docQService"* class=*"org.gg.services.LoginService"*></bean>

</beans>



and my sample code



*/

@Path("/Login")
*

public* *class* LoginService

{

*private* *static* *final* Logger *logger* = Logger.*getLogger*
(LoginService.*class*);

@Resource HttpServletRequest request;

@Resource HttpServletResponse response;

@Resource ServletContext servletContext;



@POST

@Path("/authenticate")

//@ConsumeMime("application/x-*www*-form-*urlencoded*")

@ConsumeMime("*/*")

*public* Response login(MultivaluedMap<String, String> parameters)

{

String userID = *null*;

*if* (request.getSession().getAttribute("employee") == *null*) {

my request here is coming null






Reply via email to