From d73298aab6815c0967c1e6283a572be33c92df95 Mon Sep 17 00:00:00 2001 From: Rishabh Dixit Date: Fri, 4 Aug 2023 12:28:09 +0530 Subject: [PATCH] Add getStatus() to response obj Closes #22241 --- server-spi/src/main/java/org/keycloak/http/HttpResponse.java | 4 ++++ .../main/java/org/keycloak/services/HttpResponseImpl.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/server-spi/src/main/java/org/keycloak/http/HttpResponse.java b/server-spi/src/main/java/org/keycloak/http/HttpResponse.java index f5ef357079..e1b7b0b9b6 100644 --- a/server-spi/src/main/java/org/keycloak/http/HttpResponse.java +++ b/server-spi/src/main/java/org/keycloak/http/HttpResponse.java @@ -23,6 +23,10 @@ package org.keycloak.http; *

Instances of this class can be obtained from {@link org.keycloak.models.KeycloakContext#getHttpResponse}. */ public interface HttpResponse { + /** + * Gets a status code. + */ + int getStatus(); /** * Sets a status code. diff --git a/services/src/main/java/org/keycloak/services/HttpResponseImpl.java b/services/src/main/java/org/keycloak/services/HttpResponseImpl.java index 623850be9e..dfee67307e 100644 --- a/services/src/main/java/org/keycloak/services/HttpResponseImpl.java +++ b/services/src/main/java/org/keycloak/services/HttpResponseImpl.java @@ -39,6 +39,11 @@ public class HttpResponseImpl implements HttpResponse, KeycloakTransaction { session.getTransactionManager().enlistAfterCompletion(this); } + @Override + public int getStatus() { + return delegate.getStatus(); + } + @Override public void setStatus(int statusCode) { delegate.setStatus(statusCode);