Do not call respond() your self, set the requesttarget as the response
rt in the request cycle.

Dont know if that works but most of the time you need a name to
download it correctly. Are alle the content headers set ok?

On 1/23/08, Francisco Diaz Trepat - gmail
<[EMAIL PROTECTED]> wrote:
> Hi it does the same behavior.
>
> Opens the new Tab and displays an emtpy broken content with the title in the
> tab being (application/pdf Object). This is unless I put the file name. So I
> have the following code now (Testing it):
>
>
>       public void onSubmit() {
>             Resource cResource = new LcCalculationPDFWebResource();
>             //cResource.onResourceRequested();
>             ResourceStreamRequestTarget cTarget = new
> ResourceStreamRequestTarget(cResource.getResourceStream());
>
>             if (!((WebClientInfo)
> getSession().getClientInfo()).getProperties().isBrowserInternetExplorer()) {
>                cTarget.setFileName("Argo.pdf");
>             }
>
>             cTarget.respond(getRequestCycle());
>
>       }
>
>
> Safari still crashes.
>
> The onSubmit is still the one in the MyForm.
>
> f(t)
>
>
> On Jan 23, 2008 5:37 PM, Francisco Diaz Trepat - gmail <
> [EMAIL PROTECTED]> wrote:
>
> > Hi Johan, thanks.
> >
> > We are actually doing the target _blank.
> >
> > I'm gonna check resourestreamrequesttarget out to see.
> >
> > I have a small work arround for Firefox only (remember it works fine on
> > IE, and does not on Safari & Firefox)
> >
> > which is setting the header Content-Disposition with the
> > setAttachment(String fileName) method.
> >
> > I'll let you know about the resourestreamrequesttarget.
> >
> > f(t)
> >
> >   On Jan 23, 2008 5:22 PM, Johan Compagner <[EMAIL PROTECTED]> wrote:
> >
> > > First of all dont do directly onresourcerequest in the on submit but
> > > use the resourestreamrequesttarget or something like that.
> > >
> > > If you want tro keep the current html you could submit to a new target
> > > window?
> > > I guess you could also play with http headers so that the browser
> > > knows what it get and should do
> > >
> > > On 1/23/08, Francisco Diaz Trepat - gmail
> > >  <[EMAIL PROTECTED]> wrote:
> > > > Hi all, I am having some problems dealing with PDFs.
> > > >
> > > > 1) I have DynamicWebResource (MyPdfDynamicWebResource) that overrides
> > > the
> > > > getResourceState() method as follows.
> > > >
> > > >
> > > >       protected ResourceState getResourceState() {
> > > >          return new ResourceState() {
> > > >             protected byte[] myPDF;
> > > >
> > > >             public String getContentType() {
> > > >                return "application/pdf";
> > > >             }
> > > >
> > > >             public Time lastModifiedTime() {
> > > >                return Time.now();
> > > >             }
> > > >
> > > >             public byte[] getData() {
> > > >                return basicGetData();
> > > >             }
> > > >
> > > >             protected synchronized byte[] basicGetData() {
> > > >                if (myPDF== null) {
> > > >                   myPDF = generatePDF();
> > > >                }
> > > >                return myPDF;
> > > >             }
> > > >
> > > >             public int getLength() {
> > > >               return basicGetData().length;
> > > >             }
> > > >
> > > >          };
> > > >       }
> > > >
> > > > 2) I have a MyForm extension (simple) that has the following
> > > onSubmit()
> > > > code:
> > > >
> > > >      public void onSubmit() {
> > > >             Resource cResource = new MyPdfDynamicWebResource();
> > > >             cResource.onResourceRequested();
> > > >       }
> > > >
> > > > 3) Saddly )*This works perfect on IE 7, but does not work on Firefox
> > > and
> > > > Safari.*
> > > >
> > > > My goals:
> > > >
> > > > 1) Open the PDF file in a new window for the purpose of NOT losing the
> > > User
> > > > input data on the form and the page that the user was on.
> > > >
> > > > 2) The opening of the PDF inside the browser is kind of optional.
> > > >
> > > >
> > > > Hopefully you'll be able to help me,
> > > >
> > > > cheers,
> > > >
> > > > f(t)
> > > >
> > >
> > > --
> > > Sent from Gmail for mobile | mobile.google.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
>

-- 
Sent from Gmail for mobile | mobile.google.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to