caucho
Resin 1.1
FAQ
Reference
JavaDoc
Demo
Java Tutorial

Getting Started
Configuration
Servlet
JSP
XTP/XSL
JavaScript
JS Library

Core Library
File Library
Servlet Library
Database Library
XML Library

PageContext
Request
Response
Session
Application
 Servlet Response

The servlet response object is reflected directly from the servlet interface, so all the functions listed in the servlet javadoc are available and that is the definitive reference.

In particular, we haven't listed all the error code response constants from that class, e.g. SC_FORBIDDEN, although they are available as properties of the Response object.

Resin has added the write, writeln, and printf methods.

Servlet Response
setStatus(code [, message]) Sets the status code for the response.
setHeader(name, value) Sets the value of the named header.
sendRedirect(url) Redirect the client to the given url.
encodeRedirectUrl(url) Encodes the redirect url if necessary for session tracking.
encodeUrl(url) Encodes the url if necessary for session tracking.
sendError(code [, message]) Sends an error response to the client. If the message is not given, it will send a default message.
containsHeader(name) Returns true if the named header has already been set.
setIntHeader(name, value) Sets the value of the named header as an integer.
setDateHeader(name, value) Sets the value of the named header as an numeric time.
addCookie(cookie) Adds the cookie to the response.
Note: addCookie must preceed writing to the response.
setContentLength(length) Sets the content length for the response.
setContentType(type) Sets the content type, i.e. mime-type and encoding for the response.
characterEncoding This read-only property returns either the encoding set by setContentType or an encoding the client understands.
write(string) Writes a string to the response.
writeln(string) Writes a string with a linefeed.
printf(fmt, ...) Writes formatted output using printf.
flush() Flushes any buffered output.
outputStream Returns a JDK OutputStream for writing responses.
writer Returns a JDK Writer for writing responses.

Servlet Response

setStatus(code [, message])

Sets the status code for the response.
Note: setStatus must preceed writing to the response.

setHeader(name, value)

Sets the value of the named header.
Note: setHeader must preceed writing to the response.

sendRedirect(url)

Redirect the client to the given url.
Note: sendRedirect must preceed writing to the response.

<% 
var url = "http://newhost.com/";
url = Response.encodeRedirectUrl(url)
Response.sendRedirect(url);
%>

encodeRedirectUrl(url)

Encodes the redirect url if necessary for session tracking. Session tracking for cookie-ignorant browsers requires this.

encodeUrl(url)

Encodes the url if necessary for session tracking. Session tracking for cookie-ignorant browsers requires this.

All urls sent to the client should go through this.

sendError(code [, message])

Sends an error response to the client. If the message is not given, it will send a default message.
Note: sendError must preceed writing to the response.

containsHeader(name)

Returns true if the named header has already been set.

setIntHeader(name, value)

Sets the value of the named header as an integer.
Note: setIntHeader must preceed writing to the response.

setDateHeader(name, value)

Sets the value of the named header as an numeric time.
Note: setDateHeader must preceed writing to the response.

addCookie(cookie)

Adds the cookie to the response.
Note: addCookie must preceed writing to the response.

setContentLength(length)

Sets the content length for the response.

setContentType(type)

Sets the content type, i.e. mime-type and encoding for the response.

characterEncoding

This read-only property returns either the encoding set by setContentType or an encoding the client understands.

write(string)

Writes a string to the response.

writeln(string)

Writes a string with a linefeed.

printf(fmt, ...)

Writes formatted output using printf.

flush()

Flushes any buffered output.

outputStream

Returns a JDK OutputStream for writing responses.

writer

Returns a JDK Writer for writing responses.

Request   Session
Copyright © 1998-2000 Caucho Technology. All rights reserved.
Last modified: Fri, 31 Mar 2000 18:55:01 -0800 (PST)