tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Subclassing ServletOutputStream/PrintWriter
Date Tue, 03 Aug 2004 14:44:50 GMT

Hi,

>Thus, I can't use the incoming response object to write to.  As there
>doesn't
>seem to be a default means of getting at a new outputStream object, or
>printWriter, I presume that I have to subclass ServletOutputStream or
>PrintWriter - correct?

No, not correct.  That's the part you're missing.  That's a good thing
in this case because we'll save you work ;)

Your servlet using sendError is fine.  You would then configure an error
page for this error in your web.xml using the <error-page> directive.
The server will go to this error page, which can be a servlet, JSP, or
static page as you wish.  This error page will have a fresh response
object to which you can write whatever you want.

You don't need to subclass ServletOutputStream or PrintWriter.  In fact
it's fairly rare that you'd need to extend these for servlet
applications.

You can accomplish a similar thing to the above declarative error-page
behavior by using response.sendRedirect in your original servlet that's
now using sendError.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message