diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/view/JSONClientView.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/view/JSONClientView.java deleted file mode 100644 index 2cf077efc..000000000 --- a/openid-connect-server/src/main/java/org/mitre/openid/connect/view/JSONClientView.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.mitre.openid.connect.view; - -/** - * @author Michael Jett - */ - - -import java.io.IOException; -import java.io.Writer; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import org.springframework.validation.BeanPropertyBindingResult; -import org.springframework.web.servlet.view.AbstractView; - -import com.google.gson.ExclusionStrategy; -import com.google.gson.FieldAttributes; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -@Component("jsonClientView") -public class JSONClientView extends AbstractView { - - private static Logger logger = LoggerFactory.getLogger(JSONClientView.class); - - /* (non-Javadoc) - * @see org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) - */ - protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) { - - Gson gson = new GsonBuilder() - .setExclusionStrategies(new ExclusionStrategy() { - - public boolean shouldSkipField(FieldAttributes f) { - - return false; - } - - public boolean shouldSkipClass(Class clazz) { - // skip the JPA binding wrapper - if (clazz.equals(BeanPropertyBindingResult.class)) { - return true; - } - return false; - } - - }).create(); - - response.setContentType("application/json"); - - - try { - - Writer out = response.getWriter(); - Object obj = model.get("entity"); - if (obj == null) { - obj = model; - } - - gson.toJson(obj, out); - - } catch (IOException e) { - - logger.error("IOException in JSONClientView.java: ", e); - - } - } -} diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientAPI.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientAPI.java index 39a1a1eb7..d5e7fa196 100644 --- a/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientAPI.java +++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ClientAPI.java @@ -61,7 +61,7 @@ public class ClientAPI { Collection clients = clientService.getAllClients(); modelAndView.addObject("entity", clients); - modelAndView.setViewName("jsonClientView"); + modelAndView.setViewName("jsonEntityView"); return modelAndView; } @@ -98,7 +98,7 @@ public class ClientAPI { ClientDetailsEntity newClient = clientService.saveNewClient(client); m.addAttribute("entity", newClient); - return "jsonClientView"; + return "jsonEntityView"; } /** @@ -140,7 +140,7 @@ public class ClientAPI { ClientDetailsEntity newClient = clientService.updateClient(oldClient, client); m.addAttribute("entity", newClient); - return "jsonClientView"; + return "jsonEntityView"; } /** @@ -179,7 +179,7 @@ public class ClientAPI { } modelAndView.addObject("entity", client); - modelAndView.setViewName("jsonClientView"); + modelAndView.setViewName("jsonEntityView"); return modelAndView; }