org.apache.tomcat.core
Interface Response

All Known Implementing Classes:
ResponseImpl

public interface Response

Author:
James Duncan Davidson [duncan@eng.sun.com], Jason Hunter [jch@eng.sun.com], James Todd [gonzo@eng.sun.com], Harish Prabandham, Hans Bergsten , costin@dnt.ro

Method Summary
 void addCookie(javax.servlet.http.Cookie cookie)
           
 void addHeader(java.lang.String name, java.lang.String value)
           
 boolean containsHeader(java.lang.String name)
           
 void doWrite(byte[] buffer, int pos, int count)
           
 void endHeaders()
          Signal that we're done with the headers, and body will follow.
 void finish()
          Signal that we're done with a particular request, the server can go on and read more requests or close the socket
 void flushBuffer()
          Any implementation needs to notify ContextManger
 int getBufferSize()
           
 java.lang.String getCharacterEncoding()
          translate locale into encoding.
 int getContentLength()
           
 java.lang.String getContentType()
           
 java.util.Enumeration getCookies()
           
 javax.servlet.http.HttpServletResponse getFacade()
          One-to-one with Facade.
 java.util.Locale getLocale()
           
 org.apache.tomcat.util.MimeHeaders getMimeHeaders()
           
 org.apache.tomcat.util.ByteBuffer getOutputBuffer()
           
 javax.servlet.ServletOutputStream getOutputStream()
          Either re-implement getOutputStream or return BufferedServletOutputStream(this) and implement doWrite();
 Request getRequest()
           
 java.lang.String getSessionId()
           
 int getStatus()
           
 java.io.PrintWriter getWriter()
           
 boolean isBufferCommitted()
           
 boolean isIncluded()
          True if we are in an included servlet
 boolean isStarted()
          True if getOutputStream or getWriter was called.
 boolean isUsingStream()
          True if getOutputStream was called.
 boolean isUsingWriter()
          Stream/Writer control
 void recycle()
          Response objects will be pool-able
 void reset()
           
 void resetBuffer()
           
 void setBufferSize(int size)
           
 void setContentLength(int contentLength)
           
 void setContentType(java.lang.String contentType)
          Set content type - this might also set encoding, if specified
 void setHeader(java.lang.String name, java.lang.String value)
           
 void setIncluded(boolean b)
          The response will not set any header or the status line - it can only write to the output stream or flush.
 void setLocale(java.util.Locale locale)
           
 void setOutputBuffer(org.apache.tomcat.util.ByteBuffer buf)
           
 void setRequest(Request request)
          One-to-one relation with Request
 void setSessionId(java.lang.String sId)
          Will set the session id.
 void setStatus(int status)
           
 void setUsingStream(boolean stream)
          The output stream is used.
 void setUsingWriter(boolean writer)
          Stream/Writer control
 

Method Detail

containsHeader

public boolean containsHeader(java.lang.String name)

getMimeHeaders

public org.apache.tomcat.util.MimeHeaders getMimeHeaders()

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)

endHeaders

public void endHeaders()
                throws java.io.IOException
Signal that we're done with the headers, and body will follow. Any implementation needs to notify ContextManager, to allow interceptors to fix headers.

isStarted

public boolean isStarted()
True if getOutputStream or getWriter was called. XXX change it to "if any output was writen" Used by RD.forward() and ServletWrapper.error()

isUsingStream

public boolean isUsingStream()
True if getOutputStream was called. Used to avoid the ugly try getWriter() catch getOutputStream.

setUsingStream

public void setUsingStream(boolean stream)
The output stream is used.

isUsingWriter

public boolean isUsingWriter()
Stream/Writer control

setUsingWriter

public void setUsingWriter(boolean writer)
Stream/Writer control

finish

public void finish()
            throws java.io.IOException
Signal that we're done with a particular request, the server can go on and read more requests or close the socket

getOutputStream

public javax.servlet.ServletOutputStream getOutputStream()
Either re-implement getOutputStream or return BufferedServletOutputStream(this) and implement doWrite();

doWrite

public void doWrite(byte[] buffer,
                    int pos,
                    int count)
             throws java.io.IOException

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException

isIncluded

public boolean isIncluded()
True if we are in an included servlet

setIncluded

public void setIncluded(boolean b)
The response will not set any header or the status line - it can only write to the output stream or flush. This is used to implement RD.include() and can be used for HTTP/0.9

getBufferSize

public int getBufferSize()

setBufferSize

public void setBufferSize(int size)
                   throws java.lang.IllegalStateException

isBufferCommitted

public boolean isBufferCommitted()

reset

public void reset()
           throws java.lang.IllegalStateException

resetBuffer

public void resetBuffer()
                 throws java.lang.IllegalStateException

flushBuffer

public void flushBuffer()
                 throws java.io.IOException
Any implementation needs to notify ContextManger

addCookie

public void addCookie(javax.servlet.http.Cookie cookie)

getCookies

public java.util.Enumeration getCookies()

getLocale

public java.util.Locale getLocale()

setLocale

public void setLocale(java.util.Locale locale)

getCharacterEncoding

public java.lang.String getCharacterEncoding()
translate locale into encoding.

setContentType

public void setContentType(java.lang.String contentType)
Set content type - this might also set encoding, if specified

getContentType

public java.lang.String getContentType()

setContentLength

public void setContentLength(int contentLength)

getContentLength

public int getContentLength()

setStatus

public void setStatus(int status)

getStatus

public int getStatus()

setSessionId

public void setSessionId(java.lang.String sId)
Will set the session id. The session interceptor might process it and add a Cookie header, and it can be used to rewrite URLs. This replace "system cookies" ( it was the only use for them )

getSessionId

public java.lang.String getSessionId()

getOutputBuffer

public org.apache.tomcat.util.ByteBuffer getOutputBuffer()

setOutputBuffer

public void setOutputBuffer(org.apache.tomcat.util.ByteBuffer buf)

getFacade

public javax.servlet.http.HttpServletResponse getFacade()
One-to-one with Facade. You can use HttpResponseFacade.

setRequest

public void setRequest(Request request)
One-to-one relation with Request

getRequest

public Request getRequest()

recycle

public void recycle()
Response objects will be pool-able


Copyright © 2000 Apache Software Foundation. All Rights Reserved.