What do you mean with "After clearing chronik"? Does this mean that the session 
cookie is lost after "After clearing chronik"?
You may take a look at the generated HTML:

        
Onclick=".....?wicket:interface=:5:.............:pdfIcon:pdf::ILinkListener::"

This refers to a version oft he page that is no longer valid after the session 
is lost. Refreshing the page starts a new session and it works again.
You must (I don't know how at the moment) produce a sort of bookemarkable url 
for this case I think. My guess would be to use a separate servlet for this.

Stefan

-----Ursprüngliche Nachricht-----
Von: Alex Zeit [mailto:zeita...@googlemail.com] 
Gesendet: Donnerstag, 28. Oktober 2010 18:21
An: users@wicket.apache.org
Betreff: Re: Problems displaying a PDF from stream

Now it works with IE and this is most important thing. Thank you very much!
However the problem with Firefox remains. After clearing chronik while Pdf 
document is open if I click the link comes "page expired", after refreshing the 
main page with link if I click link again comes empty page.

2010/10/28 Alex Zeit <zeita...@googlemail.com>

> Thanks a lot Stefan I will try it right now
>
>
> 2010/10/28 Stefan Lindner <lind...@visionet.de>
>
>> Try this:
>>
>>
>>
>>        public class MyResourceStreamWriter extends 
>> AbstractResourceStreamWriter {
>>                private static final long serialVersionUID = 1L;
>>
>>                public MyResourceStreamWriter() {
>>                }
>>
>>                @Override
>>                public void write(final OutputStream output) {
>>                        // !!!!! prduce output here and stream it to output
>>                        try {
>>                                output.flush();
>>                        } catch (Exception e) {
>>                                e.printStackTrace();
>>                        }
>>                }
>>
>>                @Override
>>                 public String getContentType() {
>>                        return "application/pdf";
>>                }
>>        }
>>
>>
>>
>>
>>
>>         Link<T> pdfLink = new Link<T>("pdf") {
>>                private static final long serialVersionUID = 1L;
>>                @Override
>>                public void onClick() {
>>                        ResourceStreamRequestTarget rsrt = new 
>> ResourceStreamRequestTarget(new MyResourceStreamWriter());
>>                        //rsrt.setFileName("file.pdf"); // use this if 
>> yout want your browser to ask you wheter you want to save the 
>> cownloaded PDF in fil e"file.pdf"
>>                        getRequestCycle().setRequestTarget(rsrt);
>>                }
>>        };
>>
>>
>>        pdfLink.setPopupSettings(new 
>> PopupSettings(PopupSettings.RESIZABLE
>> | PopupSettings.SCROLLBARS));
>>        add(pdfLink);
>>
>>
>> Stefan
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Alex Zeit [mailto:zeita...@googlemail.com]
>> Gesendet: Donnerstag, 28. Oktober 2010 15:21
>> An: users@wicket.apache.org
>> Betreff: Re: Problems displaying a PDF from stream
>>
>> Yes
>>
>> 2010/10/28 Stefan Lindner <lind...@visionet.de>
>>
>> > Do you want to open the PDF in a separate window? Klick on some 
>> > button and open a new browser window with pdf?
>> >
>> > Stefan
>> >
>> > -----Ursprüngliche Nachricht-----
>> > Von: Alex Zeit [mailto:zeita...@googlemail.com]
>> > Gesendet: Donnerstag, 28. Oktober 2010 15:14
>> > An: users@wicket.apache.org
>> > Betreff: Problems displaying a PDF from stream
>> >
>> > While trying to display a PDF document from stream following 
>> > problems
>> > arrise:
>> > IE7:
>> > Resource can not be displaied at all.
>> >
>> > Firefox 3.6.12:
>> > PDF is displaied but if Chronk is cleared in Firefox while document 
>> > is open then it cannot be displaied again. It is possible only 
>> > after restarting Firefox.
>> >
>> > No errors in log.
>> >
>> > The code:
>> > public class PdfGen extends WebResource {
>> >
>> >    public PdfGen() {
>> >        setCacheable(false);
>> >    }
>> >
>> >    @Override
>> >    public IResourceStream getResourceStream() {
>> >        IResourceStream resourceStream = new
>> > AbstractResourceStreamWriter() {
>> >            private static final long serialVersionUID = 
>> > 1934248394380163944L;
>> >            public void write(OutputStream output) {
>> >                testItextDirect(output);
>> >            }
>> >            public String getContentType() {
>> >                return "application/pdf";
>> >            }
>> >        };
>> >        return resourceStream;
>> >    }
>> >
>> >    private void testItextDirect(OutputStream output){
>> >        try {
>> >            Document document = new Document();
>> >            PdfWriter.getInstance(document, output);
>> >            document.open();
>> >            document.add(new Paragraph("Hello World"));
>> >            document.add(new Paragraph(new Date().toString()));
>> >            document.close();
>> >        } catch (DocumentException de) {
>> >            try {
>> >                throw new IOException(de.getMessage());
>> >            } catch (IOException e) {
>> >                e.printStackTrace();
>> >            }
>> >        }
>> >    }
>> > }
>> >
>> >
>> > in the init() of AuthenticatedWebApplication SharedResource added 
>> > like
>> > this:
>> > getSharedResources().add("pdfGen", new PdfGen());
>> >
>> > Any help would be highly appreciated Alex
>> >
>> > -------------------------------------------------------------------
>> > -- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> > For additional commands, e-mail: users-h...@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to