You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Prateek Temkar <pr...@gmail.com> on 2009/04/03 00:42:09 UTC

Re: Implemented JAX-RS support

Hi,
  I have attached the source-code, test samples and a document
describing the changes to the JIRA TUSCANY-2919
(https://issues.apache.org/jira/browse/TUSCANY-2919).
Let me know if you need more information.
Can the JIRA be assigned?

thnx,
-Prateek Temkar

On Wed, Mar 18, 2009 at 11:39 AM, Raymond Feng <en...@gmail.com> wrote:
> Thanks. This is great. I look forward to seeing the code and working with
> you to refine it.
>
> Raymond
> --------------------------------------------------
> From: "Prateek Temkar" <pr...@gmail.com>
> Sent: Wednesday, March 18, 2009 10:57 AM
> To: <de...@tuscany.apache.org>
> Subject: Re: Implemented JAX-RS support
>
>> Created JIRA TUSCANY-2919
>> (https://issues.apache.org/jira/browse/TUSCANY-2919)
>>
>> I'll post the code in a week. Need to do some refactoring to remove
>> stuff not pertaining to the JAX-RS extension.
>>
>> thnx,
>> -Prateek Temkar
>>
>>
>> --------------------------------------------------------------------------------------------------------------------------------------
>>
>>
>>
>> On Tue, Mar 17, 2009 at 3:22 PM, Luciano Resende <lu...@gmail.com>
>> wrote:
>>>
>>> On Tue, Mar 17, 2009 at 3:08 PM, Prateek Temkar <pr...@gmail.com>
>>> wrote:
>>>>
>>>> Hello All,
>>>>
>>>>    We have been working on a REST binding in Tuscany and have been
>>>> able to implement one. It  lets the Tuscany components expose RESTful
>>>> services in addition to other services they can already expose. We
>>>> have used Jersey, the JAX-RS Reference implementation developed by
>>>> Sun.
>>>>
>>>
>>> Great, Jersey is licensed under CDDL and we would be able to use it
>>> based on Apache Third-Party Licensing Policy.
>>>
>>> [1] http://www.apache.org/legal/3party.html
>>>
>>>> I came across
>>>> http://www.mail-archive.com/dev@tuscany.apache.org/msg05857.html
>>>> where Tuscany devs have expressed interest in implementing JAX-RS
>>>> support and  figured that I'd share what we have done. (Unfortunately,
>>>> I could not reply to that thread and had to start a new one as I had
>>>> not subscribed to the dev mailer)
>>>>
>>>> At a high level, what we do is, after Tuscany identifies that the
>>>> binding involved is the REST-binding, we transfer the request to
>>>> Jersey's ServletContainer. Jersey facilitates the addition of runtime
>>>> annotations to Java programming language class files to define
>>>> resources and the actions that can be performed on those resources.
>>>> Plain Jersey would identify the method (and the arguments )to be
>>>> invoked on a root resource class instance given the URI; Instead, we
>>>> invoke a method in our binding (Tuscany), details below, and return
>>>> the result to Jersey which forms and returns the Http response.
>>>>
>>>> Here is what we have done in detail:
>>>>
>>>>  - Tuscany ships with the JSON RPC binding. We replicated the JSONRPC
>>>> binding and made the ServiceServlet forward all REST-requests to
>>>> Jersey's servlet engine.
>>>>
>>>> -We have modified Jersey source code.
>>>> When Jersey is done mapping the URI to the resource and interpreting
>>>> all the annotations in the resource, it transfers control to Tuscany
>>>> (rest-runtime-binding) by invoking a method in our binding. Jersey has
>>>> the following information: - The resource instance on which the method
>>>> is to be invoked, - The Method object corresponding to the method to
>>>> be invoked, - The arguments to the method.
>>>>
>>>>  - We pass the Method object and the arguments to Tuscany by invoking
>>>> a method. We don't pass the instance right away but save it in a
>>>> static map with the thread id as the key (it is a single thread of
>>>> execution). This method creates an instance of Operation using the
>>>> method information and calls wire.invoke() with the Operation and the
>>>> method arguments.
>>>>
>>>>  - Inside the ReflectiveInstanceFactory, in the newInstance() method,
>>>> we get the instance that Jersey has stored in its map (using the
>>>> thread id) and let Tuscany's Injectors operate on it.The result is
>>>> returned by the same chain back to Jersey which eventually returns the
>>>> http response.
>>>>
>>>> We are aware that there are better ways to officially extend Tuscany
>>>> like how Raymond mentioned at
>>>> http://www.mail-archive.com/dev@tuscany.apache.org/msg05857.html but
>>>> nevertheless thought we'd share our experience. We would be more than
>>>> happy to discuss contributing our code back to Tuscany if there is
>>>> enough interest.
>>>>
>>>
>>> This is really good, please raise a JIRA and provide the extension so
>>> we can provide any feedback and get it applied to Tuscany svn.
>>>
>>>> thnx,
>>>>
>>>> - Prateek Temkar
>>>>
>>>
>>>
>>>
>>> --
>>> Luciano Resende
>>> Apache Tuscany, Apache PhotArk
>>> http://people.apache.org/~lresende
>>> http://lresende.blogspot.com/
>>>
>

Re: Implemented JAX-RS support

Posted by Raymond Feng <en...@gmail.com>.
Hi, Prateek.

Now we have an Apache licensed JAX-RS implementation from Apache Wink 
(http://incubator.apache.org/wink/). They released the 1st version that 
passes the TCK. Are you interested in porting the prototype from Jersey to 
Wink?

Thanks,
Raymond
--------------------------------------------------
From: "Prateek Temkar" <pr...@gmail.com>
Sent: Thursday, April 30, 2009 1:53 PM
To: <de...@tuscany.apache.org>
Subject: Re: Implemented JAX-RS support

> After Tuscany identifies that the binding involved is the
> REST-binding, we transfer the request to
> Jersey's ServletContainer. Jersey identifies the method (and the
> arguments )to be
> invoked on a root resource class instance given the URI; Instead of
> letting Jersey invoke the method in
> (com.sun.jersey.impl.model.method.dispatch.EntityParamDispatchProvider) , 
> we
> invoke a method in our binding (Tuscany) which in turn calls 
> wire.invoke(),
> and return the result to Jersey which forms and returns the Http response.
>
>
> On Mon, Apr 27, 2009 at 11:09 AM, Luciano Resende <lu...@gmail.com> 
> wrote:
>> On Mon, Apr 27, 2009 at 10:57 AM, Prateek Temkar <pr...@gmail.com> 
>> wrote:
>>> Hi,
>>> Jersey has a dual license. Would GPL not allow us to use modified
>>> Jersey as long as we publish the mods?
>>>
>>
>> GPL Dependencies are not compatible with Apache License.
>> Maybe you could explain what kind of modifications you needed from
>> Jersey, and there is anything we can do on the Tuscany extension side
>> to workaround any issues.
>>
>>
>> --
>> Luciano Resende
>> Apache Tuscany, Apache PhotArk
>> http://people.apache.org/~lresende
>> http://lresende.blogspot.com/
>> 

Re: Implemented JAX-RS support

Posted by Prateek Temkar <pr...@gmail.com>.
After Tuscany identifies that the binding involved is the
REST-binding, we transfer the request to
Jersey's ServletContainer. Jersey identifies the method (and the
arguments )to be
invoked on a root resource class instance given the URI; Instead of
letting Jersey invoke the method in
(com.sun.jersey.impl.model.method.dispatch.EntityParamDispatchProvider) , we
invoke a method in our binding (Tuscany) which in turn calls wire.invoke(),
and return the result to Jersey which forms and returns the Http response.


On Mon, Apr 27, 2009 at 11:09 AM, Luciano Resende <lu...@gmail.com> wrote:
> On Mon, Apr 27, 2009 at 10:57 AM, Prateek Temkar <pr...@gmail.com> wrote:
>> Hi,
>> Jersey has a dual license. Would GPL not allow us to use modified
>> Jersey as long as we publish the mods?
>>
>
> GPL Dependencies are not compatible with Apache License.
> Maybe you could explain what kind of modifications you needed from
> Jersey, and there is anything we can do on the Tuscany extension side
> to workaround any issues.
>
>
> --
> Luciano Resende
> Apache Tuscany, Apache PhotArk
> http://people.apache.org/~lresende
> http://lresende.blogspot.com/
>

Re: Implemented JAX-RS support

Posted by Luciano Resende <lu...@gmail.com>.
On Mon, Apr 27, 2009 at 10:57 AM, Prateek Temkar <pr...@gmail.com> wrote:
> Hi,
> Jersey has a dual license. Would GPL not allow us to use modified
> Jersey as long as we publish the mods?
>

GPL Dependencies are not compatible with Apache License.
Maybe you could explain what kind of modifications you needed from
Jersey, and there is anything we can do on the Tuscany extension side
to workaround any issues.


-- 
Luciano Resende
Apache Tuscany, Apache PhotArk
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: Implemented JAX-RS support

Posted by Prateek Temkar <pr...@gmail.com>.
Hi,
Jersey has a dual license. Would GPL not allow us to use modified
Jersey as long as we publish the mods?

-Prateek Temkar

On Fri, Apr 24, 2009 at 10:17 AM, ant elder <an...@apache.org> wrote:
> I commented about that in the JIRA, unfortunately its not ok so there needs
> to be a way to either avoid needing the mods or to use an ASF compatible
> licensed JAXRS impl like the CXF one or the newly proposed wink incubator
> project.
>
>    ...ant
>
> On Fri, Apr 24, 2009 at 4:38 PM, Raymond Feng <en...@gmail.com> wrote:
>>
>> Hi,
>>
>> In the patch, there are some modifications in the Jersey source code which
>> is CDDL licensed. Is it ok to do so under Apache?
>>
>> Thanks,
>> Raymond
>> --------------------------------------------------
>> From: "ant elder" <an...@gmail.com>
>> Sent: Friday, April 24, 2009 4:21 AM
>> To: <de...@tuscany.apache.org>
>> Subject: Re: Implemented JAX-RS support
>>
>>> On Thu, Apr 23, 2009 at 9:42 PM, Prateek Temkar <pr...@gmail.com>
>>> wrote:
>>>>
>>>> Hi!
>>>>  I have uploaded the files that fix the issues I had mentioned earlier.
>>>> The JIRA (https://issues.apache.org/jira/browse/TUSCANY-2919) has also
>>>> been updated.
>>>>
>>>> thnx,
>>>> -Prateek Temkar
>>>>
>>>
>>> Hi Prateek, many thanks for this it looks great. I guess the others
>>> have been busy so i've started committing this, see the JIRA for
>>> details.
>>>
>>>  ...ant
>>
>
>

Re: Implemented JAX-RS support

Posted by ant elder <an...@apache.org>.
I commented about that in the JIRA, unfortunately its not ok so there needs
to be a way to either avoid needing the mods or to use an ASF compatible
licensed JAXRS impl like the CXF one or the newly proposed wink incubator
project.

   ...ant

On Fri, Apr 24, 2009 at 4:38 PM, Raymond Feng <en...@gmail.com> wrote:

> Hi,
>
> In the patch, there are some modifications in the Jersey source code which
> is CDDL licensed. Is it ok to do so under Apache?
>
> Thanks,
> Raymond
> --------------------------------------------------
> From: "ant elder" <an...@gmail.com>
> Sent: Friday, April 24, 2009 4:21 AM
> To: <de...@tuscany.apache.org>
> Subject: Re: Implemented JAX-RS support
>
>  On Thu, Apr 23, 2009 at 9:42 PM, Prateek Temkar <pr...@gmail.com>
>> wrote:
>>
>>> Hi!
>>>  I have uploaded the files that fix the issues I had mentioned earlier.
>>> The JIRA (https://issues.apache.org/jira/browse/TUSCANY-2919) has also
>>> been updated.
>>>
>>> thnx,
>>> -Prateek Temkar
>>>
>>>
>> Hi Prateek, many thanks for this it looks great. I guess the others
>> have been busy so i've started committing this, see the JIRA for
>> details.
>>
>>  ...ant
>>
>
>

Re: Implemented JAX-RS support

Posted by Raymond Feng <en...@gmail.com>.
Hi,

In the patch, there are some modifications in the Jersey source code which 
is CDDL licensed. Is it ok to do so under Apache?

Thanks,
Raymond
--------------------------------------------------
From: "ant elder" <an...@gmail.com>
Sent: Friday, April 24, 2009 4:21 AM
To: <de...@tuscany.apache.org>
Subject: Re: Implemented JAX-RS support

> On Thu, Apr 23, 2009 at 9:42 PM, Prateek Temkar <pr...@gmail.com> 
> wrote:
>> Hi!
>>   I have uploaded the files that fix the issues I had mentioned earlier.
>> The JIRA (https://issues.apache.org/jira/browse/TUSCANY-2919) has also
>> been updated.
>>
>> thnx,
>> -Prateek Temkar
>>
>
> Hi Prateek, many thanks for this it looks great. I guess the others
> have been busy so i've started committing this, see the JIRA for
> details.
>
>   ...ant 


Re: Implemented JAX-RS support

Posted by ant elder <an...@gmail.com>.
On Thu, Apr 23, 2009 at 9:42 PM, Prateek Temkar <pr...@gmail.com> wrote:
> Hi!
>   I have uploaded the files that fix the issues I had mentioned earlier.
> The JIRA (https://issues.apache.org/jira/browse/TUSCANY-2919) has also
> been updated.
>
> thnx,
> -Prateek Temkar
>

Hi Prateek, many thanks for this it looks great. I guess the others
have been busy so i've started committing this, see the JIRA for
details.

   ...ant

Re: Implemented JAX-RS support

Posted by Prateek Temkar <pr...@gmail.com>.
Hi!
   I have uploaded the files that fix the issues I had mentioned earlier.
The JIRA (https://issues.apache.org/jira/browse/TUSCANY-2919) has also
been updated.

thnx,
-Prateek Temkar

On Thu, Apr 16, 2009 at 2:58 PM, Luciano Resende <lu...@gmail.com> wrote:
> On Thu, Apr 16, 2009 at 2:41 PM, Prateek Temkar <pr...@gmail.com> wrote:
>> Hi,
>>    There are a couple of issues with the code that has been uploaded.
>> -Jersey scans for resources more than once (for every servlet mapping added)
>> -Issues when the return type of a method is javax.ws.rs.core.Response
>>
>> I'll upload the fixes soon for the above mentioned issues.
>>
>
> Thanks !
>
>
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://lresende.blogspot.com/
>

Re: Implemented JAX-RS support

Posted by Luciano Resende <lu...@gmail.com>.
On Thu, Apr 16, 2009 at 2:41 PM, Prateek Temkar <pr...@gmail.com> wrote:
> Hi,
>    There are a couple of issues with the code that has been uploaded.
> -Jersey scans for resources more than once (for every servlet mapping added)
> -Issues when the return type of a method is javax.ws.rs.core.Response
>
> I'll upload the fixes soon for the above mentioned issues.
>

Thanks !



-- 
Luciano Resende
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: Implemented JAX-RS support

Posted by Prateek Temkar <pr...@gmail.com>.
Hi,
    There are a couple of issues with the code that has been uploaded.
-Jersey scans for resources more than once (for every servlet mapping added)
-Issues when the return type of a method is javax.ws.rs.core.Response

I'll upload the fixes soon for the above mentioned issues.

thanks,
-Prateek Temkar

On Fri, Apr 3, 2009 at 9:21 AM, Luciano Resende <lu...@gmail.com> wrote:
> On Fri, Apr 3, 2009 at 9:13 AM, Raymond Feng <en...@gmail.com> wrote:
>> Great. Thank you for the contribution.
>>
>> I'll try to find some time next week to understand the code.
>>
>
> Great, I have also started looking into it and will provide any
> feedback early next week on this thread.
>
> --
> Luciano Resende
> Apache Tuscany, Apache PhotArk
> http://people.apache.org/~lresende
> http://lresende.blogspot.com/
>

Re: Implemented JAX-RS support

Posted by Luciano Resende <lu...@gmail.com>.
On Fri, Apr 3, 2009 at 9:13 AM, Raymond Feng <en...@gmail.com> wrote:
> Great. Thank you for the contribution.
>
> I'll try to find some time next week to understand the code.
>

Great, I have also started looking into it and will provide any
feedback early next week on this thread.

-- 
Luciano Resende
Apache Tuscany, Apache PhotArk
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: Implemented JAX-RS support

Posted by Raymond Feng <en...@gmail.com>.
Great. Thank you for the contribution.

I'll try to find some time next week to understand the code.

Thanks,
Raymond
--------------------------------------------------
From: "Prateek Temkar" <pr...@gmail.com>
Sent: Thursday, April 02, 2009 3:42 PM
To: <de...@tuscany.apache.org>
Subject: Re: Implemented JAX-RS support

> Hi,
>  I have attached the source-code, test samples and a document
> describing the changes to the JIRA TUSCANY-2919
> (https://issues.apache.org/jira/browse/TUSCANY-2919).
> Let me know if you need more information.
> Can the JIRA be assigned?
>
> thnx,
> -Prateek Temkar
>
> On Wed, Mar 18, 2009 at 11:39 AM, Raymond Feng <en...@gmail.com> 
> wrote:
>> Thanks. This is great. I look forward to seeing the code and working with
>> you to refine it.
>>
>> Raymond
>> --------------------------------------------------
>> From: "Prateek Temkar" <pr...@gmail.com>
>> Sent: Wednesday, March 18, 2009 10:57 AM
>> To: <de...@tuscany.apache.org>
>> Subject: Re: Implemented JAX-RS support
>>
>>> Created JIRA TUSCANY-2919
>>> (https://issues.apache.org/jira/browse/TUSCANY-2919)
>>>
>>> I'll post the code in a week. Need to do some refactoring to remove
>>> stuff not pertaining to the JAX-RS extension.
>>>
>>> thnx,
>>> -Prateek Temkar
>>>
>>>
>>> --------------------------------------------------------------------------------------------------------------------------------------
>>>
>>>
>>>
>>> On Tue, Mar 17, 2009 at 3:22 PM, Luciano Resende <lu...@gmail.com>
>>> wrote:
>>>>
>>>> On Tue, Mar 17, 2009 at 3:08 PM, Prateek Temkar <pr...@gmail.com>
>>>> wrote:
>>>>>
>>>>> Hello All,
>>>>>
>>>>>    We have been working on a REST binding in Tuscany and have been
>>>>> able to implement one. It  lets the Tuscany components expose RESTful
>>>>> services in addition to other services they can already expose. We
>>>>> have used Jersey, the JAX-RS Reference implementation developed by
>>>>> Sun.
>>>>>
>>>>
>>>> Great, Jersey is licensed under CDDL and we would be able to use it
>>>> based on Apache Third-Party Licensing Policy.
>>>>
>>>> [1] http://www.apache.org/legal/3party.html
>>>>
>>>>> I came across
>>>>> http://www.mail-archive.com/dev@tuscany.apache.org/msg05857.html
>>>>> where Tuscany devs have expressed interest in implementing JAX-RS
>>>>> support and  figured that I'd share what we have done. (Unfortunately,
>>>>> I could not reply to that thread and had to start a new one as I had
>>>>> not subscribed to the dev mailer)
>>>>>
>>>>> At a high level, what we do is, after Tuscany identifies that the
>>>>> binding involved is the REST-binding, we transfer the request to
>>>>> Jersey's ServletContainer. Jersey facilitates the addition of runtime
>>>>> annotations to Java programming language class files to define
>>>>> resources and the actions that can be performed on those resources.
>>>>> Plain Jersey would identify the method (and the arguments )to be
>>>>> invoked on a root resource class instance given the URI; Instead, we
>>>>> invoke a method in our binding (Tuscany), details below, and return
>>>>> the result to Jersey which forms and returns the Http response.
>>>>>
>>>>> Here is what we have done in detail:
>>>>>
>>>>>  - Tuscany ships with the JSON RPC binding. We replicated the JSONRPC
>>>>> binding and made the ServiceServlet forward all REST-requests to
>>>>> Jersey's servlet engine.
>>>>>
>>>>> -We have modified Jersey source code.
>>>>> When Jersey is done mapping the URI to the resource and interpreting
>>>>> all the annotations in the resource, it transfers control to Tuscany
>>>>> (rest-runtime-binding) by invoking a method in our binding. Jersey has
>>>>> the following information: - The resource instance on which the method
>>>>> is to be invoked, - The Method object corresponding to the method to
>>>>> be invoked, - The arguments to the method.
>>>>>
>>>>>  - We pass the Method object and the arguments to Tuscany by invoking
>>>>> a method. We don't pass the instance right away but save it in a
>>>>> static map with the thread id as the key (it is a single thread of
>>>>> execution). This method creates an instance of Operation using the
>>>>> method information and calls wire.invoke() with the Operation and the
>>>>> method arguments.
>>>>>
>>>>>  - Inside the ReflectiveInstanceFactory, in the newInstance() method,
>>>>> we get the instance that Jersey has stored in its map (using the
>>>>> thread id) and let Tuscany's Injectors operate on it.The result is
>>>>> returned by the same chain back to Jersey which eventually returns the
>>>>> http response.
>>>>>
>>>>> We are aware that there are better ways to officially extend Tuscany
>>>>> like how Raymond mentioned at
>>>>> http://www.mail-archive.com/dev@tuscany.apache.org/msg05857.html but
>>>>> nevertheless thought we'd share our experience. We would be more than
>>>>> happy to discuss contributing our code back to Tuscany if there is
>>>>> enough interest.
>>>>>
>>>>
>>>> This is really good, please raise a JIRA and provide the extension so
>>>> we can provide any feedback and get it applied to Tuscany svn.
>>>>
>>>>> thnx,
>>>>>
>>>>> - Prateek Temkar
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Luciano Resende
>>>> Apache Tuscany, Apache PhotArk
>>>> http://people.apache.org/~lresende
>>>> http://lresende.blogspot.com/
>>>>
>>