public abstract class AbstractPostResponse extends java.lang.Object implements PostResponse
AbstractPostResponse
class provides a basic implementation
of the PostResponse
interface maintaining properties to be
prepared for sending the response in an internal map.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PN_ERROR
Name of the error property set by
setError(Throwable) |
static java.lang.String |
PN_IS_CREATED
Name of the create status property set by
setCreateRequest(boolean) |
static java.lang.String |
PN_LOCATION
Name of the location property set by
setLocation(String) |
static java.lang.String |
PN_PARENT_LOCATION
Name of the parent location property set by
setParentLocation(String) |
static java.lang.String |
PN_PATH
Name of the path property set by
setPath(String) |
static java.lang.String |
PN_REFERER
Name of the referer property set by
setReferer(String) |
static java.lang.String |
PN_STATUS_CODE
Name of the status code property set by
setStatus(int, String) |
static java.lang.String |
PN_STATUS_MESSAGE
Name of the status message property set by
setStatus(int, String) |
static java.lang.String |
PN_TITLE
Name of the title property set by
setTitle(String) |
Constructor and Description |
---|
AbstractPostResponse() |
Modifier and Type | Method and Description |
---|---|
java.lang.Throwable |
getError()
Returns any recorded error or
null |
java.lang.String |
getLocation()
Returns the location of the modification.
|
java.lang.String |
getParentLocation()
Returns the parent location of the modification.
|
java.lang.String |
getPath()
Returns the absolute path of the item upon which the request operated.
|
java.lang.String |
getReferer()
Returns the referer as from the 'referer' request header.
|
int |
getStatusCode()
Returns the status code of this instance.
|
java.lang.String |
getStatusMessage()
Returns the status message or
null if no has been set with
the PostResponse.setStatus(int, String) method. |
boolean |
isCreateRequest()
Returns
true if this was a create request. |
boolean |
isSuccessful()
|
void |
onCopied(java.lang.String srcPath,
java.lang.String dstPath)
Records a 'copied' change.
|
void |
onCreated(java.lang.String path)
Records a 'created' change
|
void |
onDeleted(java.lang.String path)
Records a 'deleted' change
|
void |
onModified(java.lang.String path)
Records a 'modified' change
|
void |
onMoved(java.lang.String srcPath,
java.lang.String dstPath)
Records a 'moved' change.
|
void |
send(HttpServletResponse response,
boolean setStatus)
Writes the response to the given writer and replaces all ${var} patterns
by the value of the respective property.
|
void |
setCreateRequest(boolean isCreateRequest)
Sets whether the request was a create request or not.
|
void |
setError(java.lang.Throwable error)
Sets the recorded error causing the operation to fail.
|
void |
setLocation(java.lang.String location)
Sets the location of this modification.
|
void |
setParentLocation(java.lang.String parentLocation)
Sets the parent location of the modification.
|
void |
setPath(java.lang.String path)
Sets the absolute path of the item upon which the request operated.
|
void |
setReferer(java.lang.String referer)
Sets the referer property
|
void |
setStatus(int code,
java.lang.String message)
sets the response status code properties
|
void |
setTitle(java.lang.String title)
Sets the title of the response message
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onChange
public static final java.lang.String PN_TITLE
setTitle(String)
public static final java.lang.String PN_STATUS_CODE
setStatus(int, String)
public static final java.lang.String PN_STATUS_MESSAGE
setStatus(int, String)
public static final java.lang.String PN_LOCATION
setLocation(String)
public static final java.lang.String PN_PARENT_LOCATION
setParentLocation(String)
public static final java.lang.String PN_PATH
setPath(String)
public static final java.lang.String PN_REFERER
setReferer(String)
public static final java.lang.String PN_IS_CREATED
setCreateRequest(boolean)
public static final java.lang.String PN_ERROR
setError(Throwable)
public java.lang.String getReferer()
getReferer
in interface PostResponse
public void setReferer(java.lang.String referer)
setReferer
in interface PostResponse
public java.lang.String getPath()
If the setPath(String)
method has not been called yet, this
method returns null
.
getPath
in interface PostResponse
public void setPath(java.lang.String path)
setPath
in interface PostResponse
public boolean isCreateRequest()
true
if this was a create request.
Before calling the setCreateRequest(boolean)
method, this method
always returns false
.
isCreateRequest
in interface PostResponse
public void setCreateRequest(boolean isCreateRequest)
setCreateRequest
in interface PostResponse
public java.lang.String getLocation()
getLocation
in interface PostResponse
public void setLocation(java.lang.String location)
PostResponse
current path
.setLocation
in interface PostResponse
public java.lang.String getParentLocation()
getParentLocation
in interface PostResponse
public void setParentLocation(java.lang.String parentLocation)
PostResponse
current path
.setParentLocation
in interface PostResponse
public void setTitle(java.lang.String title)
setTitle
in interface PostResponse
title
- the titlepublic void setStatus(int code, java.lang.String message)
setStatus
in interface PostResponse
code
- the codemessage
- the messagepublic int getStatusCode()
setStatus(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.getStatusCode
in interface PostResponse
public java.lang.String getStatusMessage()
PostResponse
null
if no has been set with
the PostResponse.setStatus(int, String)
method.getStatusMessage
in interface PostResponse
public java.lang.Throwable getError()
null
getError
in interface PostResponse
null
public void setError(java.lang.Throwable error)
PostResponse
setError
in interface PostResponse
public boolean isSuccessful()
isSuccessful
in interface PostResponse
public void onModified(java.lang.String path)
onModified
in interface PostResponse
path
- path of the item that was modifiedpublic void onCreated(java.lang.String path)
onCreated
in interface PostResponse
path
- path of the item that was createdpublic void onDeleted(java.lang.String path)
onDeleted
in interface PostResponse
path
- path of the item that was deletedpublic void onMoved(java.lang.String srcPath, java.lang.String dstPath)
Note: the moved change only records the basic move command. the implied changes on the moved properties and sub nodes are not recorded.
onMoved
in interface PostResponse
srcPath
- source path of the node that was moveddstPath
- destination path of the node that was moved.public void onCopied(java.lang.String srcPath, java.lang.String dstPath)
Note: the copy change only records the basic copy command. the implied changes on the copied properties and sub nodes are not recorded.
onCopied
in interface PostResponse
srcPath
- source path of the node that was copieddstPath
- destination path of the node that was copied.public final void send(HttpServletResponse response, boolean setStatus) throws java.io.IOException
send
in interface PostResponse
response
- to send tosetStatus
- whether to set the status code on the responsejava.io.IOException
- if an i/o exception occurs"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"