---
title: Response object reference
description: Access the Response object in Groovy exc?.response.
component: pingaccess
version: 9.0
page_id: pingaccess:reference_guides:pa_response_object_ref
canonical_url: https://docs.pingidentity.com/pingaccess/9.0/reference_guides/pa_response_object_ref.html
revdate: February 6, 2023
section_ids:
  purpose: Purpose
  groovy-sample: Groovy sample
  field-summary: Field summary
  method-summary: Method summary
---

# Response object reference

Access the Response object in Groovy `exc?.response`.

## Purpose

The Response object contains all information related to the service HTTP response. The response instance is sent on to the User-Agent after the rules are evaluated.

The fields and methods for the Response object are not available in scripts used with an agent.

## Groovy sample

```
if(exc?.response && exc?.identity) {
    exc.response.header.add("PA-Tracking-ID", exc.identity.trackingId)
}
pass()
```

## Field summary

| Field                         | Description                                |
| ----------------------------- | ------------------------------------------ |
| int getStatusCode()           | Contains the HTTP response status code.    |
| void setStatusCode(int)       | Sets the status code from an integer.      |
| String getStatusMessage()     | Contains the HTTP response status message. |
| void setStatusMessage(String) | Sets the status message from a string.     |

## Method summary

| Method                                         | Description                                                                                                                                                                                                                                                                                                                 |
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| boolean isRedirect()                           | Returns true if the status code is in the 300s.                                                                                                                                                                                                                                                                             |
| [Header](pa_headers_object_ref.html) getHeader | Contains the HTTP header *(tooltip: \<div class="paragraph">&#xA;\<p>A section of an HTTP request or response that conveys additional information relevant to the client or server in the transaction.\</p>&#xA;\</div>)* information from the response.&#xA;&#xA;Previously executed custom rules can modify these values. |
| [Body](pa_body_object_ref.html) getBody        | Contains the HTTP body information from the response.&#xA;&#xA;Previously executed custom rules can modify these values.                                                                                                                                                                                                    |
| void setBodyContent(byte\[] content)           | Replaces the body content of the response. This method will also adjust the Content-Length header field to align with the length of the specified content.                                                                                                                                                                  |
