[ 
https://issues.apache.org/jira/browse/CXF-6001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

iris ding updated CXF-6001:
---------------------------
    Attachment: CXF-6001.patch

> CXF fails to find a correct MessageBodyWritter for List<E> if resource is 
> defined under async way
> -------------------------------------------------------------------------------------------------
>
>                 Key: CXF-6001
>                 URL: https://issues.apache.org/jira/browse/CXF-6001
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.0.1
>            Reporter: iris ding
>         Attachments: CXF-6001.patch
>
>
> CXF fails to find a correct MessageBodyWritter for List<E> if Resource is 
> defined under async way, 
> see below example, I have two method defien, the **/collecitons can be 
> returned successfully however
> we will get an error for the **/asyncCollections.
> @Path("/bookstore")
> public class BookContinuationStore {
>    private final List<Book> bookList = new ArrayList<Book>();
>     public BookContinuationStore() {
>         init();
>     }
>     @GET
>     @Path("/collections")
>     @Produces({ "application/xml", "application/json" })
>     public List<Book> getBookCollection() throws Exception {
>         return bookList;
>     }
>    
>     @GET
>     @Path("/asyncCollections")
>     @Produces({ "application/xml", "application/json" })
>     public void getBookCollection(@Suspended AsyncResponse response) throws 
> Exception {
>         resumeSuspendedBookList(response);
>     }
>     
>     private void resumeSuspendedBookList(final AsyncResponse response) {
>         executor.execute(new Runnable() {
>             @Override
>             public void run() {
>                 try {
>                     Thread.sleep(2000);
>                 } catch (InterruptedException ex) {
>                     // ignore
>                 }
>                 response.resume(bookList);
>             }
>         });
>     }
>     private void init() {
>         Book b1 = new Book("Iris1", 1);
>         Book b2 = new Book("Iris2", 2);
>         bookList.add(b1);
>         bookList.add(b2);
>     }
>     
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to