[java-opensaml] branch main updated: Add ensure getters for servlet request/response.

Scott Cantor cantor.2 at osu.edu
Thu Jun 15 19:49:07 UTC 2023


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=0d8827c1a9b1b1a578c41518c4afa4d50675ec20

The following commit(s) were added to refs/heads/main by this push:
     new 0d8827c1a Add ensure getters for servlet request/response.
0d8827c1a is described below

commit 0d8827c1a9b1b1a578c41518c4afa4d50675ec20
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Jun 15 15:49:04 2023 -0400

    Add ensure getters for servlet request/response.
---
 .../profile/action/AbstractProfileAction.java      | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractProfileAction.java b/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractProfileAction.java
index 0d2baef9c..4329f5909 100644
--- a/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractProfileAction.java
+++ b/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractProfileAction.java
@@ -65,6 +65,21 @@ public abstract class AbstractProfileAction extends AbstractInitializableCompone
         
         return null;
     }
+    
+    /**
+     * Get the current HTTP request if available, raising an {@link IllegalStateException} if absent.
+     * 
+     * @return current HTTP request
+     * 
+     * @since 5.0.0
+     */
+    @Nonnull public HttpServletRequest ensureHttpServletRequest() {
+        final HttpServletRequest ret = getHttpServletRequest();
+        if (ret != null) {
+            return ret;
+        }
+        throw new IllegalStateException("HttpServletRequest was absent");
+    }
 
     /**
      * Get the supplier for  HTTP request if available.
@@ -97,6 +112,22 @@ public abstract class AbstractProfileAction extends AbstractInitializableCompone
         
         return null;
     }
+    
+    /**
+     * Get the current HTTP response if available, raising an {@link IllegalStateException} if absent.
+     * 
+     * @return current HTTP response
+     * 
+     * @since 5.0.0
+     */
+    @Nonnull public HttpServletResponse ensureHttpServletResponse() {
+        final HttpServletResponse ret = getHttpServletResponse();
+        if (ret != null) {
+            return ret;
+        }
+        
+        throw new IllegalStateException("HttpServletResponse was absent");
+    }
 
     /**
      * Get the current HTTP response supplier if available.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list