[Lada-commits] [PATCH 1 of 2] New REST service delivering the server version
Wald Commits
scm-commit at wald.intevation.org
Wed May 20 10:14:32 CEST 2015
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1432109638 -7200
# Node ID d92abc9bcd414bfd925495699ea78feb22e43ee2
# Parent dbcb862219a968193c98ed20c821a6b1d346d595
New REST service delivering the server version.
diff -r dbcb862219a9 -r d92abc9bcd41 src/main/java/de/intevation/lada/rest/VersionService.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/intevation/lada/rest/VersionService.java Wed May 20 10:13:58 2015 +0200
@@ -0,0 +1,68 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+package de.intevation.lada.rest;
+
+import javax.enterprise.context.RequestScoped;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import de.intevation.lada.util.rest.Response;
+
+/**
+ * REST service returning the server version.
+ * <p>
+ * The services produce data in the application/json media type.
+ * A typical response holds information about the action performed and the data.
+ * <pre>
+ * <code>
+ * {
+ * "success": [boolean];
+ * "message": [string],
+ * "data":{
+ * version: [string]
+ * },
+ * "errors": [object],
+ * "warnings": [object],
+ * "readonly": [boolean],
+ * "totalCount": [number]
+ * }
+ * </code>
+ * </pre>
+ *
+ * @author <a href="mailto:rrenkert at intevation.de">Raimund Renkert</a>
+ */
+ at Path("version")
+ at RequestScoped
+public class VersionService {
+
+ private static final String VERSION = "2.0-beta2";
+
+ /**
+ * Get server Version.
+ * <p>
+ * Example: http://example.com/verison
+ *
+ * @return Response object containing all MessStelle objects.
+ */
+ @GET
+ @Path("/")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response get(
+ @Context HttpHeaders headers,
+ @Context HttpServletRequest request,
+ @Context UriInfo info
+ ) {
+ return new Response(true, 200, VERSION);
+ }
+}
More information about the Lada-commits
mailing list