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

# Method object reference

Access the Method object in Groovy `exc?.request?.method`.

## Purpose

The Method object contains the HTTP method name from the request made to an application. The HTTP method is sent on to the site after the rules are evaluated.

## Groovy sample

```
//Retrieve the HTTP Method name and make different decisions based on the method name
def method = exc?.request?.method?.methodName
switch (method) {
     case "GET":
         println("GET")
         break;
     case "POST":
         println("POST")
         break;
     case "PUT":
         println("PUT")
         break;
     case "DELETE":
         println("DELETE")
         break;
default:
     println("DEFAULT")
     pass()
}
```

## Method summary

| Method                 | Description                                                        |
| ---------------------- | ------------------------------------------------------------------ |
| String getMethodName() | Returns the name of the HTTP method, GET, PUT, POST, DELETE, HEAD. |
