GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  SERVLET::SERVLETRESPONSE (3)

.ds Aq ’

NAME

Servlet::ServletResponse - servlet response interface

CONTENTS

SYNOPSIS



  $response->flushBuffer();

  my $size = $response->getBufferSize();

  my $encoding = $response->getCharacterEncoding();

  my $locale = $response->getLocale();

  my $output = $response->getOutputHandle();

  my $writer = $response->getWriter();

  my $flag = $response->isCommitted();

  $response->reset();

  $response->resetBuffer();

  $response->setBufferSize($size);

  $response->setContentLength($length);

  $response->setContentType($type);

  $response->setLocale($locale);



DESCRIPTION

This interface defines an object that assists a servlet in sending a response to the client. The servlet container creates the object and passes it as an argument to the servlet’s service() method.

METHODS

flushBuffer() Forces any content in the buffer to be written to the client. A call to this method automatically commits the resopnse, meaning the status code and headers will be written.

<B>Throws:B>
<B>Servlet::Util::IOExceptionB>

getBufferSize() Returns the actual buffer size used for the response, or 0 if no buffering is used.
getCharacterEncoding() Returns the name of the character encoding used in the body of this response. If not charset has been assigned, it is implicitly set to ISO-8859-1.
getLocale() Returns the locale assigned to the response.
getOutputHandle() Returns a <B>IO::HandleB> suitable for writing binary data in the response. The servlet container does not encode the binary data.

Calling flush() commits the response.

Either this method or getWriter() may be called to write the body, not both.

<B>Throws:B>
<B>Servlet::Util::IllegalStateExceptionB> if the getWriter() method has already been called for this response
<B>Servlet::Util::IOExceptionB> if an input or output exception occurred

getWriter() Returns a <B>XXXB> object that can send character text to the client. The character encoding used is the one specified in the charset parameter of setContentType(), which must be called before calling this metod for the charset to take effect.

If necessary, the content type of the response is modified to reflect the character encoding used.

Calling flush() commits the response.

Either this method or getOutputHandle() may be called to write the body, not both.

<B>Throws:B>
<B>Servlet::Util::UnsupportedEncodingExceptionB> if the charset specified in setContentType() cannot be used
<B>Servlet::Util::IllegalStateExceptionB> if the getOutputHandle() method has already been called for this request
<B>Servlet::Util::IOExceptionB> if an input or output exception occurred

isCommitted() Returns a boolean indicating if the response has been committed. A committed response has already had its status code and headers written.
reset() Clears any data that exists in the buuffer as well as the status code and headers.

<B>Throws:B>
<B>Servlet::Util::IllegalStateExceptionB> if the response has already been committed

resetBuffer() Clears the content of the underlying buffer in the response without clearing headers or status code.

<B>Throws:B>
<B>Servlet::Util::IllegalStateExceptionB> if the response has already been committed

setBufferSize($size) Sets the preferred buffer size for the body of the response. The servlet container will use a buffer at least as large as the size requested. The actual buffer size can be found using getBufferSize().

A larger buffer allows more content to be written before anything is actually sent, thus providing the servlet with more time to set appropriate status codes and headers. A smaller buffer decreases server memory load and allows the client to start receiving data more quickly.

This method must be called before any response body content is written.

<B>Parameters:B>
$size The preferred buffer size

<B>Throws:B>
<B>Servlet::Util::IllegalStateExceptionB> if content has been written to the buffer

setContentLength($len) Sets the length of the content body in the response. In HTTP servlets, this method sets the HTTP Content-Length header.

<B>Parameters:B>
$len The length of the content being returned to the client

setContentLength($len) Sets the length of the content body in the response. In HTTP servlets, this method sets the HTTP Content-Length header.

<B>Parameters:B>
$len The length of the content being returned to the client

setContentType($type) Sets the content type of the response. The content type may include the type of character encoding used, for example text/html; charset=ISO-8859-4.

If calling getWriter(), this method should be called first.

<B>Parameters:B>
$type The MIME type of the content

setLocale($loc) Sets the locale of the response, setting the headers (including the charset attribute of the Content-Type) as appropriate.

This method should be called before a call to getWriter().

By default, the response locale is the default locale for the server.

<B>Parameters:B>
$loc The locale of the response

SEE ALSO

IO::Handle

AUTHOR

Brian Moseley, bcm@maz.org
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 SERVLET::SERVLETRESPONSE (3) 2001-07-13

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.