0 Replies Latest reply on Jul 16, 2015 11:50 AM by hironori hashiguchi

    The way to request pdf file(approximately 100KB)from Android 4.x to JBoss5.1 and stream downloading the pdf file.

    hironori hashiguchi Newbie

      When making a request to servlet of JBoss5.1 from Android 4.x(AppleWebkit) and response with stream using "application/pdf",

      60KB size of pdf was able to download, but 100KB size was unable to download.

      (download manager is starting but 0 byte file is stored and download manager will close)


      However, not by way of servlet but using anchor tag, static pdf file on the JBoss able to download 1MB size of pdf.

      We are using get method via SSL from Android, and request servlet by decoding with load balancer.


      Also, changing "application/pdf"to "application/octet-stream" ,

      or uppercase extension(.PDF), or double-quotes around the filename,

      inline/attachment didn't make it either.

      @

      Please tell us, how can we denote AppleWebkit in stock browser status by not using Chrome etc.


      File f = new File( sFilePath ) ;

      byte[] buffer = new byte[1024] ;

      int length ;

      fis = new BufferedInputStream( new FileInputStream( f ) ) ;

      out = new BufferedOutputStream( res.getOutputStream() ) ;

      //res.setContentType( "application/pdf" ) ;

      res.setContentType( "application/octet-stream" ) ;

      res.setHeader("Content-disposition", "attachment; filename=\"" + f.getName() + "\"");

      res.setContentLength( (int)f.length() ) ;

      while( ( length = fis.read( buffer ) ) != -1 ) {

      out.write( buffer, 0, length ) ;

      }