You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Celia Xu <ww...@gmail.com> on 2013/01/31 17:23:13 UTC
AbstractResource not writing PDF resource to IE
I have TabbedPanels contain lazyloadpanels imbedded in a panel.
In IE it doesn't show any data in the popup window whereas in firefox it
prompts error: "*Last cause: ResourceResponse#setWriteCallback() must be
set.*" in the first tab and works fine in other tabs.
here is snippet:
ResourceLink<Void> pdfLink = new ResourceLink<Void>("pdfLink", new
AbstractResource(){
@Override
protected ResourceResponse newResourceResponse(Attributes attributes)
{
ResourceResponse r = new ResourceResponse();
try {
final byte[] pdfBytes = getPDF();
r.setFileName(DynamicFileName+".pdf");
r.setContentType("application/pdf");
r.setContentDisposition(ContentDisposition.INLINE);
r.setContentLength(pdfBytes.length);
* r.setWriteCallback*(new WriteCallback(){
@Override
public void writeData(Attributes attributes)
{
attributes.getResponse().write(pdfBytes);
}
});
r.disableCaching();
} catch (Exception e) {
e.printStackTrace();}
return r; } });
PopupSettings popupSettings = new PopupSettings(FILENAME,
PopupSettings.RESIZABLE
| PopupSettings.SCROLLBARS).setHeight(500).setWidth(700);
pdfLink.setPopupSettings(popupSettings);
I'm also generating Excel file and using exact same structure as pdf one but
works as expect.
Anyone knows why?
Thanks
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AbstractResource-not-writing-PDF-resource-to-IE-tp4655978.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AbstractResource not writing PDF resource to IE
Posted by Celia Xu <ww...@gmail.com>.
So finally I made it work just by moving byte array resource outside the
newResourceResponse method....
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AbstractResource-not-writing-PDF-resource-to-IE-tp4655978p4655984.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AbstractResource not writing PDF resource to IE
Posted by Celia Xu <ww...@gmail.com>.
Thanks for reply.
I changed r.setContentDisposition(ContentDisposition.*INLINE*);
to r.setContentDisposition(ContentDisposition.*ATTACHMENT*);
Then in firefox it can open/download the file properly but IE prompt cannot
download from server.
any suggestion?
error:
<http://apache-wicket.1842946.n4.nabble.com/file/n4655982/1.jpg>
Thanks
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AbstractResource-not-writing-PDF-resource-to-IE-tp4655978p4655982.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AbstractResource not writing PDF resource to IE
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
I guess because of :
} catch (Exception e) {
e.printStackTrace();}
return r; } });
i.e. you may return incomplete resourceResponse.
check your logs
On Thu, Jan 31, 2013 at 5:23 PM, Celia Xu <ww...@gmail.com> wrote:
> I have TabbedPanels contain lazyloadpanels imbedded in a panel.
> In IE it doesn't show any data in the popup window whereas in firefox it
> prompts error: "*Last cause: ResourceResponse#setWriteCallback() must be
> set.*" in the first tab and works fine in other tabs.
> here is snippet:
>
> ResourceLink<Void> pdfLink = new ResourceLink<Void>("pdfLink", new
> AbstractResource(){
> @Override
> protected ResourceResponse
> newResourceResponse(Attributes attributes)
> {
> ResourceResponse r = new ResourceResponse();
> try {
> final byte[] pdfBytes = getPDF();
>
> r.setFileName(DynamicFileName+".pdf");
> r.setContentType("application/pdf");
> r.setContentDisposition(ContentDisposition.INLINE);
> r.setContentLength(pdfBytes.length);
> * r.setWriteCallback*(new WriteCallback(){
> @Override
> public void writeData(Attributes attributes)
> {
> attributes.getResponse().write(pdfBytes);
> }
> });
> r.disableCaching();
> } catch (Exception e) {
> e.printStackTrace();}
> return r; } });
> PopupSettings popupSettings = new PopupSettings(FILENAME,
> PopupSettings.RESIZABLE
> |
> PopupSettings.SCROLLBARS).setHeight(500).setWidth(700);
> pdfLink.setPopupSettings(popupSettings);
>
> I'm also generating Excel file and using exact same structure as pdf one
> but
> works as expect.
> Anyone knows why?
> Thanks
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/AbstractResource-not-writing-PDF-resource-to-IE-tp4655978.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>