cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glen Mazza (JIRA)" <j...@apache.org>
Subject [jira] Created: (CXF-3380) Support writing to DataSources
Date Sun, 06 Mar 2011 21:52:59 GMT
Support writing to DataSources
------------------------------

                 Key: CXF-3380
                 URL: https://issues.apache.org/jira/browse/CXF-3380
             Project: CXF
          Issue Type: Improvement
          Components: JAX-RS
    Affects Versions: 2.4
            Reporter: Glen Mazza
            Priority: Minor


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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message