Changeset 3920


Ignore:
Timestamp:
Nov 7, 2007, 12:43:13 PM (14 years ago)
Author:
Martin Svensson
Message:

References #492 Creates a new OutputStream? for each upload and always return a MIMEtype in BaseFileDataSource?.

Location:
trunk/src/webservices
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/webservices/client/java/net/sf/basedb/ws/client/AbstractRPCClient.java

    r3876 r3920  
    101101      }
    102102    }
     103    out.close();
    103104    return receivedFile;
    104105  }
  • trunk/src/webservices/server/net/sf/basedb/ws/server/BaseFileDataSource.java

    r3919 r3920  
    2626import net.sf.basedb.core.File;
    2727
     28import java.io.BufferedOutputStream;
    2829import java.io.IOException;
    2930import java.io.InputStream;
     
    4041{
    4142  private File file = null;
     43  private OutputStream os = null;
    4244
    4345  /**
     
    5254  public String getContentType()
    5355  {
    54     return file.getMimeType();
     56    return file.getMimeType() == null ? "application/octet-stream" : file.getMimeType();
    5557  }
    5658
    57   public InputStream getInputStream() throws IOException
     59  public InputStream getInputStream()
     60    throws IOException
    5861  {
    5962    return file.getDownloadStream(0);
     
    6568  }
    6669
    67   public OutputStream getOutputStream() throws IOException
    68   {   
    69     return file.getUploadStream(false);
     70  public OutputStream getOutputStream()
     71    throws IOException
     72  {     
     73    if (os != null) os.close();
     74    os = new BufferedOutputStream(file.getUploadStream(false));
     75    return os;
    7076  }
    7177
Note: See TracChangeset for help on using the changeset viewer.