2007/3/28, Johann Werner <[EMAIL PROTECTED]>:

I found the cause of the problems to correctly display an inline pdf.
Apparently the header information "application/pdf" is overwritten by
Apache to "text/html". I suppose that it does so because the URL
doesn't end with ".pdf" but ends with the context ID.


I don't think so... but, to be sure, try to return the response as a
WOComponent throught a Direct Action:

e.g.

yourLink: WOHyperlink
{
  directActionName = "donwload";
}

public WOActionResult downloadAction()
{
     ///obtain your NSData aktPDF
    ComponentEmpty c = (ComponentEmpty) pageWithName("ComponentEmpty");
    c.setAktPDF(aktPDF);
   return c;
}

public class ComponentEmpty extends WOComponent
{
   private NSData _aktPDF;
   public ComponentEmpty(WOContext aContext)
   {
      super(aContext);
   }

   public NDData aktPDF()
   {
      return _aktPDF;
    }

   public void setAktPDF(NSData newaktPDF)
    {
       _aktPDF = newaktPDF;
    }

    public void appendToResponse(WOResponse aResponse, WOContext context)
    {
         aResponse.disableClientCaching();
       aResponse.removeHeadersForKey("cache-control");
       aResponse.removeHeadersForKey("pragma");
       aResponse.setHeader("application/pdf", "content-type");
      aResponse.setHeader("Report PDF", "content-description");
       aResponse.setHeader("inline; filename=\"" + --> your PDF
file name <-- + ".pdf\"", "content-disposition");
      aResponse.setHeader( --> your PDF file length <--, "content-length");
       aResponse.setContent( --> your PDF <-- );
       /////DO NOT CALL SUPER.APPENDTORESPONSE()
    }
}

This should work...

How can I prevent Apache from ignoring the headers from WO or is it
possible to return a WOComponent (the PDF file) but with a
"corrected" URL?

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

This email sent to [EMAIL PROTECTED]




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

This email sent to [email protected]

Reply via email to