Package org.apache.sling.servlets.post
Class AbstractPostResponseWrapper
java.lang.Object
org.apache.sling.servlets.post.AbstractPostResponseWrapper
- All Implemented Interfaces:
- 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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiongetError()Returns any recorded error ornullReturns the location of the modification.Returns the parent location of the modification.getPath()Returns the absolute path of the item upon which the request operated.Returns the referer previously set byPostResponse.setReferer(String)intReturns the status code of this instance.Returns the status message ornullif no has been set with thePostResponse.setStatus(int, String)method.abstract PostResponseUse this method to return an instance of the class being wrapped.booleanReturnstrueif this was a create request.booleanvoidRecords a generic change of the giventypewith arguments.voidRecords a 'copied' change.voidRecords a 'created' changevoidRecords a 'deleted' changevoidonModified(String path) Records a 'modified' changevoidRecords a 'moved' change.voidsend(javax.servlet.http.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.voidSets the recorded error causing the operation to fail.voidsetLocation(String location) Sets the location of this modification.voidsetParentLocation(String parentLocation) Sets the parent location of the modification.voidSets the absolute path of the item upon which the request operated.voidsetReferer(String referer) Sets the referer propertyvoidSets the response status code propertiesvoidSets the title of the response message
- 
Constructor Details- 
AbstractPostResponseWrapperpublic AbstractPostResponseWrapper()
 
- 
- 
Method Details- 
getWrappedUse this method to return an instance of the class being wrapped.- Returns:
- the wrapped PostResponse instance
 
- 
setRefererDescription copied from interface:PostResponseSets the referer property- Specified by:
- setRefererin interface- PostResponse
- Parameters:
- referer- the referer
 
- 
getRefererDescription copied from interface:PostResponseReturns the referer previously set byPostResponse.setReferer(String)- Specified by:
- getRefererin interface- PostResponse
- Returns:
- the referer
 
- 
setPathDescription copied from interface:PostResponseSets the absolute path of the item upon which the request operated.- Specified by:
- setPathin interface- PostResponse
- Parameters:
- path- the path
 
- 
getPathDescription 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 interface- PostResponse
- Returns:
- the path (might be null)
 
- 
setCreateRequestpublic void setCreateRequest(boolean isCreateRequest) Description copied from interface:PostResponseSets whether the request was a create request or not.- Specified by:
- setCreateRequestin interface- PostResponse
- Parameters:
- isCreateRequest- true if the request was a create request
 
- 
isCreateRequestpublic 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 interface- PostResponse
- Returns:
- if this was a create request
 
- 
setLocationDescription copied from interface:PostResponseSets the location of this modification. This is the externalized form of thecurrent path.- Specified by:
- setLocationin interface- PostResponse
- Parameters:
- location- the location
 
- 
getLocationDescription 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 interface- PostResponse
- Returns:
- the location
 
- 
setParentLocationDescription 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 interface- PostResponse
- Parameters:
- parentLocation- the parent location of the modification
 
- 
getParentLocationDescription 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 interface- PostResponse
- Returns:
- the parent location
 
- 
setTitleDescription copied from interface:PostResponseSets the title of the response message- Specified by:
- setTitlein interface- PostResponse
- Parameters:
- title- the title
 
- 
setStatusDescription copied from interface:PostResponseSets the response status code properties- Specified by:
- setStatusin interface- PostResponse
- Parameters:
- code- the code
- message- the message
 
- 
getStatusCodepublic 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 interface- PostResponse
- Returns:
- the status code
 
- 
getStatusMessageDescription copied from interface:PostResponseReturns the status message ornullif no has been set with thePostResponse.setStatus(int, String)method.- Specified by:
- getStatusMessagein interface- PostResponse
- Returns:
- the status message (might be null)
 
- 
setErrorDescription copied from interface:PostResponseSets the recorded error causing the operation to fail.- Specified by:
- setErrorin interface- PostResponse
- Parameters:
- error- the throwable
 
- 
getErrorDescription copied from interface:PostResponseReturns any recorded error ornull- Specified by:
- getErrorin interface- PostResponse
- Returns:
- an error or null
 
- 
isSuccessfulpublic boolean isSuccessful()Description copied from interface:PostResponse- Specified by:
- isSuccessfulin interface- PostResponse
- Returns:
- true if the status code is 2xx
 
- 
onCreatedDescription copied from interface:PostResponseRecords a 'created' change- Specified by:
- onCreatedin interface- PostResponse
- Parameters:
- path- path of the item that was created
 
- 
onModifiedDescription copied from interface:PostResponseRecords a 'modified' change- Specified by:
- onModifiedin interface- PostResponse
- Parameters:
- path- path of the item that was modified
 
- 
onDeletedDescription copied from interface:PostResponseRecords a 'deleted' change- Specified by:
- onDeletedin interface- PostResponse
- Parameters:
- path- path of the item that was deleted
 
- 
onMovedDescription 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 interface- PostResponse
- Parameters:
- srcPath- source path of the node that was moved
- dstPath- destination path of the node that was moved.
 
- 
onCopiedDescription 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 interface- PostResponse
- Parameters:
- srcPath- source path of the node that was copied
- dstPath- destination path of the node that was copied.
 
- 
onChangeDescription copied from interface:PostResponseRecords a generic change of the giventypewith arguments.- Specified by:
- onChangein interface- PostResponse
- Parameters:
- type- The type of the modification
- arguments- The arguments to the modifications
 
- 
sendpublic void send(javax.servlet.http.HttpServletResponse response, boolean setStatus) throws 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 interface- PostResponse
- Parameters:
- response- to send to
- setStatus- whether to set the status code on the response
- Throws:
- IOException- if an i/o exception occurs
 
 
-