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 TypeMethodDescriptionvoid
void
addDateHeader
(String name, long date) void
void
addIntHeader
(String name, int integer) void
Clears the text buffer is it's enabled.void
close()
Closed the content output stream.boolean
containsHeader
(String name) void
enableTextBuffer
(boolean enabled) Enables or disabled the text output buffer.void
flush()
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 withboolean
Indicates whether this response's content type has been explicitly set.boolean
Indicates whether the text output buffer is enabled.void
Prints the string representation of an object to the request text output.void
print
(Collection<CharSequence> deferredContent) Prints a list of text snippets to the request text output.void
Prints the content of a template to the request text output.void
sendError
(int statusCode) void
void
sendRedirect
(String location) void
setContentLength
(int length) void
setContentType
(String contentType) void
setDateHeader
(String name, long date) void
void
setIntHeader
(String name, int value) void
setLastElement
(Element element) Sets the latest target element of this response.void
void
setStatus
(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
-true
to enable the text buffer; orfalse
to disable it- Since:
- 1.0
-
isTextBufferEnabled
boolean isTextBufferEnabled()Indicates whether the text output buffer is enabled.- Returns:
true
when the text buffer is enabled; orfalse
when 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
flushed
first.- 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:
true
if it has been set; orfalse
otherwise- 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
null
if 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
HttpServletResponse
instance; ornull
if this response isn't backed byHttpServletResponse
- Since:
- 1.0
-