From 1f53f416489eeeacf4c0d830a45f462c31eeea95 Mon Sep 17 00:00:00 2001 From: Justin Richer Date: Fri, 14 Dec 2012 17:34:47 -0500 Subject: [PATCH] generic entity view now takes optional HttpStatus argument --- .../org/mitre/openid/connect/view/JsonEntityView.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/view/JsonEntityView.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/view/JsonEntityView.java index ece47c614..c2a695a5d 100644 --- a/openid-connect-server/src/main/java/org/mitre/openid/connect/view/JsonEntityView.java +++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/view/JsonEntityView.java @@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; import org.springframework.validation.BeanPropertyBindingResult; import org.springframework.web.servlet.view.AbstractView; @@ -56,6 +57,13 @@ public class JsonEntityView extends AbstractView { response.setContentType("application/json"); + HttpStatus code = (HttpStatus) model.get("code"); + if (code == null) { + code = HttpStatus.OK; // default to 200 + } + + response.setStatus(code.value()); + try { Writer out = response.getWriter();