Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1B9139753 for ; Tue, 14 Feb 2012 19:32:25 +0000 (UTC) Received: (qmail 32445 invoked by uid 500); 14 Feb 2012 19:32:24 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 32404 invoked by uid 500); 14 Feb 2012 19:32:24 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 32395 invoked by uid 99); 14 Feb 2012 19:32:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Feb 2012 19:32:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Feb 2012 19:32:22 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 145801B791D for ; Tue, 14 Feb 2012 19:32:01 +0000 (UTC) Date: Tue, 14 Feb 2012 19:32:01 +0000 (UTC) From: "Glen Mazza (Reopened) (JIRA)" To: issues@cxf.apache.org Message-ID: <103989475.37552.1329247921084.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1637877096.63.1299448379440.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Reopened] (CXF-3380) JAX-RS: Support writing to DataSources MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CXF-3380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Glen Mazza reopened CXF-3380: ----------------------------- Hi, this sample is still indicating a problem (perhaps one further down after the latest change made): https://github.com/gmazza/jersey-samples-on-cxf/tree/master/simple-servlet For this class within it: https://github.com/gmazza/jersey-samples-on-cxf/blob/master/simple-servlet/src/main/java/com/sun/jersey/samples/servlet/resources/ResourceBean3.java The traditional way as described in this JIRA (lines 153-164) works but the DataSoure way (143-151) doesn't. Steps to replicate: 1. Check out simple-servlet: git clone https://github.com/gmazza/jersey-samples-on-cxf.git (move to simple-servlet folder). 2. Run "mvn clean install" on it. 3. Run "mvn jetty:run" and go to this page in a browser: http://localhost:8080/SimpleServlet/resources/start 4. From the top, select "Resource 3", press the "Test Resource" button, leave Fred & Barney as-is, choose "Selection Method" of "Query Parameter" and MIME type of image/jpg. 5. Select the lower "Test Resource" button. You'll see the Oracle Duke logo/picture. Everything good. 6. In class ResourceBean3 listed above, comment out the "public InputStream getImageRep()" method and uncomment the "public DataSource getImageRep()" method; repeat steps 2-5 above. This time, though, no picture is returned and server reports back "WARNING: No message body writer has been found for response class FileDataSource." > JAX-RS: Support writing to DataSources > -------------------------------------- > > Key: CXF-3380 > URL: https://issues.apache.org/jira/browse/CXF-3380 > Project: CXF > Issue Type: Improvement > Components: JAX-RS > Reporter: Glen Mazza > Assignee: Sergey Beryozkin > Fix For: 2.3.8, 2.4.5, 2.5.1 > > > CXF's JAX-RS implementation can presently read from but not write to data sources (javax.activation.DataSource). Provide an ability to write to data sources so we can code this way: > @Produces("image/jpg") > @GET > public DataSource getImageRep() { > URL jpgURL = this.getClass().getResource("myimage.jpg"); > return new FileDataSource(jpgURL.getFile()); > } > instead of something like this: > @Produces("image/jpg") > @GET > public InputStream getImageRep() { > FileInputStream fis = null; > try { > URL jpgURL = this.getClass().getResource("myimage.jpg"); > fis = new FileInputStream(new File(jpgURL.getPath())); > } catch (IOException e) { > System.out.println("Couldn't find file!"); > } > return fis; > } -- 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