Package org.apache.sling.api.servlets
Class HtmlResponse
java.lang.Object
org.apache.sling.api.servlets.HtmlResponse
- Direct Known Subclasses:
HtmlResponseProxy
Deprecated.
use org.apache.sling.servlets.post.HtmlResponse instead.
Generator for a HTML status response that displays the changes made in a post
request. see HtmlResponse.html for the
format.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Deprecated.human readable changelogstatic final String
Deprecated.The Throwable caught while processing the request.static final String
Deprecated.Indicating whether request processing created new data.static final String
Deprecated.externally mapped location url of the modified pathstatic final String
Deprecated.externally mapped location url of the parent of the modified pathstatic final String
Deprecated.the path of the modified item. this is usually the addressed resource or in case of a creation request (eg: /foo/*) the path of the newly created node.static final String
Deprecated.the referrer of the requeststatic final String
Deprecated.status code. more or less http response status codesstatic final String
Deprecated.some human readable status messagestatic final String
Deprecated.some human readable title like: 200 Created /foo/bar -
Constructor Summary
ConstructorDescriptionDeprecated.Creates a new html response with default settings, which isnull
for almost all properties except theisCreateRequest()
which defaults tofalse
. -
Method Summary
Modifier and TypeMethodDescriptiongetError()
Deprecated.Returns any recorded error ornull
Deprecated.Returns the location of the modification. this is the externalized form of the current path.Deprecated.Returns the parent location of the modification. this is the externalized form of the parent node of the current path.getPath()
Deprecated.Returns the absolute path of the item upon which the request operated.getProperty
(String name) Deprecated.Returns the generic response property with the given name and type ornull
if no such property exists.<Type> Type
getProperty
(String name, Class<Type> type) Deprecated.Returns the generic response property with the given name and type ornull
if no such property exists or the property is not of the requested type.Deprecated.Returns the referer as from the 'referer' request header.int
Deprecated.Returns the status code of this instance.Deprecated.Get the status messageboolean
Deprecated.Returnstrue
if this was a create request.boolean
Deprecated.void
Deprecated.Records a generic change of the giventype
.void
Deprecated.Records a 'copied' change.void
Deprecated.Records a 'created' changevoid
Deprecated.Records a 'deleted' changevoid
onModified
(String path) Deprecated.Records a 'modified' changevoid
Deprecated.Records a 'moved' change.void
send
(javax.servlet.http.HttpServletResponse response, boolean setStatus) Deprecated.Writes the response to the given writer and replaces all ${var} patterns by the value of the respective property. if the property is not defined the pattern is not modified.void
setCreateRequest
(boolean isCreateRequest) Deprecated.Sets whether the request was a create request or not.void
Deprecated.Set the errorvoid
setLocation
(String location) Deprecated.Set the locationvoid
setParentLocation
(String parentLocation) Deprecated.Set the parent locationvoid
Deprecated.Sets the absolute path of the item upon which the request operated.void
setProperty
(String name, Object value) Deprecated.Sets a generic response property with the givenvoid
setReferer
(String referer) Deprecated.Sets the referer propertyvoid
Deprecated.sets the response status code propertiesvoid
Deprecated.Sets the title of the response message
-
Field Details
-
PN_TITLE
Deprecated.some human readable title like: 200 Created /foo/bar- See Also:
-
PN_STATUS_CODE
Deprecated.status code. more or less http response status codes- See Also:
-
PN_STATUS_MESSAGE
Deprecated.some human readable status message- See Also:
-
PN_LOCATION
Deprecated.externally mapped location url of the modified path- See Also:
-
PN_PARENT_LOCATION
Deprecated.externally mapped location url of the parent of the modified path- See Also:
-
PN_PATH
Deprecated.the path of the modified item. this is usually the addressed resource or in case of a creation request (eg: /foo/*) the path of the newly created node.- See Also:
-
PN_REFERER
Deprecated.the referrer of the request- See Also:
-
PN_IS_CREATED
Deprecated.Indicating whether request processing created new data. This property is initialized tofalse
and may be changed by calling thesetCreateRequest(boolean)
method.- See Also:
-
PN_CHANGE_LOG
Deprecated.human readable changelog- See Also:
-
PN_ERROR
Deprecated.The Throwable caught while processing the request. This property is not set unless thesetError(Throwable)
method is called.- See Also:
-
-
Constructor Details
-
HtmlResponse
public HtmlResponse()Deprecated.Creates a new html response with default settings, which isnull
for almost all properties except theisCreateRequest()
which defaults tofalse
.
-
-
Method Details
-
getReferer
Deprecated.Returns the referer as from the 'referer' request header.- Returns:
- The referrer
-
setReferer
Deprecated.Sets the referer property- Parameters:
referer
- The referrer to set
-
getPath
Deprecated.Returns the absolute path of the item upon which the request operated.If the
setPath(String)
method has not been called yet, this method returnsnull
.- Returns:
- The path or
null
.
-
setPath
Deprecated.Sets the absolute path of the item upon which the request operated.- Parameters:
path
- The path
-
isCreateRequest
public boolean isCreateRequest()Deprecated.Returnstrue
if this was a create request.Before calling the
setCreateRequest(boolean)
method, this method always returnsfalse
.- Returns:
true
if this is a create request
-
setCreateRequest
public void setCreateRequest(boolean isCreateRequest) Deprecated.Sets whether the request was a create request or not.- Parameters:
isCreateRequest
- flag for the create request
-
getLocation
Deprecated.Returns the location of the modification. this is the externalized form of the current path.- Returns:
- the location of the modification.
-
setLocation
Deprecated.Set the location- Parameters:
location
- The location
-
getParentLocation
Deprecated.Returns the parent location of the modification. this is the externalized form of the parent node of the current path.- Returns:
- the location of the modification.
-
setParentLocation
Deprecated.Set the parent location- Parameters:
parentLocation
- The parent location
-
setTitle
Deprecated.Sets the title of the response message- Parameters:
title
- the title
-
setStatus
Deprecated.sets the response status code properties- Parameters:
code
- the codemessage
- the message
-
getStatusCode
public int getStatusCode()Deprecated.Returns the status code of this instance. If the status code has never been set by calling thesetStatus(int, String)
method, the status code is determined by checking if there was an error. If there was an error, the response is assumed to be unsuccessful and 500 is returned. If there is no error, the response is assumed to be successful and 200 is returned.- Returns:
- The status code
-
getStatusMessage
Deprecated.Get the status message- Returns:
- The status message
-
getError
Deprecated.Returns any recorded error ornull
- Returns:
- an error or
null
-
setError
Deprecated.Set the error- Parameters:
error
- The error
-
isSuccessful
public boolean isSuccessful()Deprecated.- Returns:
true
if successful
-
onModified
Deprecated.Records a 'modified' change- Parameters:
path
- path of the item that was modified
-
onCreated
Deprecated.Records a 'created' change- Parameters:
path
- path of the item that was created
-
onDeleted
Deprecated.Records a 'deleted' change- Parameters:
path
- path of the item that was deleted
-
onMoved
Deprecated.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.
- Parameters:
srcPath
- source path of the node that was moveddstPath
- destination path of the node that was moved.
-
onCopied
Deprecated.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.
- Parameters:
srcPath
- source path of the node that was copieddstPath
- destination path of the node that was copied.
-
onChange
Deprecated.Records a generic change of the giventype
.The change is added to the internal list of changes with the syntax of a method call, where the
type
is the method name and thearguments
are the string arguments to the method enclosed in double quotes. For example, the the callonChange("sameple", "arg1", "arg2");
is aded assample("arg1", "arg2")
to the internal list of changes.- Parameters:
type
- The type of the modificationarguments
- The arguments to the modifications
-
setProperty
Deprecated.Sets a generic response property with the given- Parameters:
name
- name of the propertyvalue
- value of the property
-
getProperty
Deprecated.Returns the generic response property with the given name and type ornull
if no such property exists or the property is not of the requested type.- Type Parameters:
Type
- The type to get- Parameters:
name
- The property nametype
- The type to get- Returns:
- The property value or
null
.
-
getProperty
Deprecated.Returns the generic response property with the given name and type ornull
if no such property exists.- Parameters:
name
- The property name- Returns:
- The property value or
null
.
-
send
public void send(javax.servlet.http.HttpServletResponse response, boolean setStatus) throws IOException Deprecated.Writes the response to the given writer and replaces all ${var} patterns by the value of the respective property. if the property is not defined the pattern is not modified.- Parameters:
response
- to send tosetStatus
- whether to set the status code on the response- Throws:
IOException
- if an i/o exception occurs
-