This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See http://git.codelutin.com/observe.git commit 3ab84e280961407448cef8159338940cbf6c1072 Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Nov 8 17:54:47 2015 +0100 Ajout d'une page avec toute le configuration api/v1/configuration/home --- .../web/controller/v1/ConfigurationController.java | 48 +++++++++++++--------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/ConfigurationController.java b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/ConfigurationController.java index 73bfdca..765b4d2 100644 --- a/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/ConfigurationController.java +++ b/observe-application-web/src/main/java/fr/ird/observe/application/web/controller/v1/ConfigurationController.java @@ -32,7 +32,7 @@ import fr.ird.observe.application.web.security.ObserveWebSecurityApplicationCont import fr.ird.observe.services.configuration.ObserveDataSourceConfigurationAndConnection; import org.apache.commons.io.IOUtils; import org.debux.webmotion.server.WebMotionContextable; -import org.debux.webmotion.server.render.Render; +import org.debux.webmotion.server.render.RenderContent; import java.io.IOException; import java.io.InputStream; @@ -52,31 +52,41 @@ public class ConfigurationController extends ObserveWebMotionController { getRequestContext().checkAdminApiKeyIsValid(); } - public Render mapping() { + public RenderContent mapping() throws IOException { - InputStream mappingUrl = getClass().getResourceAsStream("/mapping"); - - try { + try (InputStream mappingUrl = getClass().getResourceAsStream("/mapping")) { String content = IOUtils.toString(mappingUrl); - return renderContent(content, "text/plain"); + return toTextPlain(content); - } catch (IOException e) { + } - throw new RuntimeException(e); + } - } + protected RenderContent toTextPlain(String content) { + return (RenderContent) renderContent(content, "text/plain"); + } + + public RenderContent home() throws IOException { + + String content = "\n~~~ Mapping ~~~\n" + mapping().getContent() + + "\n~~~ Configuration ~~~\n" + configuration().getContent() + + "\n~~~ Databases ~~~\n" + databases().getContent() + + "\n~~~ Users ~~~\n" + users().getContent() + + "\n~~~ AuthenticationTokens ~~~\n" + showAuthenticationTokens().getContent(); + + return toTextPlain(content); } - public Render configuration() { + public RenderContent configuration() { String content = getApplicationConfiguration().getConfigurationDescription(); - return renderContent(content, "text/plain"); + return toTextPlain(content); } - public Render databases() throws IOException { + public RenderContent databases() throws IOException { String content; try (StringWriter writer = new StringWriter()) { @@ -89,11 +99,11 @@ public class ConfigurationController extends ObserveWebMotionController { content = writer.toString(); } - return renderContent(content, "text/plain"); + return toTextPlain(content); } - public Render users() throws IOException { + public RenderContent users() throws IOException { String content; try (StringWriter writer = new StringWriter()) { @@ -106,11 +116,11 @@ public class ConfigurationController extends ObserveWebMotionController { content = writer.toString(); } - return renderContent(content, "text/plain"); + return toTextPlain(content); } - public Render showAuthenticationTokens() { + public RenderContent showAuthenticationTokens() { ObserveWebSecurityApplicationContext securityApplicationContext = getSecurityApplicationContext(); @@ -121,11 +131,11 @@ public class ConfigurationController extends ObserveWebMotionController { for (Map.Entry<String, ObserveDataSourceConfigurationAndConnection> entry : cache.entrySet()) { builder.append("\n").append(entry.getKey()).append(" - ").append(entry.getValue().getConfiguration()); } - return renderContent(builder.toString(), "text/plain"); + return toTextPlain(builder.toString()); } - public Render resetAuthenticationTokens() { + public RenderContent resetAuthenticationTokens() { ObserveWebSecurityApplicationContext securityApplicationContext = getSecurityApplicationContext(); @@ -141,7 +151,7 @@ public class ConfigurationController extends ObserveWebMotionController { securityApplicationContext.invalidateAuthenticationToken(authenticationToken); } - return renderContent(builder.toString(), "text/plain"); + return toTextPlain(builder.toString()); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@list.forge.codelutin.com>.