• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
appendToResponse
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

appendToResponse


  • Subject: appendToResponse
  • From: WIESEN Bruno <email@hidden>
  • Date: Tue, 17 Apr 2007 16:05:50 +0200

Hello,


In my app, I create an excel sheet (with Jakarta POI) and I want to make it downloadable just after it has been created (the user has to click a button to create a file)
So i try to override appendToResponse like this but in the file there is some html tags...and not the content of the sheet created...

if(isExported)
{
super.appendToResponse(response,context);


response.setHeader("inline; filename=" + fFileName, "content-disposition");
response.setHeader("application/vnd.ms-excel", "content-type");


//Convert File to byte[]
try
{
response.setContent(new NSData(convert("tmp" + fFileName)));
}
catch(Exception e)
{
NSLog.out.appendln(e.getMessage());
}
}


public byte[] convert(String file) throws Exception 
{
File fichier = new File(file);
InputStream in = new FileInputStream(fichier);
byte[] tableau= new byte[in.available()];
in.read(tableau);
return tableau;
}


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: appendToResponse
      • From: Guido Neitzer <email@hidden>
    • Re: appendToResponse
      • From: "Daniele Corti" <email@hidden>
  • Prev by Date: Re: wobuild.properties in Eclipse
  • Next by Date: Re: appendToResponse
  • Previous by thread: Re: wobuild.properties in Eclipse
  • Next by thread: Re: appendToResponse
  • Index(es):
    • Date
    • Thread