On 02/10/12 15:25, Behzad Pirvali wrote:
Sure, certainly I will cc the group!

Yes, injection worked as you said :)
But, I do not quite understand How?

In case of Spring (except for Spring AOP), objects are injected by
appContext, but it is more of a one time deal during the initialization.
Here, these parameters are different on every incoming call.
So, unless, CXF is using dynamic proxies or Spring-AOP, I do not
understand how this is possible?

That being said, thank u SO MUCH as it is now working even though I am
not sure how the injection is done :)

The JAX-RS runtime introspects the root resource classes and injects thread-local proxies into the fields annotated with @Context

Cheers, Sergey

Thanks,
Behzad


On Tue, Oct 2, 2012 at 1:52 AM, Sergey Beryozkin <[email protected]
<mailto:[email protected]>> wrote:

    Hi,

    Lets keep the users list in the loop, please keep CC-ing to it...


    On 02/10/12 07:53, Behzad Pirvali wrote:

        Hi Sergey,

        Using -tMap I was able to get it work.


    OK, good to know this new parameter can help in cases when the
    bindings overwrite the generated class names,


        Now, I just need to figure out some thing regarding: @Context
        Request &
        @Context UriInfo like in:

        public Response add(@Context Request request, @Context UriInfo
        uriInfo,
        BookState st)


        You mentioned something about injecting @Context, but I am not
        sure what
        you meant
        Do you like a Spring Bean?


    As I explained in the previous email: get it injected into an
    implementation class's field, using @Context annotation, the runtime
    will deal with the actual injection...

    Sergey


        Thank u so much,
        Behzad

        On Fri, Sep 28, 2012 at 3:47 AM, Behzad Pirvali
        <[email protected] <mailto:[email protected]>
        <mailto:[email protected] <mailto:[email protected]>>> wrote:

             Hi Sergey,

             Thank You so much for your response.

             I was going to reply in the forum so that everyone with my
        problem
             could use your answer.
             I have checked both Stack Overflow and cxf-forum, but did
        not see
             any replies there.
             That is why I am replying to your email.

             1)
             With Injecting Request into a class field, you mean using
        Spring?
             But how do I make Spring to know about the incoming Request
        object?

             2)
             Do you have any idea on how to get WADL so that generated
             update(PUT) interface has both parameter?
             Currently, the generated update(...) is:
                  - update(@PathParam("isbn") String isbn)
             instead of:
                  - update(@PathParam("isbn") String isbn, BookState st)

             Thank u SO MUCH,
             Behzad


             Here is the whole WADL:

        <application xmlns="http://wadl.dev.java.__net/2009/02
        <http://wadl.dev.java.net/2009/02>"
             xmlns:xs="http://www.w3.org/__2001/XMLSchema
        <http://www.w3.org/2001/XMLSchema>"
               xmlns:prefix1="http://bp.com/__bs <http://bp.com/bs>">
        <grammars>
        <schema xmlns="http://www.w3.org/2001/__XMLSchema
        <http://www.w3.org/2001/XMLSchema>"
             targetNamespace="http://bp.__com/bs <http://bp.com/bs>"
             xmlns:tns="http://bp.com/bs"; elementFormDefault="qualified"__>
        <element name="book">
        <complexType>
        <sequence>
        <element name="isbn" type="string"></element>
        <element name="title" type="string"></element>
        </sequence>
        </complexType>
        </element>
        </schema>
        <!-- <include href="BookService.xsd"/>  -->
        </grammars>
        <resources base="http://localhost:8080/bs__";>
        <resource path="/books" id="com.bp.bs.BookResource">
        <method name="POST" id="add" >
        <request>
        <representation mediaType="application/octet-__stream" />
        </request>
        <response>
        <representation mediaType="application/octet-__stream" />
        </response>
        </method>
        <resource path="/{isbn}">
        <param name="isbn" style="template" type="xs:string" />
        <method name="DELETE" id="delete" >
        <request />
        <response>
        <representation mediaType="application/octet-__stream" />
        </response>
        </method>
        <method name="GET" id="get" >
        <request />
        <response>
        <representation mediaType="application/xml"
        element="prefix1:book" />
        </response>
        </method>
        <method name="PUT" id="update" >
        <request>
        <representation mediaType="application/xml"
        element="prefix1:book" />
        <!-- <representation mediaType="application/octet-__stream" /> -->
        </request>
        <response>
        <representation mediaType="application/octet-__stream" />
        </response>
        </method>
        </resource>
        </resource>
        </resources>
        </application>



             On Fri, Sep 28, 2012 at 1:41 AM, Sergey Beryozkin
        <[email protected] <mailto:[email protected]>
        <mailto:[email protected] <mailto:[email protected]>>> wrote:

                 Hi,

                 Redirecting to the users,
                 On 27/09/12 19:17, bpirvali wrote:

                     Hi Guys,

                     I went through the documentation, which helped me
        figure out
                     several issues
                     I had, but not the following two problems:

                     1) I have got a get(GET) method: get(@Context
        Request request,
                     @PathParam("isbn")String isbn)
                     How do I formulate the WADL for it so that I get the
                     @Context in the
                     produced Java code?


                 It is not possible to express that in WADL because
        @Context is
                 meant to capture a request information for the benefit
        of a service.

                 Instead, get the tool to generate an interface only,
        and have
        'Request' injected into the implementation class field

                     2) I have got a update (PUT) method:
                     update(@PathParam("isbn") String isbn,
                     BookState st)
                     How do I formuate the WADL to get the BookState in the
                     produced Java code?

                     Here is my current WADL, which does not do it:
        <resource path="/{isbn}">

                               ....
        <method name="GET" id="get">
        <request />
        <response>
        <representation mediaType="application/xml"
                     element="prefix1:book" />
        </response>
        </method>
        <method name="PUT" id="update">
        <request>
        <representation mediaType="application/xml"
                     element="prefix1:book" />

        </request>
        <response>
        <representation mediaType="application/octet-____stream" />

        </response>
        </method>
        </resource>

                 what about a response type for 'get'? May be you can
        paste the
                 schema fragment ?

                 Sergey



                     Thank u so much,
                     Behzad




                     --
                     View this message in context:
        
http://cxf.547215.n5.nabble.____com/Need-some-help-with-____WADL2Java-Tool-tp5714978.html

        
<http://cxf.547215.n5.nabble.__com/Need-some-help-with-__WADL2Java-Tool-tp5714978.html
        
<http://cxf.547215.n5.nabble.com/Need-some-help-with-WADL2Java-Tool-tp5714978.html>>
                     Sent from the cxf-issues mailing list archive at
        Nabble.com.






             --
             Thanks,
             Behzad




        --
        Thanks,
        Behzad




--
Thanks,
Behzad

Reply via email to