org.mortbay.jetty
Class Response

java.lang.Object
  extended by org.mortbay.jetty.Response

public class Response
extends Object

Response.

Implements HttpServletResponse from the javax.servlet package.

Author:
gregw

Field Summary
static int DISABLED
           
static int NONE
           
static int STREAM
           
static int WRITER
           
 
Constructor Summary
Response(HttpConnection connection)
           
 
Method Summary
 void addCookie(Cookie cookie)
           
 void addDateHeader(String name, long date)
           
 void addHeader(String name, String value)
           
 void addIntHeader(String name, int value)
           
 void complete()
           
 boolean containsHeader(String name)
           
 String encodeRedirectUrl(String url)
           
 String encodeRedirectURL(String url)
           
 String encodeUrl(String url)
           
 String encodeURL(String url)
           
 void flushBuffer()
           
 int getBufferSize()
           
 String getCharacterEncoding()
           
 long getContentCount()
           
 String getContentType()
           
 String getHeader(String name)
           
 Enumeration getHeaders(String name)
           
 HttpFields getHttpFields()
           
 Locale getLocale()
           
 ServletOutputStream getOutputStream()
           
 String getReason()
           
 int getStatus()
           
 PrintWriter getWriter()
           
 boolean isCommitted()
           
 boolean isWriting()
           
protected  void recycle()
           
 void reset()
           
 void resetBuffer()
           
 void sendError(int sc)
           
 void sendError(int code, String message)
           
 void sendProcessing()
           
 void sendRedirect(String location)
           
 void setBufferSize(int size)
           
 void setCharacterEncoding(String encoding)
           
 void setContentLength(int len)
           
 void setContentType(String contentType)
           
 void setDateHeader(String name, long date)
           
 void setHeader(String name, String value)
           
 void setIntHeader(String name, int value)
           
 void setLocale(Locale locale)
           
 void setLongContentLength(long len)
           
 void setStatus(int sc)
           
 void setStatus(int sc, String sm)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DISABLED

public static final int DISABLED
See Also:
Constant Field Values

NONE

public static final int NONE
See Also:
Constant Field Values

STREAM

public static final int STREAM
See Also:
Constant Field Values

WRITER

public static final int WRITER
See Also:
Constant Field Values
Constructor Detail

Response

public Response(HttpConnection connection)
Method Detail

recycle

protected void recycle()

addCookie

public void addCookie(Cookie cookie)

containsHeader

public boolean containsHeader(String name)

encodeURL

public String encodeURL(String url)

encodeRedirectURL

public String encodeRedirectURL(String url)

encodeUrl

public String encodeUrl(String url)

encodeRedirectUrl

public String encodeRedirectUrl(String url)

sendError

public void sendError(int code,
                      String message)
               throws IOException
Throws:
IOException

sendError

public void sendError(int sc)
               throws IOException
Throws:
IOException

sendProcessing

public void sendProcessing()
                    throws IOException
Throws:
IOException

sendRedirect

public void sendRedirect(String location)
                  throws IOException
Throws:
IOException

setDateHeader

public void setDateHeader(String name,
                          long date)

addDateHeader

public void addDateHeader(String name,
                          long date)

setHeader

public void setHeader(String name,
                      String value)

getHeader

public String getHeader(String name)

getHeaders

public Enumeration getHeaders(String name)

addHeader

public void addHeader(String name,
                      String value)

setIntHeader

public void setIntHeader(String name,
                         int value)

addIntHeader

public void addIntHeader(String name,
                         int value)

setStatus

public void setStatus(int sc)

setStatus

public void setStatus(int sc,
                      String sm)

getCharacterEncoding

public String getCharacterEncoding()

getContentType

public String getContentType()

getOutputStream

public ServletOutputStream getOutputStream()
                                    throws IOException
Throws:
IOException

isWriting

public boolean isWriting()

getWriter

public PrintWriter getWriter()
                      throws IOException
Throws:
IOException

setCharacterEncoding

public void setCharacterEncoding(String encoding)

setContentLength

public void setContentLength(int len)

setLongContentLength

public void setLongContentLength(long len)

setContentType

public void setContentType(String contentType)

setBufferSize

public void setBufferSize(int size)

getBufferSize

public int getBufferSize()

flushBuffer

public void flushBuffer()
                 throws IOException
Throws:
IOException

reset

public void reset()

resetBuffer

public void resetBuffer()

isCommitted

public boolean isCommitted()

setLocale

public void setLocale(Locale locale)

getLocale

public Locale getLocale()

getStatus

public int getStatus()
Returns:
The HTTP status code that has been set for this request. This will be 200 (HttpServletResponse#SC_OK), unless explicitly set through one of the setStatus methods.

getReason

public String getReason()
Returns:
The reason associated with the current status. This will be null, unless one of the setStatus methods have been called.

complete

public void complete()
              throws IOException
Throws:
IOException

getContentCount

public long getContentCount()
Returns:
the number of bytes actually written in response body

getHttpFields

public HttpFields getHttpFields()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007 Mort Bay Consulting. All Rights Reserved.