tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Luis Cetina <maxtorz...@gmail.com>
Subject Re: JAX-RS
Date Fri, 17 Oct 2014 04:06:01 GMT
@Romain, im trying to do a lookup for getting an ejb from my jax-rs filter
(using org.apache.cxf.jaxrs.ext.RequestHandler) but theres only a
java:comp/env with nothing else inside, i could not access to java:global
because it doesnt "exist" but if i access inside of my resourceclass i
could access, why?


@Path("/xx/yy")
public class MyResource {

  anyMethod(){
      //here i can get a reference of my ejb   :)
       new InitialContext().doLookup("java:global....");
    }
}


@Provider
public MyFilter implements RequestHandler{

@Override
    public Response handleRequest(Message message, ClassResourceInfo
classResourceInfo) {
         //HERE I CANT get a reference of my ejb, because java:global
doesnt exists!!    :(
       new InitialContext().doLookup("java:global....");
     }
}


1. I just want to get access from my ejb to validate user information in
the database, is there any other way get access to my ejb or database
resource from my cxf filter?

2. Why inside of my filter i could not do a lookup to java:global.... ??
why it doesnt exists?

Im still using TomEE 1.7.1 (jax-rs) with the default apache cxf version



2014-10-16 16:54 GMT-05:00 José Luis Cetina <maxtorzito@gmail.com>:

> Ok, thanks.
>
> 2014-10-16 13:30 GMT-05:00 Romain Manni-Bucau <rmannibucau@tomitribe.com>:
>
> 2014-10-16 20:17 GMT+02:00 José Luis Cetina <maxtorzito@gmail.com>:
>> > I understand now.  Apache CXF implements JSR-311 wich is JAX-RS 1.1
>> > compliant.
>> >
>> > I could see that CXF 3.x is JAX-RS 2.0 compliant.
>> >
>> > 1. Is there any plan to upgrade TomEE with CXF 3.X?
>> >
>>
>> done on trunk
>>
>> > 2. If i need to use some feature in JAX-RS 2.0 could i another
>> > implementation like jersey or rest easy with tomee 1.7.1?
>> >
>>
>> or cxf with the same quality as jersey, resteasy...: ie no EE
>> integration excepted cdi
>>
>> cxf 3 can work on tomee webprofile with some jar updates/changes
>>
>> > Thanks
>> >
>> > 2014-10-16 12:53 GMT-05:00 José Luis Cetina <maxtorzito@gmail.com>:
>> >
>> >> Thanks @Romain, then how can i use the "standard way" of JAX-RS filter
>> >> with Tomee? I want to use ContainerResponseFilter is possible? if yes,
>> how?
>> >>
>> >> 2014-10-16 12:49 GMT-05:00 Romain Manni-Bucau <
>> rmannibucau@tomitribe.com>:
>> >>
>> >> 2014-10-16 19:47 GMT+02:00 José Luis Cetina <maxtorzito@gmail.com>:
>> >>> > Hi i want to use a Filter for my rest services, im reading the
>> apache
>> >>> cxf
>> >>> > doc, i could create my filter implementing RequestHandler
>> interfaces and
>> >>> > start using it.
>> >>> >
>> >>> > After reading more i saw this:
>> >>> > CXF RequestHandler and ResponseHandler filters have been removed,
>> please
>> >>> > use JAX-RS 2.0 ContainerRequestFilter and ContainerResponseFilter
>> and
>> >>> also
>> >>> > WriterInterceptor and ReaderInterceptor when needed.  (
>> >>> > http://cxf.apache.org/docs/30-migration-guide.html )
>> >>> >
>> >>> > Then i try to change RequestHandler to ContainerResponseFilter
when
>> i
>> >>> try
>> >>> > to run my webapp i could see java.lang.NoClassDefFoundError:
>> >>> > javax/ws/rs/container/ContainerRequestFilter.
>> >>> >
>> >>> > Then i have this questions.
>> >>> >
>> >>> > 1. What version of Apache CXF is using TomEE 1.7.1? i guess 2.6.14
>> can i
>> >>> > upgrade to apaache cxf 3.x? if yes, how?  which jars do i have
to
>> >>> remove?
>> >>> >
>> >>>
>> >>> No you cant'
>> >>>
>> >>> > 2. Is ContainerRequestFilter only available in CXF 3.x? If no then
>> why
>> >>> im
>> >>> > getting NoClassDefFoundError?
>> >>> >
>> >>>
>> >>> In jaxrs2 actually but yes
>> >>>
>> >>> > 3. Is possible to inject and ejb using @EJB into this filter?
>> Because i
>> >>> > tried and always is null. If is possible how?
>> >>> >
>> >>>
>> >>> not in cxf components
>> >>>
>> >>> > 4. Is ContainerResponseFilter the "standard way" to use filters
in
>> >>> jax-rs?
>> >>> > If yes how can i use it, do i need another dependency?
>> >>> >
>> >>>
>> >>> cxf has a nice page speaking about difference between cxf interceptors
>> >>> and jaxrs new APIs, this is not 1-1 and cxf interceptors are still
>> >>> useful but yes jaxrs has now a standard API to use if possible. Note
>> >>> in cxf 3 handler were removed for standard filters.
>> >>>
>> >>> >
>> >>> > I just want to use a JAX-RS filter i dont care to use CXF
>> interceptors
>> >>> or
>> >>> > filters extended.
>> >>> >
>> >>> >
>> >>> > Im using TomEE 1.7.1 JAX-RS
>> >>> >
>> >>> > --
>> >>> > -------------------------------------------------------------------
>> >>> > *José Luis Cetina*
>> >>> > -------------------------------------------------------------------
>> >>>
>> >>
>> >>
>> >>
>> >> --
>> >> -------------------------------------------------------------------
>> >> *José Luis Cetina*
>> >> -------------------------------------------------------------------
>> >>
>> >
>> >
>> >
>> > --
>> > -------------------------------------------------------------------
>> > *José Luis Cetina*
>> > -------------------------------------------------------------------
>>
>
>
>
> --
> -------------------------------------------------------------------
> *José Luis Cetina*
> -------------------------------------------------------------------
>



-- 
-------------------------------------------------------------------
*José Luis Cetina*
-------------------------------------------------------------------

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message