cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-4205) Please add generic type to javax.ws.rs.core.Response implementation
Date Tue, 27 Mar 2012 16:16:30 GMT

    [ https://issues.apache.org/jira/browse/CXF-4205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13239593#comment-13239593
] 

Sergey Beryozkin commented on CXF-4205:
---------------------------------------

Hi Marko, you are right about having to do use JAXRSClientFactory calls to avoid thread-safety
issues in the ResponseReader provider, assuming different types can be expected.

Now, given that GenericResponse will be CXF specific, why would not we simply return 
{code:java}
@Path("{id})
MetaObject<JaxbObj> retrieve(@PathParam("id");
{code}

and set the header in the out filter ? I believe WADLGenerator would need to be fixed to add
the generic type to the generated context.

Having something like GenericResponse would also require us handling GenericResponse<List<JaxbObj>>,
etc, and the existing filters server side filters won't get that info. My other concern is
that I'm not sure JAX-RS 2.0 will actually go ahead with a similar Response refactoring.


                
> Please add generic type to javax.ws.rs.core.Response implementation
> -------------------------------------------------------------------
>
>                 Key: CXF-4205
>                 URL: https://issues.apache.org/jira/browse/CXF-4205
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>    Affects Versions: 2.5.2
>            Reporter: Marko Voss
>            Assignee: Sergey Beryozkin
>         Attachments: GenericResponse.java, GenericResponseReader.java
>
>
> Let's assume, we have the following JAX-RS interface:
> @Path("/foo")
> public interface Foo {
>   @Path("{id})
>   JaxbObj retrieve(@PathParam("id");
> }
> Now, we want to change some headers for the response, so we have to change the interface
to this:
> @Path("/foo")
> public interface Foo {
>   @Path("{id})
>   Response retrieve(@PathParam("id");
> }
> In our scenario, we want to offer the customers a basic client library, so that they
do not need to implement mapping and everything again. Therefore we are reusing the JAX-RS
interfaces on the client-side. Thanks to the maven dependency techniques the client library
will also inherit the generated JAXB classes, CXF setup and everything else, the client requires
to communicate with the server.
> So the client will now have to deal with the Object supplied by the Response.getEntity()
method and kinda have to guess the type. If the Response type would be generic, there would
not be such an issue. (example: Response<JaxbObj>)
> Since you may not be responsible for the Response interface, maybe you could add an extended
interface or implementation.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message