SilverStream
Application Server 3.5

com.sssw.shr.http
Interface AgiHttpServletResponse

All Superinterfaces:
HttpServletResponse, ServletResponse

public interface AgiHttpServletResponse
extends HttpServletResponse

This interface extends the standard javax.servlet.http.HttpServletResponse interface with additional SilverStream functionality. Currently the additional methods are concerned with getting information from a response.


Fields inherited from interface javax.servlet.http.HttpServletResponse
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_FORBIDDEN, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY
 
Method Summary
 void flushBuffer()
          Forces any content in the buffer to be written to the client.
 int getBufferSize()
          Returns the actual buffer size used for the response.
 int getContentLength()
          Get the content length, or -1 if none is specified.
 String getContentType()
          Get the content type of the message; null if unknown.
 long getDateHeader(String name)
          Get the specified header as a Date (long time in millis).
 String getHeader(String name)
          Get the specified header as a String.
 Enumeration getHeaderNames()
          Get the header names as an enumeration of Strings.
 int getIntHeader(String name)
          Get the specified header as an int.
 int getStatus()
          Get the status code of the reply.
 boolean isCommitted()
          Returns a boolean indicating if the response has been committed.
 void reset()
          Returns a boolean indicating if the response has been committed.
 void setBufferSize(int size)
          Sets the preferred buffer size for the body of the response.
 void setBufferSizeInfinite(boolean b)
          Set the buffer size of the reply body to be used to be infinite.
 
Methods implemented from interface javax.servlet.http.HttpServletResponse
addCookie, containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, sendError, sendError, sendRedirect, setDateHeader, setHeader, setIntHeader, setStatus, setStatus
 
Methods implemented from interface javax.servlet.ServletResponse
getCharacterEncoding, getOutputStream, getWriter, setContentLength, setContentType
 

Method Detail

getContentLength

public int getContentLength()
Get the content length, or -1 if none is specified.

getContentType

public String getContentType()
Get the content type of the message; null if unknown.

getDateHeader

public long getDateHeader(String name)
Get the specified header as a Date (long time in millis).

getHeader

public String getHeader(String name)
Get the specified header as a String.

getIntHeader

public int getIntHeader(String name)
Get the specified header as an int.

getHeaderNames

public Enumeration getHeaderNames()
Get the header names as an enumeration of Strings.

getStatus

public int getStatus()
Get the status code of the reply.

setBufferSizeInfinite

public void setBufferSizeInfinite(boolean b)
Set the buffer size of the reply body to be used to be infinite. This is a potentially risky thing to do. Your buffer size will grow without bounds potentially using all memory on the server. This does let you buffer all the contents you wish to return to the client and then change any header values or the status code you want. Setting the buffer size to infinite overrides any buffer size you may have set with the ServletResponse.setBufferSize(int) method. If you do call both, then the buffer size you set is used as a hint to efficiently grow the infinite buffer.
Parameters:
b - true if you want to set it to infinite, false if not

setBufferSize

public void setBufferSize(int 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 used 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; if content has been written, this method throws an IllegalStateException.
Parameters:
size - the preferred buffer size
Throws:
IllegalStateException - if this method is called after content has been written
See Also:
AgiHttpServletResponse.getBufferSize(), AgiHttpServletResponse.flushBuffer(), AgiHttpServletResponse.isCommitted(), AgiHttpServletResponse.reset()

getBufferSize

public int getBufferSize()
Returns the actual buffer size used for the response. If no buffering is used, this method returns 0.
Returns:
the actual buffer size used
See Also:
AgiHttpServletResponse.setBufferSize(int), AgiHttpServletResponse.flushBuffer(), AgiHttpServletResponse.isCommitted(), AgiHttpServletResponse.reset()

reset

public void reset()
Returns a boolean indicating if the response has been committed. A commited response has already had its status code and headers written.
See Also:
AgiHttpServletResponse.setBufferSize(int), AgiHttpServletResponse.getBufferSize(), AgiHttpServletResponse.flushBuffer(), AgiHttpServletResponse.isCommitted()

isCommitted

public boolean isCommitted()
Returns a boolean indicating if the response has been committed. A commited response has already had its status code and headers written.
Returns:
true if the response has been committed
See Also:
AgiHttpServletResponse.setBufferSize(int), AgiHttpServletResponse.getBufferSize(), AgiHttpServletResponse.flushBuffer(), AgiHttpServletResponse.reset()

flushBuffer

public void flushBuffer()
                 throws IOException
Forces any content in the buffer to be written to the client. A call to this method automatically commits the response, meaning the status code and headers will be written.
Throws:
IOException - if there is an error with the underlying stream
See Also:
AgiHttpServletResponse.setBufferSize(int), AgiHttpServletResponse.getBufferSize(), AgiHttpServletResponse.isCommitted(), AgiHttpServletResponse.reset()

SilverStream
Application Server 3.5