public class MockHstResponse extends MockHstResponseBase implements HstResponse
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, 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_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY
Constructor and Description |
---|
MockHstResponse() |
Modifier and Type | Method and Description |
---|---|
void |
addEpilogue(Comment comment)
Add an epilogue comment, which gets rendered at the end of the render window.
|
void |
addHeadElement(Element element,
String keyHint)
Adds an header element property to the response.
|
void |
addPreamble(Comment comment)
Add a preamble comment node, which gets rendered at the beginning of the render
window.
|
void |
addPreamble(Element element)
Preamble
Node s are written before the rest of the content of this HstResponseState . |
void |
addProcessedHeadElement(Element headElement) |
boolean |
containsHeadElement(String keyHint)
Asks if a property exists already or not.
|
HstURL |
createActionURL()
Creates a HST Action URL targeting the HstComponent.
|
Comment |
createComment(String comment)
Creates a comment element
|
HstURL |
createComponentRenderingURL()
Creates a HST component rendering URL targeting a specific HstComponent
|
Element |
createElement(String tagName)
Creates an element of the type specified to be used in the
HstResponse.addPreamble(org.w3c.dom.Element) method. |
HstURL |
createNavigationalURL(String pathInfo)
Creates a HST Navigational Render URL
|
HstURL |
createRenderURL()
Creates a HST Render URL targeting the HstComponent.
|
HstURL |
createResourceURL()
Creates a HST Resource URL targeting the current HstComponent.
|
HstURL |
createResourceURL(String referenceNamespace)
Creates a HST Resource URL targeting the HstComponent indicated by referenceNamespace.
|
void |
flushChildContent(String name)
Flushes the buffer of child window.
|
void |
flushChildContent(String name,
Writer writer)
Flushes the child window, and writes its content to the
Writer . |
void |
forward(String pathInfo)
Forwards the page request to pathInfo.
|
List<String> |
getChildContentNames()
Returns the flushable child content window names.
|
List<Comment> |
getEpilogueComments() |
String |
getForwardPathInfo() |
List<Element> |
getHeadElements()
Retrieves header element list.
|
String |
getNamespace()
The value returned by this method should be prefixed or appended to elements,
such as JavaScript variables or function names, to ensure they are unique
in the context of the HST-managed page.
|
List<Comment> |
getPreambleComments() |
List<Element> |
getPreambleElements() |
List<Element> |
getProcessedHeadElements() |
Map<String,String[]> |
getRenderParameters() |
String |
getRenderPath() |
String |
getServeResourcePath() |
Element |
getWrapperElement()
Returns the wrapper element for the rendered content
|
boolean |
isRendererSkipped()
For single /subtree component rendering mode that has
HstComponentInfo.isStandalone() equal to false , this
check can be used whether some HstComponent won't get its renderer called. |
void |
setNamespace(String namespace) |
void |
setRendererSkipped(boolean rendererSkipped) |
void |
setRenderParameter(String key,
String value)
Sets a String parameter for the rendering phase.
|
void |
setRenderParameter(String key,
String[] values)
Sets a String parameter for the rendering phase.
|
void |
setRenderParameters(Map<String,String[]> parameters)
Sets a parameter map for the render request.
|
void |
setRenderPath(String renderPath)
Sets the renderPath dynamically.
|
void |
setServeResourcePath(String serveResourcePath)
Sets the serveResourcePath dynamically.
|
void |
setWrapperElement(Element element)
Sets wrapper element for the rendered content
|
addCookie, addDateHeader, addHeader, addIntHeader, containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, flushBuffer, getBufferSize, getCharacterEncoding, getContentAsByteArray, getContentAsString, getContentLength, getContentType, getCookies, getHeader, getHeaderNames, getHeaders, getHeaders, getLocale, getOutputStream, getRedirectLocation, getStatus, getStatusCode, getStatusMessage, getWriter, isCommitted, reset, resetBuffer, sendError, sendError, sendRedirect, setBufferSize, setCharacterEncoding, setContentLength, setContentType, setDateHeader, setHeader, setIntHeader, setLocale, setStatus, setStatus
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addCookie, sendError, sendError, sendRedirect, setStatus
public HstURL createRenderURL()
HstResponse
createRenderURL
in interface HstResponse
public HstURL createNavigationalURL(String pathInfo)
HstResponse
createNavigationalURL
in interface HstResponse
pathInfo
- the path to be navigatedpublic HstURL createActionURL()
HstResponse
createActionURL
in interface HstResponse
public HstURL createResourceURL()
HstResponse
createResourceURL
in interface HstResponse
public HstURL createResourceURL(String referenceNamespace)
HstResponse
createResourceURL
in interface HstResponse
public HstURL createComponentRenderingURL()
HstResponse
createComponentRenderingURL
in interface HstResponse
public String getNamespace()
HstResponse
getNamespace
in interface HstResponse
public void setNamespace(String namespace)
public void setRenderParameter(String key, String value)
HstResponse
setRenderParameter
in interface HstResponse
key
- key of the render parametervalue
- value of the render parameterpublic void setRenderParameter(String key, String[] values)
HstResponse
setRenderParameter
in interface HstResponse
key
- key of the render parametervalues
- values of the render parameterspublic void setRenderParameters(Map<String,String[]> parameters)
HstResponse
setRenderParameters
in interface HstResponse
public Element createElement(String tagName)
HstResponse
HstResponse.addPreamble(org.w3c.dom.Element)
method.createElement
in interface HstResponse
tagName
- the tag name of the elementpublic Comment createComment(String comment)
HstResponse
createComment
in interface HstResponse
comment
- the comment textpublic void addHeadElement(Element element, String keyHint)
HstResponse
addHeadElement
in interface HstResponse
public List<Element> getHeadElements()
HstResponse
getHeadElements
in interface HstResponse
public boolean containsHeadElement(String keyHint)
HstResponse
containsHeadElement
in interface HstResponse
public void addProcessedHeadElement(Element headElement)
addProcessedHeadElement
in interface HstResponse
public void setRenderPath(String renderPath)
HstResponse
HstComponent.doBeforeRender(HstRequest, HstResponse)
method.setRenderPath
in interface HstResponse
public String getRenderPath()
public void setServeResourcePath(String serveResourcePath)
HstResponse
HstComponent.doBeforeServeResource(HstRequest, HstResponse)
method.setServeResourcePath
in interface HstResponse
public String getServeResourcePath()
public void flushChildContent(String name) throws IOException
HstResponse
Note: the child content can be flushed only once. If it is already flushed, then the next invocations will not make any effect.
flushChildContent
in interface HstResponse
name
- the name of the child windowIOException
public void flushChildContent(String name, Writer writer) throws IOException
HstResponse
Writer
. Note that not everything that gets
flushed ends up in the writer
, for example head contributions not.flushChildContent
in interface HstResponse
name
- the name of the child window to flushwriter
- the Writer
the content gets flushed toIOException
public List<String> getChildContentNames()
HstResponse
getChildContentNames
in interface HstResponse
public void forward(String pathInfo) throws IOException
HstResponse
Only in HstComponent.doBeforeRender(HstRequest, HstResponse)
,
the invocation on this method will be effective.
If the invocation on this method is done in a view page during render phase,
the invocation will be just ignored with no operation.
forward
in interface HstResponse
pathInfo
- the path info to forward. It should start with a "/" and is relative to the root of your hst sitemapIOException
- If the response was committedpublic String getForwardPathInfo()
public void setWrapperElement(Element element)
HstResponse
setWrapperElement
in interface HstResponse
public Element getWrapperElement()
HstResponse
getWrapperElement
in interface HstResponse
public void addPreamble(Comment comment)
HstResponse
addPreamble
in interface HstResponse
comment
- the comment nodepublic void addPreamble(Element element)
HstResponse
Node
s are written before the rest of the content of this HstResponseState
. Note that
from this element
only the element, attributes and text of the element
are printed, and *not*
any descendant @link org.w3c.dom.Node}s of element
addPreamble
in interface HstResponse
element
- the element that is a preamblepublic void addEpilogue(Comment comment)
HstResponse
addEpilogue
in interface HstResponse
comment
- the comment nodepublic boolean isRendererSkipped()
HstResponse
HstComponentInfo.isStandalone()
equal to false
, this
check can be used whether some HstComponent
won't get its renderer called. In other words, this is for performance optimization
to short-circuit the doBeforeRender for components that won't get rendered any way.isRendererSkipped
in interface HstResponse
true
when for this HstResponse
the renderer won't be invokedpublic void setRendererSkipped(boolean rendererSkipped)
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.