Package org.apache.sling.servlets.post
Class AbstractPostResponseWrapper
- java.lang.Object
 - 
- org.apache.sling.servlets.post.AbstractPostResponseWrapper
 
 
- 
- All Implemented Interfaces:
 PostResponse
public abstract class AbstractPostResponseWrapper extends java.lang.Object implements PostResponse
Provides a simple implementation of PostResponse that can be subclassed by developers wishing to provide specialized behavior to an existing PostResponse instance. The default implementation of all methods is to call through to the wrapped PostResponse instance. 
- 
- 
Constructor Summary
Constructors Constructor Description AbstractPostResponseWrapper() 
- 
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.ThrowablegetError()Returns any recorded error ornulljava.lang.StringgetLocation()Returns the location of the modification.java.lang.StringgetParentLocation()Returns the parent location of the modification.java.lang.StringgetPath()Returns the absolute path of the item upon which the request operated.java.lang.StringgetReferer()Returns the referer previously set byPostResponse.setReferer(String)intgetStatusCode()Returns the status code of this instance.java.lang.StringgetStatusMessage()Returns the status message ornullif no has been set with thePostResponse.setStatus(int, String)method.abstract PostResponsegetWrapped()Use this method to return an instance of the class being wrapped.booleanisCreateRequest()Returnstrueif this was a create request.booleanisSuccessful()voidonChange(java.lang.String type, java.lang.String... arguments)Records a generic change of the giventypewith arguments.voidonCopied(java.lang.String srcPath, java.lang.String dstPath)Records a 'copied' change.voidonCreated(java.lang.String path)Records a 'created' changevoidonDeleted(java.lang.String path)Records a 'deleted' changevoidonModified(java.lang.String path)Records a 'modified' changevoidonMoved(java.lang.String srcPath, java.lang.String dstPath)Records a 'moved' change.voidsend(HttpServletResponse response, boolean setStatus)Writes the response back over the provided HTTP channel.voidsetCreateRequest(boolean isCreateRequest)Sets whether the request was a create request or not.voidsetError(java.lang.Throwable error)Sets the recorded error causing the operation to fail.voidsetLocation(java.lang.String location)Sets the location of this modification.voidsetParentLocation(java.lang.String parentLocation)Sets the parent location of the modification.voidsetPath(java.lang.String path)Sets the absolute path of the item upon which the request operated.voidsetReferer(java.lang.String referer)Sets the referer propertyvoidsetStatus(int code, java.lang.String message)Sets the response status code propertiesvoidsetTitle(java.lang.String title)Sets the title of the response message 
 - 
 
- 
- 
Method Detail
- 
getWrapped
public abstract PostResponse getWrapped()
Use this method to return an instance of the class being wrapped.- Returns:
 - the wrapped PostResponse instance
 
 
- 
setReferer
public void setReferer(java.lang.String referer)
Description copied from interface:PostResponseSets the referer property- Specified by:
 setRefererin interfacePostResponse- Parameters:
 referer- the referer
 
- 
getReferer
public java.lang.String getReferer()
Description copied from interface:PostResponseReturns the referer previously set byPostResponse.setReferer(String)- Specified by:
 getRefererin interfacePostResponse- Returns:
 - the referer
 
 
- 
setPath
public void setPath(java.lang.String path)
Description copied from interface:PostResponseSets the absolute path of the item upon which the request operated.- Specified by:
 setPathin interfacePostResponse- Parameters:
 path- the path
 
- 
getPath
public java.lang.String getPath()
Description copied from interface:PostResponseReturns the absolute path of the item upon which the request operated.If the
PostResponse.setPath(String)method has not been called yet, this method returnsnull.- Specified by:
 getPathin interfacePostResponse- Returns:
 - the path (might be null)
 
 
- 
setCreateRequest
public void setCreateRequest(boolean isCreateRequest)
Description copied from interface:PostResponseSets whether the request was a create request or not.- Specified by:
 setCreateRequestin interfacePostResponse- Parameters:
 isCreateRequest- true if the request was a create request
 
- 
isCreateRequest
public boolean isCreateRequest()
Description copied from interface:PostResponseReturnstrueif this was a create request.Before calling the
PostResponse.setCreateRequest(boolean)method, this method always returnsfalse.- Specified by:
 isCreateRequestin interfacePostResponse- Returns:
 - if this was a create request
 
 
- 
setLocation
public void setLocation(java.lang.String location)
Description copied from interface:PostResponseSets the location of this modification. This is the externalized form of thecurrent path.- Specified by:
 setLocationin interfacePostResponse- Parameters:
 location- the location
 
- 
getLocation
public java.lang.String getLocation()
Description copied from interface:PostResponseReturns the location of the modification.If the
PostResponse.setLocation(String)method has not been called yet, this method returnsnull.- Specified by:
 getLocationin interfacePostResponse- Returns:
 - the location
 
 
- 
setParentLocation
public void setParentLocation(java.lang.String parentLocation)
Description copied from interface:PostResponseSets the parent location of the modification. This is the externalized form of the parent node of thecurrent path.- Specified by:
 setParentLocationin interfacePostResponse- Parameters:
 parentLocation- the parent location of the modification
 
- 
getParentLocation
public java.lang.String getParentLocation()
Description copied from interface:PostResponseReturns the parent location of the modification.If the
PostResponse.setParentLocation(String)method has not been called yet, this method returnsnull.- Specified by:
 getParentLocationin interfacePostResponse- Returns:
 - the parent location
 
 
- 
setTitle
public void setTitle(java.lang.String title)
Description copied from interface:PostResponseSets the title of the response message- Specified by:
 setTitlein interfacePostResponse- Parameters:
 title- the title
 
- 
setStatus
public void setStatus(int code, java.lang.String message)Description copied from interface:PostResponseSets the response status code properties- Specified by:
 setStatusin interfacePostResponse- Parameters:
 code- the codemessage- the message
 
- 
getStatusCode
public int getStatusCode()
Description copied from interface:PostResponseReturns the status code of this instance. If the status code has never been set by calling thePostResponse.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.- Specified by:
 getStatusCodein interfacePostResponse- Returns:
 - the status code
 
 
- 
getStatusMessage
public java.lang.String getStatusMessage()
Description copied from interface:PostResponseReturns the status message ornullif no has been set with thePostResponse.setStatus(int, String)method.- Specified by:
 getStatusMessagein interfacePostResponse- Returns:
 - the status message (might be null)
 
 
- 
setError
public void setError(java.lang.Throwable error)
Description copied from interface:PostResponseSets the recorded error causing the operation to fail.- Specified by:
 setErrorin interfacePostResponse- Parameters:
 error- the throwable
 
- 
getError
public java.lang.Throwable getError()
Description copied from interface:PostResponseReturns any recorded error ornull- Specified by:
 getErrorin interfacePostResponse- Returns:
 - an error or 
null 
 
- 
isSuccessful
public boolean isSuccessful()
Description copied from interface:PostResponse- Specified by:
 isSuccessfulin interfacePostResponse- Returns:
 - true if the status code is 2xx
 
 
- 
onCreated
public void onCreated(java.lang.String path)
Description copied from interface:PostResponseRecords a 'created' change- Specified by:
 onCreatedin interfacePostResponse- Parameters:
 path- path of the item that was created
 
- 
onModified
public void onModified(java.lang.String path)
Description copied from interface:PostResponseRecords a 'modified' change- Specified by:
 onModifiedin interfacePostResponse- Parameters:
 path- path of the item that was modified
 
- 
onDeleted
public void onDeleted(java.lang.String path)
Description copied from interface:PostResponseRecords a 'deleted' change- Specified by:
 onDeletedin interfacePostResponse- Parameters:
 path- path of the item that was deleted
 
- 
onMoved
public void onMoved(java.lang.String srcPath, java.lang.String dstPath)Description copied from interface:PostResponseRecords 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:
 onMovedin interfacePostResponse- 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 interface:PostResponseRecords 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:
 onCopiedin interfacePostResponse- 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:PostResponseRecords a generic change of the giventypewith arguments.- Specified by:
 onChangein interfacePostResponse- Parameters:
 type- The type of the modificationarguments- The arguments to the modifications
 
- 
send
public void send(HttpServletResponse response, boolean setStatus) throws java.io.IOException
Description copied from interface:PostResponseWrites the response back over the provided HTTP channel. The actual format of the response is implementation dependent.- Specified by:
 sendin interfacePostResponse- Parameters:
 response- to send tosetStatus- whether to set the status code on the response- Throws:
 java.io.IOException- if an i/o exception occurs
 
 - 
 
 -