public interface PostResponse
PostResponse
interface defines the API of a response
container which can (and should) be used by PostOperation
services to
prepare responses to be sent back to the client.
This bundle provides a preconfigured HtmlResponse
and a
JSONResponse
implementation of this interface. Clients may extend the
AbstractPostResponse
class to provide their own response
implementations.
Modifier and Type | Method and Description |
---|---|
Throwable |
getError()
Returns any recorded error or
null |
String |
getLocation()
Returns the location of the modification.
|
String |
getParentLocation()
Returns the parent location of the modification.
|
String |
getPath()
Returns the absolute path of the item upon which the request operated.
|
String |
getReferer()
Returns the referer previously set by
setReferer(String) |
int |
getStatusCode()
Returns the status code of this instance.
|
String |
getStatusMessage()
Returns the status message or
null if no has been set with
the setStatus(int, String) method. |
boolean |
isCreateRequest()
Returns
true if this was a create request. |
boolean |
isSuccessful()
|
void |
onChange(String type,
String... arguments)
Records a generic change of the given
type with arguments. |
void |
onCopied(String srcPath,
String dstPath)
Records a 'copied' change.
|
void |
onCreated(String path)
Records a 'created' change
|
void |
onDeleted(String path)
Records a 'deleted' change
|
void |
onModified(String path)
Records a 'modified' change
|
void |
onMoved(String srcPath,
String dstPath)
Records a 'moved' change.
|
void |
send(javax.servlet.http.HttpServletResponse response,
boolean setStatus)
Writes the response back over the provided HTTP channel.
|
void |
setCreateRequest(boolean isCreateRequest)
Sets whether the request was a create request or not.
|
void |
setError(Throwable error)
Sets the recorded error causing the operation to fail.
|
void |
setLocation(String location)
Sets the location of this modification.
|
void |
setParentLocation(String parentLocation)
Sets the parent location of the modification.
|
void |
setPath(String path)
Sets the absolute path of the item upon which the request operated.
|
void |
setReferer(String referer)
Sets the referer property
|
void |
setStatus(int code,
String message)
Sets the response status code properties
|
void |
setTitle(String title)
Sets the title of the response message
|
void setReferer(String referer)
String getReferer()
setReferer(String)
void setPath(String path)
String getPath()
If the setPath(String)
method has not been called yet, this
method returns null
.
void setCreateRequest(boolean isCreateRequest)
boolean isCreateRequest()
true
if this was a create request.
Before calling the setCreateRequest(boolean)
method, this method
always returns false
.
void setLocation(String location)
current path
.location
- String getLocation()
If the setLocation(String)
method has not been called yet, this
method returns null
.
void setParentLocation(String parentLocation)
current path
.String getParentLocation()
If the setParentLocation(String)
method has not been called yet,
this method returns null
.
void setTitle(String title)
title
- the titlevoid setStatus(int code, String message)
code
- the codemessage
- the messageint 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.String getStatusMessage()
null
if no has been set with
the setStatus(int, String)
method.void setError(Throwable error)
Throwable getError()
null
null
boolean isSuccessful()
void onCreated(String path)
path
- path of the item that was createdvoid onModified(String path)
path
- path of the item that was modifiedvoid onDeleted(String path)
path
- path of the item that was deletedvoid onMoved(String srcPath, 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.
srcPath
- source path of the node that was moveddstPath
- destination path of the node that was moved.void onCopied(String srcPath, 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.
srcPath
- source path of the node that was copieddstPath
- destination path of the node that was copied.void onChange(String type, String... arguments)
type
with arguments.type
- The type of the modificationarguments
- The arguments to the modificationsvoid send(javax.servlet.http.HttpServletResponse response, boolean setStatus) throws IOException
response
- to send tosetStatus
- whether to set the status code on the responseIOException
- if an i/o exception occursCopyright © 2017 The Apache Software Foundation. All rights reserved.