/*
 * Copyright 2015 Robert von Burg <eitch@eitchnet.ch>
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package li.strolch.rest.endpoint;

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.MediaType;
import javax.ws.rs.core.Response;

import li.strolch.agent.api.VersionQueryResult;
import li.strolch.privilege.model.Certificate;
import li.strolch.rest.RestfulStrolchComponent;
import li.strolch.rest.StrolchRestfulConstants;

/**
 * @author Robert von Burg <eitch@eitchnet.ch>
 */
@Path("strolch/version")
public class VersionQuery {

	@GET
	@Produces(MediaType.APPLICATION_JSON)
	public Response getVersions(@Context HttpServletRequest request) {

		Certificate cert = (Certificate) request.getAttribute(StrolchRestfulConstants.STROLCH_CERTIFICATE);
		RestfulStrolchComponent instance = RestfulStrolchComponent.getInstance();
		instance.getSessionHandler().validate(cert);

		VersionQueryResult versionQueryResult = instance.getContainer().getAgent().getVersion();
		return Response.ok(versionQueryResult.toJson().toString(), MediaType.APPLICATION_JSON).build();
	}
}

@@ -52,18 +52,17 @@
 t.ch%3E%0A *
- 
 %0A
+
  * Licen
@@ -233,17 +233,16 @@
 se at%0A *
- 
 %0A *     
@@ -286,17 +286,16 @@
 E-2.0%0A *
- 
 %0A * Unle
@@ -906,169 +906,122 @@
 api.
-VersionQueryResult;%0Aimport li.strolch.privilege.model.Certificate;%0Aimport li.strolch.rest.RestfulStrolchComponent;%0Aimport li.strolch.rest.StrolchRestfulConstants
+ComponentContainer;%0Aimport li.strolch.agent.api.VersionQueryResult;%0Aimport li.strolch.rest.RestfulStrolchComponent
 ;%0A%0A/
@@ -1249,141 +1249,35 @@
 %0A%09%09C
-ertificate cert = (Certificate) request.getAttribute(StrolchRestful
+omponent
 Con
-s
 ta
-nts.STROLCH_CERTIFICATE);%0A%09%09RestfulStrolchComponent 
+iner conta
 in
-stanc
 e
+r
  = R
@@ -1316,57 +1316,24 @@
 ce()
-;%0A%09%09instance.getSessionHandler().validate(cert);%0A
+.getContainer();
 %0A%09%09V
@@ -1375,29 +1375,17 @@
 t = 
-instance.getC
+c
 ontainer
 ().g
@@ -1380,18 +1380,16 @@
 ontainer
-()
 .getAgen

Allow to call VersionQuery REST API without certificate...