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 (JIRA)" <de...@tuscany.apache.org> on 2009/03/18 18:51:50 UTC

[jira] Created: (TUSCANY-2919) Implement JAX-RS Support in Tuscany 1.4

Implement JAX-RS Support in Tuscany 1.4
---------------------------------------

                 Key: TUSCANY-2919
                 URL: https://issues.apache.org/jira/browse/TUSCANY-2919
             Project: Tuscany
          Issue Type: New Feature
         Environment: Windows/Linux; Tomcat/Jetty
            Reporter: Prateek Temkar
             Fix For: Java-SCA-1.4


 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

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. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TUSCANY-2919) Implement JAX-RS Support in Tuscany 1.4

Posted by "ant elder (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12702329#action_12702329 ] 

ant elder commented on TUSCANY-2919:
------------------------------------

Prateek, this is really great, i'd love to have JAX-RS support in Tuscany so i really encourage you to continue developing this, i'm sure you'll find everyone here will give you all and any help you need.

To help things along i've started commiting this to our 2.x code stream in r768260 see:
https://svn.apache.org/repos/asf/tuscany/java/sca/modules/binding-rest/
https://svn.apache.org/repos/asf/tuscany/java/sca/modules/binding-rest-runtime/
https://svn.apache.org/repos/asf/tuscany/java/sca/samples/webapps/helloworld-rest/

I've put this in the Tuscany 2.x codestream for now as i'd like to be able to use it in 2.x, but also because i think it will be easier (and help with) to use the web integration in 2.x whereas the 1.x webapp integration is a little fragile. If you really need this for 1.x we can move it there np, or have it in both, but if you don't have a requirement for 1.x i'd prefer to use 2.x for now.

There's one big issue we need to find a solution for right away, this is using a modified version of Jersey and we can't do that here in the ASF because it uses the CDDL license so we can only use it as a binary dependency. Have you looked at any other JAXRS impls besides Jersey? One possibility would be to use a different JAXRS impl, Apache CXF has one - http://repo2.maven.org/maven2/org/apache/cxf/cxf-bundle-jaxrs/2.2/. 


  

> Implement JAX-RS Support in Tuscany 1.4
> ---------------------------------------
>
>                 Key: TUSCANY-2919
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2919
>             Project: Tuscany
>          Issue Type: New Feature
>         Environment: Windows/Linux; Tomcat/Jetty
>            Reporter: Prateek Temkar
>             Fix For: Java-SCA-1.4
>
>         Attachments: jersey-server.zip, SamplesAndDoc.zip, tuscanyModules.zip
>
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
>  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
> 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. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TUSCANY-2919) Implement JAX-RS Support in Tuscany 1.4

Posted by "Prateek Temkar (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Prateek Temkar updated TUSCANY-2919:
------------------------------------

    Attachment:     (was: jersey-server.zip)

> Implement JAX-RS Support in Tuscany 1.4
> ---------------------------------------
>
>                 Key: TUSCANY-2919
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2919
>             Project: Tuscany
>          Issue Type: New Feature
>         Environment: Windows/Linux; Tomcat/Jetty
>            Reporter: Prateek Temkar
>             Fix For: Java-SCA-1.4
>
>         Attachments: jersey-server.zip, SamplesAndDoc.zip, tuscanyModules.zip
>
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
>  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
> 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. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TUSCANY-2919) Implement JAX-RS Support in Tuscany 1.4

Posted by "Prateek Temkar (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Prateek Temkar updated TUSCANY-2919:
------------------------------------

    Remaining Estimate: 336h  (was: 168h)
     Original Estimate: 336h  (was: 168h)

> Implement JAX-RS Support in Tuscany 1.4
> ---------------------------------------
>
>                 Key: TUSCANY-2919
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2919
>             Project: Tuscany
>          Issue Type: New Feature
>         Environment: Windows/Linux; Tomcat/Jetty
>            Reporter: Prateek Temkar
>             Fix For: Java-SCA-1.4
>
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
>  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
> 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. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TUSCANY-2919) Implement JAX-RS Support in Tuscany 1.4

Posted by "Prateek Temkar (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704797#action_12704797 ] 

Prateek Temkar commented on TUSCANY-2919:
-----------------------------------------

ok. Is there support for webapp integration in CXF?

> Implement JAX-RS Support in Tuscany 1.4
> ---------------------------------------
>
>                 Key: TUSCANY-2919
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2919
>             Project: Tuscany
>          Issue Type: New Feature
>         Environment: Windows/Linux; Tomcat/Jetty
>            Reporter: Prateek Temkar
>             Fix For: Java-SCA-1.4
>
>         Attachments: jersey-server.zip, SamplesAndDoc.zip, tuscanyModules.zip
>
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
>  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
> 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. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TUSCANY-2919) Implement JAX-RS Support in Tuscany 1.4

Posted by "Prateek Temkar (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Prateek Temkar updated TUSCANY-2919:
------------------------------------

    Attachment: jersey-server.zip
                SamplesAndDoc.zip
                tuscanyModules.zip

Please refer to the doc (contribute JAX-RS to Tuscany_1-4.doc) for the exact changes.

Attaching the following:

- tuscanyModules.zip (Tuscany 1.4)
Includes the following modules: binding-rest, binding-rest-runtime, host-webapp, implementation-java-runtime

- jersey-server.zip(1.0.1-Snapshot)
I could not attach the whole Jersey distribution because it exceeded 10.00 MB. I have only changed jersey-server.

- SamplesAndDoc.zip
Samples to test the REST binding and Document on contents of the changed/newly added modules.

> Implement JAX-RS Support in Tuscany 1.4
> ---------------------------------------
>
>                 Key: TUSCANY-2919
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2919
>             Project: Tuscany
>          Issue Type: New Feature
>         Environment: Windows/Linux; Tomcat/Jetty
>            Reporter: Prateek Temkar
>             Fix For: Java-SCA-1.4
>
>         Attachments: jersey-server.zip, SamplesAndDoc.zip, tuscanyModules.zip
>
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
>  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
> 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. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TUSCANY-2919) Implement JAX-RS Support in Tuscany 1.4

Posted by "Prateek Temkar (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12699907#action_12699907 ] 

Prateek Temkar commented on TUSCANY-2919:
-----------------------------------------

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.



> Implement JAX-RS Support in Tuscany 1.4
> ---------------------------------------
>
>                 Key: TUSCANY-2919
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2919
>             Project: Tuscany
>          Issue Type: New Feature
>         Environment: Windows/Linux; Tomcat/Jetty
>            Reporter: Prateek Temkar
>             Fix For: Java-SCA-1.4
>
>         Attachments: jersey-server.zip, SamplesAndDoc.zip, tuscanyModules.zip
>
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
>  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
> 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. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TUSCANY-2919) Implement JAX-RS Support in Tuscany 1.4

Posted by "Prateek Temkar (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703241#action_12703241 ] 

Prateek Temkar commented on TUSCANY-2919:
-----------------------------------------

Hi Ant,
Jersey is also licensed under the GPL. Would it not be ok if we modify as long as we publish the modified versions?

> Implement JAX-RS Support in Tuscany 1.4
> ---------------------------------------
>
>                 Key: TUSCANY-2919
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2919
>             Project: Tuscany
>          Issue Type: New Feature
>         Environment: Windows/Linux; Tomcat/Jetty
>            Reporter: Prateek Temkar
>             Fix For: Java-SCA-1.4
>
>         Attachments: jersey-server.zip, SamplesAndDoc.zip, tuscanyModules.zip
>
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
>  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
> 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. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TUSCANY-2919) Implement JAX-RS Support in Tuscany 1.4

Posted by "ant elder (JIRA)" <de...@tuscany.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703526#action_12703526 ] 

ant elder commented on TUSCANY-2919:
------------------------------------

Unfortunatley no. Neither GPL or CDDL can be used for source code within the ASF because both those license place restrictions on the source and distribution. CDDL is ok for using Jersey as a binary dependency but we can not modify its source. If you really want to understand this more see http://www.apache.org/legal/ramblings.html

So, we either need to find a way for this new binding to use Jersey unmodified or to find a new JAX-RS implementation with a different license. The most obvious choice today would be the JAX-RS impl from Apache CXF, see [1] and [2]. There is also a new a new project starting up called Wink [3] providing some competition to CXF soyou may find people very willing to come help to gett this using their project.

[1] http://repo2.maven.org/maven2/org/apache/cxf/cxf-bundle-jaxrs/2.2.1/
[2] http://cwiki.apache.org/CXF20DOC/jax-rs.html
[3] http://wiki.apache.org/incubator/WinkProposal


> Implement JAX-RS Support in Tuscany 1.4
> ---------------------------------------
>
>                 Key: TUSCANY-2919
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2919
>             Project: Tuscany
>          Issue Type: New Feature
>         Environment: Windows/Linux; Tomcat/Jetty
>            Reporter: Prateek Temkar
>             Fix For: Java-SCA-1.4
>
>         Attachments: jersey-server.zip, SamplesAndDoc.zip, tuscanyModules.zip
>
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
>  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
> 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. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TUSCANY-2919) Implement JAX-RS Support in Tuscany 1.4

Posted by "Prateek Temkar (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Prateek Temkar updated TUSCANY-2919:
------------------------------------

    Attachment:     (was: tuscanyModules.zip)

> Implement JAX-RS Support in Tuscany 1.4
> ---------------------------------------
>
>                 Key: TUSCANY-2919
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2919
>             Project: Tuscany
>          Issue Type: New Feature
>         Environment: Windows/Linux; Tomcat/Jetty
>            Reporter: Prateek Temkar
>             Fix For: Java-SCA-1.4
>
>         Attachments: jersey-server.zip, SamplesAndDoc.zip, tuscanyModules.zip
>
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
>  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
> 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. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TUSCANY-2919) Implement JAX-RS Support in Tuscany 1.4

Posted by "Prateek Temkar (JIRA)" <de...@tuscany.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Prateek Temkar updated TUSCANY-2919:
------------------------------------

    Attachment: tuscanyModules.zip
                jersey-server.zip

There were following issues with the previously uploaded code:
-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 have updated the following files to fix the above mentioned issues:
jersey-server (EntityParamDispatchProvider.java)
host-webapp (WebAppServletHost.java)
binding-rest-runtime (RESTServiceServlet.java)

Also, for the SimpleCalculatorRESTandSOAP sample, add the following to the composite file:
targetNamespace="http://sample"

> Implement JAX-RS Support in Tuscany 1.4
> ---------------------------------------
>
>                 Key: TUSCANY-2919
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2919
>             Project: Tuscany
>          Issue Type: New Feature
>         Environment: Windows/Linux; Tomcat/Jetty
>            Reporter: Prateek Temkar
>             Fix For: Java-SCA-1.4
>
>         Attachments: jersey-server.zip, SamplesAndDoc.zip, tuscanyModules.zip
>
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
>  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
> 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. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.