Package com.adobe.granite.ui.components
Class HtmlResponse
- java.lang.Object
-
- org.apache.sling.servlets.post.AbstractPostResponse
-
- com.adobe.granite.ui.components.HtmlResponse
-
- All Implemented Interfaces:
PostResponse
public class HtmlResponse extends AbstractPostResponse
The post response which produces HTML containing metadata, such as status code, title, so that the client can parse it.
-
-
Field Summary
-
Fields inherited from class org.apache.sling.servlets.post.AbstractPostResponse
PN_ERROR, PN_IS_CREATED, PN_LOCATION, PN_PARENT_LOCATION, PN_PATH, PN_REFERER, PN_STATUS_CODE, PN_STATUS_MESSAGE, PN_TITLE
-
-
Constructor Summary
Constructors Constructor Description HtmlResponse(XSSAPI xss, I18n i18n, java.util.Locale locale)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLink(java.lang.String rel, java.lang.String href, java.lang.String text)
Adds a link to the response.void
addRedirectLink(java.lang.String href, java.lang.String text)
Adds a redirect link to indicate where the client should go after the post.void
onChange(java.lang.String type, java.lang.String... arguments)
Records a generic change of the giventype
with arguments.void
onCopied(java.lang.String srcPath, java.lang.String dstPath)
Records a 'copied' change.void
onCreated(java.lang.String path)
Records a 'created' changevoid
onDeleted(java.lang.String path)
Records a 'deleted' changevoid
onModified(java.lang.String path)
Records a 'modified' changevoid
onMoved(java.lang.String srcPath, java.lang.String dstPath)
Records a 'moved' change.void
setDescription(java.lang.String description)
void
setGeneralError(int code)
Sets the general purpose error message using the given status code.-
Methods inherited from class org.apache.sling.servlets.post.AbstractPostResponse
getError, getLocation, getParentLocation, getPath, getReferer, getStatusCode, getStatusMessage, isCreateRequest, isSuccessful, send, setCreateRequest, setError, setLocation, setParentLocation, setPath, setReferer, setStatus, setTitle
-
-
-
-
Method Detail
-
onModified
public void onModified(java.lang.String path)
Description copied from class:AbstractPostResponse
Records a 'modified' change- Specified by:
onModified
in interfacePostResponse
- Overrides:
onModified
in classAbstractPostResponse
- Parameters:
path
- path of the item that was modified
-
onCreated
public void onCreated(java.lang.String path)
Description copied from class:AbstractPostResponse
Records a 'created' change- Specified by:
onCreated
in interfacePostResponse
- Overrides:
onCreated
in classAbstractPostResponse
- Parameters:
path
- path of the item that was created
-
onDeleted
public void onDeleted(java.lang.String path)
Description copied from class:AbstractPostResponse
Records a 'deleted' change- Specified by:
onDeleted
in interfacePostResponse
- Overrides:
onDeleted
in classAbstractPostResponse
- Parameters:
path
- path of the item that was deleted
-
onMoved
public void onMoved(java.lang.String srcPath, java.lang.String dstPath)
Description copied from class:AbstractPostResponse
Records a 'moved' change.Note: the moved change only records the basic move command. the implied changes on the moved properties and sub nodes are not recorded.
- Specified by:
onMoved
in interfacePostResponse
- Overrides:
onMoved
in classAbstractPostResponse
- Parameters:
srcPath
- source path of the node that was moveddstPath
- destination path of the node that was moved.
-
onCopied
public void onCopied(java.lang.String srcPath, java.lang.String dstPath)
Description copied from class:AbstractPostResponse
Records a 'copied' change.Note: the copy change only records the basic copy command. the implied changes on the copied properties and sub nodes are not recorded.
- Specified by:
onCopied
in interfacePostResponse
- Overrides:
onCopied
in classAbstractPostResponse
- Parameters:
srcPath
- source path of the node that was copieddstPath
- destination path of the node that was copied.
-
onChange
public void onChange(java.lang.String type, java.lang.String... arguments)
Description copied from interface:PostResponse
Records a generic change of the giventype
with arguments.- Parameters:
type
- The type of the modificationarguments
- The arguments to the modifications
-
setDescription
public void setDescription(@CheckForNull java.lang.String description)
-
setGeneralError
public void setGeneralError(int code)
Sets the general purpose error message using the given status code. The title and description will be set automatically.- Parameters:
code
- the status code
-
addRedirectLink
public void addRedirectLink(@Nonnull java.lang.String href, @Nonnull java.lang.String text)
Adds a redirect link to indicate where the client should go after the post. Note that you SHOULD call this method once, otherwise would be a duplicate.- Parameters:
href
- the linktext
- the link text
-
addLink
public void addLink(@Nonnull java.lang.String rel, @Nonnull java.lang.String href, @Nonnull java.lang.String text)
Adds a link to the response. It is for the server to give affordance to the client.- Parameters:
rel
- relationship attributehref
- the linktext
- the link text
-
-