tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kimberly Begley" <kimberly.le...@gmail.com>
Subject Re: displaying an image from outside the webapps directory
Date Tue, 01 Apr 2008 06:28:43 GMT
Great - got it working!
Thanks so much for that again!
Kimberly

On Tue, Apr 1, 2008 at 12:07 AM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Kimberly,
>
> Kimberly Begley wrote:
> | I was hoping to use the jsp:include tag to include the snippet (no html
> or
> | body tags) - I tried with the same code that Chris sent to open a jpeg -
> | thinking it might be the same solution for the html but have gotten an
> | internal error at the jsp include line.
>
> The problem is that JSPs use HttpServletResponse.getWriter (because JSPs
> are used to produce text output) while the servlet you write uses
> HttpServletRequest.getOutputStream. The two are incompatible for the
> same request, and getWriter has already been called, to getOutputStream
> fails.
>
> You have a couple of options:
>
> * Write another version of OpenFile called OpenTextFile or whatever
> * Modify OpenFile to try getOutputStream first, then getWriter
> * Put a special flag in the request, and have OpenFile detect that flag
> ~  to determine whether getWriter or getOutputStream should be called
>
> If you want to use Writers instead of Streams, you should probably open
> your file using a Reader instead of a Stream as well.
>
> Hope that helps,
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.8 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkfw8D4ACgkQ9CaO5/Lv0PCzxwCfYMDYRCHCjLxo5bCmq+wiuvMG
> 0JAAn3+hBtaGqJx6Oucn/ufDBos+G6bi
> =pp7j
> -----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
>
>


-- 
Kimberly Begley

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message