Package rife.engine
Interface Response
- All Known Implementing Classes:
AbstractResponse,HttpResponse,MockResponse
public interface Response
This interface contains all the methods that the web engine needs to be
able to send a response to the client.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddDateHeader(String name, long date) voidvoidaddIntHeader(String name, int integer) voidClears the text buffer is it's enabled.voidclose()Closed the content output stream.booleancontainsHeader(String name) voidenableTextBuffer(boolean enabled) Enables or disabled the text output buffer.voidflush()Forces all the streamed content to be output to the client.Retrieves the content type that was explicitly set for this response.Retrieves the underlyingHttpServletResponse.Retrieves the element that was last processed withbooleanIndicates whether this response's content type has been explicitly set.booleanIndicates whether the text output buffer is enabled.voidPrints the string representation of an object to the request text output.voidprint(Collection<CharSequence> deferredContent) Prints a list of text snippets to the request text output.voidPrints the content of a template to the request text output.voidsendError(int statusCode) voidvoidsendRedirect(String location) voidsetContentLength(int length) voidsetContentType(String contentType) voidsetDateHeader(String name, long date) voidvoidsetIntHeader(String name, int value) voidsetLastElement(Element element) Sets the latest target element of this response.voidvoidsetStatus(int statusCode)
-
Method Details
-
setLastElement
Sets the latest target element of this response. This method is called repeatedly by the engine to make it possible to trace which elements have been processed.- Parameters:
element- an element that has been executed in the context of this response- Since:
- 1.0
-
getLastElement
Element getLastElement()Retrieves the element that was last processed with- Returns:
- the last element
- Since:
- 1.0
-
enableTextBuffer
void enableTextBuffer(boolean enabled) Enables or disabled the text output buffer.The buffer is enabled by default and its buffered contents will be flushed when the buffer is disabled.
- Parameters:
enabled-trueto enable the text buffer; orfalseto disable it- Since:
- 1.0
-
isTextBufferEnabled
boolean isTextBufferEnabled()Indicates whether the text output buffer is enabled.- Returns:
truewhen the text buffer is enabled; orfalsewhen it is disabled.- Since:
- 1.0
-
print
Prints the content of a template to the request text output.- Parameters:
template- the template that will be printed- Throws:
EngineException- if an error occurs during the output of the template content- Since:
- 1.0
- See Also:
-
print
Prints a list of text snippets to the request text output.- Parameters:
deferredContent- the text snippets that will be printed- Throws:
EngineException- if an error occurs during the output of the text snippets // * @see #print(Template)- Since:
- 1.0
- See Also:
-
print
Prints the string representation of an object to the request text output. The string representation will be created through aString.valueOf(value)call.- Parameters:
value- the object that will be output- Throws:
EngineException- if an error occurs during the output of the content // * @see #print(Template)- Since:
- 1.0
- See Also:
-
clearBuffer
void clearBuffer()Clears the text buffer is it's enabled.If the text buffer is disabled, this method does nothing.
- Since:
- 1.0
-
flush
Forces all the streamed content to be output to the client.If the text buffer is enabled, this will flush its content to the output stream first.
- Throws:
EngineException- Since:
- 1.0
-
close
Closed the content output stream.All content is
flushedfirst.- Throws:
EngineException- Since:
- 1.0
-
getOutputStream
- Throws:
EngineException- Since:
- 1.0
-
getWriter
- Throws:
IOException- Since:
- 1.0
-
setContentType
- Since:
- 1.0
-
isContentTypeSet
boolean isContentTypeSet()Indicates whether this response's content type has been explicitly set.- Returns:
trueif it has been set; orfalseotherwise- Since:
- 1.0
- See Also:
-
getContentType
String getContentType()Retrieves the content type that was explicitly set for this response.- Returns:
- the content type as a String; or
nullif the content type wasn't set - Since:
- 1.0
- See Also:
-
setLocale
- Since:
- 1.0
-
getLocale
Locale getLocale()- Since:
- 1.0
-
getCharacterEncoding
String getCharacterEncoding()- Since:
- 1.0
-
setContentLength
- Throws:
EngineException- Since:
- 1.0
-
addCookie
- Since:
- 1.0
-
addHeader
- Since:
- 1.0
-
addDateHeader
- Since:
- 1.0
-
addIntHeader
- Since:
- 1.0
-
containsHeader
- Since:
- 1.0
-
sendError
- Throws:
EngineException- Since:
- 1.0
-
sendError
- Throws:
EngineException- Since:
- 1.0
-
sendRedirect
- Throws:
EngineException- Since:
- 1.0
-
setDateHeader
- Since:
- 1.0
-
setHeader
- Since:
- 1.0
-
setIntHeader
- Since:
- 1.0
-
setStatus
void setStatus(int statusCode) - Since:
- 1.0
-
encodeURL
- Since:
- 1.0
-
getHttpServletResponse
HttpServletResponse getHttpServletResponse()Retrieves the underlyingHttpServletResponse.- Returns:
- the underlying
HttpServletResponseinstance; ornullif this response isn't backed byHttpServletResponse - Since:
- 1.0
-