Package org.apache.sling.servlets.post

# Klasse AbstractPostResponse

java.lang.Object
org.apache.sling.servlets.post.AbstractPostResponse

Alle implementierten Schnittstellen:
  `PostResponse`

Bekannte direkte Unterklassen:
  `HtmlResponse`, `JSONResponse`

@Deprecated public abstract class AbstractPostResponse extends Object implements PostResponse
Veraltet.
Use `AbstractJakartaPostResponse` instead.
The `AbstractPostResponse` class provides a basic implementation of the `PostResponse` interface maintaining properties to be prepared for sending the response in an internal map.

## Feldübersicht

Felder
Modifizierer und Typ
Feld
Beschreibung
`static final String`
`PN_ERROR`
Veraltet.
Name of the error property set by `setError(Throwable)`
`static final String`
`PN_IS_CREATED`
Veraltet.
Name of the create status property set by `setCreateRequest(boolean)`
`static final String`
`PN_LOCATION`
Veraltet.
Name of the location property set by `setLocation(String)`
`static final String`
`PN_PARENT_LOCATION`
Veraltet.
Name of the parent location property set by `setParentLocation(String)`
`static final String`
`PN_PATH`
Veraltet.
Name of the path property set by `setPath(String)`
`static final String`
`PN_REFERER`
Veraltet.
Name of the referer property set by `setReferer(String)`
`static final String`
`PN_STATUS_CODE`
Veraltet.
Name of the status code property set by `setStatus(int, String)`
`static final String`
`PN_STATUS_MESSAGE`
Veraltet.
Name of the status message property set by `setStatus(int, String)`
`static final String`
`PN_TITLE`
Veraltet.
Name of the title property set by `setTitle(String)`

## Konstruktorübersicht

Konstruktoren
Konstruktor
Beschreibung
`AbstractPostResponse()`
Veraltet.

## Methodenübersicht

Modifizierer und Typ
Methode
Beschreibung
`protected abstract void`
`doSend(javax.servlet.http.HttpServletResponse response)`
Veraltet.
`Throwable`
`getError()`
Veraltet.
Returns any recorded error or `null`
`String`
`getLocation()`
Veraltet.
Returns the location of the modification.
`String`
`getParentLocation()`
Veraltet.
Returns the parent location of the modification. this is the externalized form of the parent node of the current path.
`String`
`getPath()`
Veraltet.
Returns the absolute path of the item upon which the request operated.
`protected Object`
`getProperty(String name)`
Veraltet.
Returns the generic response property with the given name and type or `null` if no such property exists.
`protected <Type> Type`
`getProperty(String name, Class<Type> type)`
Veraltet.
Returns the generic response property with the given name and type or `null` if no such property exists or the property is not of the requested type.
`String`
`getReferer()`
Veraltet.
Returns the referer previously set by `PostResponse.setReferer(String)`
`int`
`getStatusCode()`
Veraltet.
Returns the status code of this instance.
`String`
`getStatusMessage()`
Veraltet.
Returns the status message or `null` if no has been set with the `PostResponse.setStatus(int, String)` method.
`boolean`
`isCreateRequest()`
Veraltet.
Returns `true` if this was a create request.
`protected boolean`
`isSafeReferer()`
Veraltet.
determines if the referer has a proper referer including protocol
`boolean`
`isSuccessful()`
Veraltet.
Returns `true` if no `error` is set and if the `status code` is one of the 2xx codes.
`void`
`onCopied(String srcPath, String dstPath)`
Veraltet.
Records a 'copied' change.
`void`
`onCreated(String path)`
Veraltet.
Records a 'created' change
`void`
`onDeleted(String path)`
Veraltet.
Records a 'deleted' change
`void`
`onModified(String path)`
Veraltet.
Records a 'modified' change
`void`
`onMoved(String srcPath, String dstPath)`
Veraltet.
Records a 'moved' change.
`final void`
`send(javax.servlet.http.HttpServletResponse response, boolean setStatus)`
Veraltet.
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)`
Veraltet.
Sets whether the request was a create request or not.
`void`
`setError(Throwable error)`
Veraltet.
Sets the recorded error causing the operation to fail.
`void`
`setLocation(String location)`
Veraltet.
Sets the location of this modification.
`void`
`setParentLocation(String parentLocation)`
Veraltet.
Sets the parent location of the modification.
`void`
`setPath(String path)`
Veraltet.
Sets the absolute path of the item upon which the request operated.
`protected void`
`setProperty(String name, Object value)`
Veraltet.
Sets a generic response property with the given
`void`
`setReferer(String referer)`
Veraltet.
Sets the referer property
`void`
`setStatus(int code, String message)`
Veraltet.
sets the response status code properties
`void`
`setTitle(String title)`
Veraltet.
Sets the title of the response message

### Von Klasse geerbte Methoden java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Von Schnittstelle geerbte Methoden org.apache.sling.servlets.post.PostResponse

`onChange`

## Felddetails

### PN_TITLE

public static final String PN_TITLE
Veraltet.
Name of the title property set by `setTitle(String)`

Siehe auch:
  - Konstantenfeldwerte

### PN_STATUS_CODE

public static final String PN_STATUS_CODE
Veraltet.
Name of the status code property set by `setStatus(int, String)`

Siehe auch:
  - Konstantenfeldwerte

### PN_STATUS_MESSAGE

public static final String PN_STATUS_MESSAGE
Veraltet.
Name of the status message property set by `setStatus(int, String)`

Siehe auch:
  - Konstantenfeldwerte

### PN_LOCATION

public static final String PN_LOCATION
Veraltet.
Name of the location property set by `setLocation(String)`

Siehe auch:
  - Konstantenfeldwerte

### PN_PARENT_LOCATION

public static final String PN_PARENT_LOCATION
Veraltet.
Name of the parent location property set by `setParentLocation(String)`

Siehe auch:
  - Konstantenfeldwerte

### PN_PATH

public static final String PN_PATH
Veraltet.
Name of the path property set by `setPath(String)`

Siehe auch:
  - Konstantenfeldwerte

### PN_REFERER

public static final String PN_REFERER
Veraltet.
Name of the referer property set by `setReferer(String)`

Siehe auch:
  - Konstantenfeldwerte

### PN_IS_CREATED

public static final String PN_IS_CREATED
Veraltet.
Name of the create status property set by `setCreateRequest(boolean)`

Siehe auch:
  - Konstantenfeldwerte

### PN_ERROR

public static final String PN_ERROR
Veraltet.
Name of the error property set by `setError(Throwable)`

Siehe auch:
  - Konstantenfeldwerte

## Konstruktordetails

### AbstractPostResponse

public AbstractPostResponse()
Veraltet.

## Methodendetails

### getReferer

public String getReferer()
Veraltet.
Returns the referer previously set by `PostResponse.setReferer(String)`

Angegeben von:
  `getReferer` in Schnittstelle `PostResponse`
Gibt zurück:
  the referer

### setReferer

public void setReferer(String referer)
Veraltet.
Sets the referer property

Angegeben von:
  `setReferer` in Schnittstelle `PostResponse`
Parameter:
  `referer` - the referer

### getPath

public String getPath()
Veraltet.
Returns the absolute path of the item upon which the request operated.

If the `PostResponse.setPath(String)` method has not been called yet, this method returns `null`.

Angegeben von:
  `getPath` in Schnittstelle `PostResponse`
Gibt zurück:
  the path (might be null)

### setPath

public void setPath(String path)
Veraltet.
Sets the absolute path of the item upon which the request operated.

Angegeben von:
  `setPath` in Schnittstelle `PostResponse`
Parameter:
  `path` - the path

### isCreateRequest

public boolean isCreateRequest()
Veraltet.
Returns `true` if this was a create request.

Before calling the `PostResponse.setCreateRequest(boolean)` method, this method always returns `false`.

Angegeben von:
  `isCreateRequest` in Schnittstelle `PostResponse`
Gibt zurück:
  if this was a create request

### setCreateRequest

public void setCreateRequest(boolean isCreateRequest)
Veraltet.
Sets whether the request was a create request or not.

Angegeben von:
  `setCreateRequest` in Schnittstelle `PostResponse`
Parameter:
  `isCreateRequest` - true if the request was a create request

### getLocation

public String getLocation()
Veraltet.
Returns the location of the modification.

If the `PostResponse.setLocation(String)` method has not been called yet, this method returns `null`.

Angegeben von:
  `getLocation` in Schnittstelle `PostResponse`
Gibt zurück:
  the location

### setLocation

public void setLocation(String location)
Veraltet.
Beschreibung aus Schnittstelle kopiert: `PostResponse`
Sets the location of this modification. This is the externalized form of the `current path`.

Angegeben von:
  `setLocation` in Schnittstelle `PostResponse`
Parameter:
  `location` - the location

### getParentLocation

public String getParentLocation()
Veraltet.
Returns the parent location of the modification. this is the externalized form of the parent node of the current path.

Angegeben von:
  `getParentLocation` in Schnittstelle `PostResponse`
Gibt zurück:
  the location of the modification.

### setParentLocation

public void setParentLocation(String parentLocation)
Veraltet.
Beschreibung aus Schnittstelle kopiert: `PostResponse`
Sets the parent location of the modification. This is the externalized form of the parent node of the `current path`.

Angegeben von:
  `setParentLocation` in Schnittstelle `PostResponse`
Parameter:
  `parentLocation` - the parent location of the modification

### setTitle

public void setTitle(String title)
Veraltet.
Sets the title of the response message

Angegeben von:
  `setTitle` in Schnittstelle `PostResponse`
Parameter:
  `title` - the title

### setStatus

public void setStatus(int code, String message)
Veraltet.
sets the response status code properties

Angegeben von:
  `setStatus` in Schnittstelle `PostResponse`
Parameter:
  `code` - the code
  `message` - the message

### getStatusCode

public int getStatusCode()
Veraltet.
Returns the status code of this instance. If the status code has never been set by calling the `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.

Angegeben von:
  `getStatusCode` in Schnittstelle `PostResponse`
Gibt zurück:
  the status code

### getStatusMessage

public String getStatusMessage()
Veraltet.
Beschreibung aus Schnittstelle kopiert: `PostResponse`
Returns the status message or `null` if no has been set with the `PostResponse.setStatus(int, String)` method.

Angegeben von:
  `getStatusMessage` in Schnittstelle `PostResponse`
Gibt zurück:
  the status message (might be null)

### getError

public Throwable getError()
Veraltet.
Returns any recorded error or `null`

Angegeben von:
  `getError` in Schnittstelle `PostResponse`
Gibt zurück:
  an error or `null`

### setError

public void setError(Throwable error)
Veraltet.
Beschreibung aus Schnittstelle kopiert: `PostResponse`
Sets the recorded error causing the operation to fail.

Angegeben von:
  `setError` in Schnittstelle `PostResponse`
Parameter:
  `error` - the throwable

### isSuccessful

public boolean isSuccessful()
Veraltet.
Returns `true` if no `error` is set and if the `status code` is one of the 2xx codes.

Angegeben von:
  `isSuccessful` in Schnittstelle `PostResponse`
Gibt zurück:
  true if the status code is 2xx

### onModified

public void onModified(String path)
Veraltet.
Records a 'modified' change

Angegeben von:
  `onModified` in Schnittstelle `PostResponse`
Parameter:
  `path` - path of the item that was modified

### onCreated

public void onCreated(String path)
Veraltet.
Records a 'created' change

Angegeben von:
  `onCreated` in Schnittstelle `PostResponse`
Parameter:
  `path` - path of the item that was created

### onDeleted

public void onDeleted(String path)
Veraltet.
Records a 'deleted' change

Angegeben von:
  `onDeleted` in Schnittstelle `PostResponse`
Parameter:
  `path` - path of the item that was deleted

### onMoved

public void onMoved(String srcPath, String dstPath)
Veraltet.
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.

Angegeben von:
  `onMoved` in Schnittstelle `PostResponse`
Parameter:
  `srcPath` - source path of the node that was moved
  `dstPath` - destination path of the node that was moved.

### onCopied

public void onCopied(String srcPath, String dstPath)
Veraltet.
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.

Angegeben von:
  `onCopied` in Schnittstelle `PostResponse`
Parameter:
  `srcPath` - source path of the node that was copied
  `dstPath` - destination path of the node that was copied.

### setProperty

protected void setProperty(String name, Object value)
Veraltet.
Sets a generic response property with the given

Parameter:
  `name` - name of the property
  `value` - value of the property

### getProperty

protected <Type> Type getProperty(String name, Class<Type> type)
Veraltet.
Returns the generic response property with the given name and type or `null` if no such property exists or the property is not of the requested type.

Typparameter:
  `Type` - the return type
Parameter:
  `name` - the name of the requetested property
  `type` - the type of the parameter which should be returned
Gibt zurück:
  the property as the requested type or null if not available at all or not in the requested type

### getProperty

protected Object getProperty(String name)
Veraltet.
Returns the generic response property with the given name and type or `null` if no such property exists.

Parameter:
  `name` - the name of the response property
Gibt zurück:
  the requested property (might be null)

### isSafeReferer

protected boolean isSafeReferer()
Veraltet.
determines if the referer has a proper referer including protocol

Gibt zurück:
  true if HTTP or HTTPS protocol information is available in the referer

### doSend

protected abstract void doSend(javax.servlet.http.HttpServletResponse response) throws IOException
Veraltet.

Löst aus:
  `IOException`

### send

public final void send(javax.servlet.http.HttpServletResponse response, boolean setStatus) throws IOException
Veraltet.
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.

Angegeben von:
  `send` in Schnittstelle `PostResponse`
Parameter:
  `response` - to send to
  `setStatus` - whether to set the status code on the response
Löst aus:
  `IOException` - if an i/o exception occurs