Package org.apache.sling.servlets.post

# Klasse JakartaJSONResponse

java.lang.Object
org.apache.sling.servlets.post.AbstractJakartaPostResponse
org.apache.sling.servlets.post.JakartaJSONResponse

Alle implementierten Schnittstellen:
  `JakartaPostResponse`

public class JakartaJSONResponse extends AbstractJakartaPostResponse
The `JSONResponse` is an `AbstractJakartaPostResponse` preparing the response in JSON.

Seit:
  2.5.0

## Verschachtelte Klassen - Übersicht

Verschachtelte Klassen
Modifizierer und Typ
Klasse
Beschreibung
`class`
`JakartaJSONResponse.JSONResponseException`

## Feldübersicht

Felder
Modifizierer und Typ
Feld
Beschreibung
`static final String`
`RESPONSE_CONTENT_TYPE`

### Von Klasse geerbte Felder org.apache.sling.servlets.post.AbstractJakartaPostResponse

`PN_ERROR, PN_IS_CREATED, PN_LOCATION, PN_PARENT_LOCATION, PN_PATH, PN_REFERER, PN_STATUS_CODE, PN_STATUS_MESSAGE, PN_TITLE`

## Konstruktorübersicht

Konstruktoren
Konstruktor
Beschreibung
`JakartaJSONResponse()`

## Methodenübersicht

Modifizierer und Typ
Methode
Beschreibung
`protected void`
`doSend(jakarta.servlet.http.HttpServletResponse response)`
`Throwable`
`getError()`
Returns any recorded error or `null`
`Object`
`getProperty(String name)`
Returns the generic response property with the given name and type or `null` if no such property exists.
`void`
`onChange(String type, String... arguments)`
Records a generic change of the given `type` with arguments.
`void`
`setError(Throwable error)`
Sets the recorded error causing the operation to fail.
`void`
`setProperty(String name, Object value)`
This method accepts values that correspond to json primitives or otherwise assumes that the toString() of the value can be parsed as json.

### Von Klasse geerbte Methoden org.apache.sling.servlets.post.AbstractJakartaPostResponse

`getLocation, getParentLocation, getPath, getProperty, getReferer, getStatusCode, getStatusMessage, isCreateRequest, isSafeReferer, isSuccessful, onCopied, onCreated, onDeleted, onModified, onMoved, send, setCreateRequest, setLocation, setParentLocation, setPath, setReferer, setStatus, setTitle`

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

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

## Felddetails

### RESPONSE_CONTENT_TYPE

public static final String RESPONSE_CONTENT_TYPE

Siehe auch:
  - Konstantenfeldwerte

## Konstruktordetails

### JakartaJSONResponse

public JakartaJSONResponse()

## Methodendetails

### onChange

public void onChange(String type, String... arguments)
Beschreibung aus Schnittstelle kopiert: `JakartaPostResponse`
Records a generic change of the given `type` with arguments.

Parameter:
  `type` - The type of the modification
  `arguments` - The arguments to the modifications

### setError

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

Angegeben von:
  `setError` in Schnittstelle `JakartaPostResponse`
Setzt außer Kraft:
  `setError` in Klasse `AbstractJakartaPostResponse`
Parameter:
  `error` - the throwable

### getError

public Throwable getError()
Beschreibung aus Klasse kopiert: `AbstractJakartaPostResponse`
Returns any recorded error or `null`

Angegeben von:
  `getError` in Schnittstelle `JakartaPostResponse`
Setzt außer Kraft:
  `getError` in Klasse `AbstractJakartaPostResponse`
Gibt zurück:
  an error or `null`

### setProperty

public void setProperty(String name, Object value)
This method accepts values that correspond to json primitives or otherwise assumes that the toString() of the value can be parsed as json. If neither is the case it will throw an Exception. Assuming the above holds, it will put the value as json directly into the json value part of the response.

Setzt außer Kraft:
  `setProperty` in Klasse `AbstractJakartaPostResponse`
Parameter:
  `name` - name of the property
  `value` - value of the property - either of type {String, Boolean, Number, null} or the toString() is parseable as json
Löst aus:
  `JakartaJSONResponse.JSONResponseException` - if the value is not usable

### getProperty

public Object getProperty(String name)
Beschreibung aus Klasse kopiert: `AbstractJakartaPostResponse`
Returns the generic response property with the given name and type or `null` if no such property exists.

Setzt außer Kraft:
  `getProperty` in Klasse `AbstractJakartaPostResponse`
Parameter:
  `name` - the name of the response property
Gibt zurück:
  the requested property (might be null)

### doSend

protected void doSend(jakarta.servlet.http.HttpServletResponse response) throws IOException

Angegeben von:
  `doSend` in Klasse `AbstractJakartaPostResponse`
Löst aus:
  `IOException`