コード例 #1
0
 public String getMimeType() {
   String mimeType = null;
   if (streamingAction != null) {
     mimeType = streamingAction.getMimeType(null);
   }
   if (mimeType == null) {
     mimeType = MimeHelper.getMimeTypeFromFileName(outputFilePath);
   }
   if (mimeType == null) {
     mimeType = "binary/octet-stream";
   }
   return mimeType;
 }
コード例 #2
0
  public OutputStream getOutputStream() throws Exception {
    String tempOutputFilePath = outputFilePath;
    String extension = RepositoryFilenameUtils.getExtension(tempOutputFilePath);
    if ("*".equals(extension)) { // $NON-NLS-1$
      tempOutputFilePath = tempOutputFilePath.substring(0, tempOutputFilePath.lastIndexOf('.'));
      if (streamingAction != null) {
        String mimeType = streamingAction.getMimeType(null);
        if (mimeType != null && MimeHelper.getExtension(mimeType) != null) {
          tempOutputFilePath += MimeHelper.getExtension(mimeType);
        }
      }
    }

    RepositoryFileOutputStream outputStream =
        new RepositoryFileOutputStream(tempOutputFilePath, autoCreateUniqueFilename, true);
    outputStream.addListener(this);
    return outputStream;
  }