tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: How can I refresh tomcat in the java code?
Date Fri, 04 Apr 2008 13:32:10 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Guilherme,

Guilherme Orioli wrote:
| Yes, it's an EJB managed by the JSF config faces-config.xml . Should I
use a
| different servlet to get the result wanted?

The problem is that you are using an EJB to manipulate the HTTP request
and response. You shouldn't do that. Fill the EJB with whatever data you
need from the request, tell it to generate the PDF, and then ask it
where the new PDF was written on the disk (or, you could even ask for an
InputStream to it, if you want to hide the location from the servlet).

The servlet should do all the work with the request and response. Get
that stuff out of your EJB. It'll be a lot easier to test that way.

| Is this code right, i mean, should it show the download dialog (or
even  the
| PDF screen).

If you always want to show a download dialog, you'll need to set a few
new headers. Search the web for "Content-Disposition" and "attachment".
You'll find stuff like this:
http://classicasp.aspfaq.com/general/how-do-i-prompt-a-save-as-dialog-for-an-accepted-mime-type.html

Otherwise, the PDF will be displayed in the browser's content ares
instead of being downloaded (unless the user chooses "Save Page As..."
from the file menu, of course).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkf2LdoACgkQ9CaO5/Lv0PDwpwCgtVaGmKReiCAC1yoxMa370z9A
FeEAn2L1k13zu5XAHZo2cCMMP7Qx6O4L
=8EPy
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message