diff options
Diffstat (limited to 'catalog-fe/src/main')
-rw-r--r-- | catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java index 138318bb61..08b7c43397 100644 --- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java +++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java @@ -23,6 +23,10 @@ package org.openecomp.sdc.fe.servlets; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.fe.config.FeEcompErrorManager; import org.openecomp.sdc.fe.impl.PluginStatusBL; +import org.openecomp.sdc.fe.config.ConfigurationManager; +import org.openecomp.sdc.fe.config.WorkspaceConfiguration; +import org.openecomp.sdc.exception.NotFoundException; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,6 +49,37 @@ public class ConfigServlet extends LoggingServlet { private static final Logger LOGGER = LoggerFactory.getLogger(ConfigServlet.class.getName()); + @GET + @Path("/ui/workspace") + @Produces(MediaType.APPLICATION_JSON) + public Response getUIWorkspaceConfiguration(@Context final HttpServletRequest request) { + + try { + logFeRequest(request); + + ServletContext context = request.getSession().getServletContext(); + + ConfigurationManager configurationManager = (ConfigurationManager) context + .getAttribute(Constants.CONFIGURATION_MANAGER_ATTR); + + WorkspaceConfiguration configuration = configurationManager.getWorkspaceConfiguration(); + if (configuration == null) { + throw new NotFoundException(WorkspaceConfiguration.class.getSimpleName()); + } + LOGGER.info("The value returned from getConfig is {}", configuration); + String result = gson.toJson(configuration); + Response response = Response.status(Status.OK).entity(result).build(); + logFeResponse(request, response); + + return response; + } catch (Exception e) { + FeEcompErrorManager.getInstance().logFeHttpLoggingError("FE Response"); + LOGGER.error("Unexpected FE response logging error :", e); + return Response.status(Status.INTERNAL_SERVER_ERROR).entity("{}").build(); + } + + } + @GET @Path("/ui/plugins") |