Skip to Content
0
Former Member
Mar 25, 2007 at 09:12 PM

Waiting too long for Web Dynpro with FileDownload UI

28 Views

Hi,

in my application I use a FileDownload-UI to open different kinds of documents,

like PDF, JPEG etc.. But if I use this UI for a big Document with for example 50

MB, I had to wait a long time before the Web Dynpro appears. I couldn't find my

mistake, please help me.


  public void getByteArrayOutput( int num, java.lang.String url, java.lang.String file_size )
  {
		URL u = new java.net.URL(url);
		URLConnection c = u.openConnection();
		InputStream is = c.getInputStream();
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		int length;
		int size = Integer.parseInt(file_size); 
		byte[] part = new byte[size];
		while ((length = is.read(part)) != -1) {
			out.write(part, 0, length);
		}
		is.close();						
		wdContext.currentContextElement().setAttributeValue("FileResource"+num, out.toByteArray());
}


  public void showUI(){

	final IEt_Doc_LinksNode node = wdContext.nodeEt_Doc_Links();	

	for (int i = 0; i < node.size(); i++)
	{			  			
		IEt_Doc_LinksElement e = node.getEt_Doc_LinksElementAt(i);	

		IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().
			addAttribute("FileResource"+i,"com.sap.dictionary.binary");	
							
		IWDModifiableBinaryType binaryType =
			(IWDModifiableBinaryType) attributeInfo.getModifiableSimpleType();			

		wdThis.getByteArrayOutput(i,e.getUrl(),e.getFile_Size());

		binaryType.setFileName(e.getFile_Name());

		binaryType.setMimeType( new WDWebResourceType(e.getDoc_Type(),"application", true) );
		...
	}
}			

regards,

sharam