O'Reilly logo

Java™ Network Programming and Distributed Computing by Michael Reilly, David Reilly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10.8. ServletResponse and HttpResponse

For servlets, the ServletResponse and its subclass HttpResponse are two of the most vital classes. These classes perform the function of sending the MIME-encoded data back to the client. Without this, there would be no servlets at all. This class supports both writers (for communicating text-based characters) and output streams (for sending back binary data), as well as enabling the setting of content length and type parameters.

The HttpResponse class adds extra functionality in that it allows the developer to set the HTTP status codes, add cookies and headers, and encode session IDs into URLs. For the moment, we'll leave these advanced topics for Section 10.12, but it is important to be aware of the versatility ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required