Hi,

I'm trying to generate some file content on the fly and return it when the user 
clicks a link. I'm doing this in a D2W context, the component is a propoerty 
level component. I had some success by overwriting appendToResponse like so:

public void appendToResponse(com.webobjects.appserver.WOResponse response, 
WOContext context) 
{
if ( shouldDownloadFile )
{
String fileName = "generated.properties";
String contentType = "text/ascii";
response.setHeader( contentType + "; name=\"" + fileName + "\"", "Content-Type" 
); 
response.setHeader( 
"attachment; filename=\"" + fileName + "\"", "Content-Disposition");
String content = this.configuration();
response.setContent( content );
        }
        else
        {
            super.appendToResponse( response, context );
        }
}

The flag 'shouldDownloadFile' is set to true when the link contained in the 
component is clicked (normal action binding).

However, instead of only the generated content, I also get some other generated 
HTML in the file. Does somebody know what the problem is?

Kind Regards,
J.L.Simon

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to