package org.jboss.aerogear.unifiedpush.rest;

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 com.datastax.driver.core.utils.UUIDs;
import com.qmino.miredot.annotations.ReturnType;

@Path("/hartbeat")
public class HartbeatEndpoint extends AbstractBaseEndpoint {
	/**
	 * Hartbeat Endpoint
	 *
	 * @return Hartbeat in form of time-based UUID.
	 * @statuscode 200 Successful response for your request
	 */
	@GET
	@Produces(MediaType.APPLICATION_JSON)
	@ReturnType("java.lang.String")
	public Response hartbeat(@Context HttpServletRequest request) {
		return appendAllowOriginHeader(Response.ok().entity(quote(UUIDs.timeBased().toString())), request);
	}
}

@@ -109,16 +109,44 @@
 rs.GET;%0A
+import javax.ws.rs.OPTIONS;%0A
 import j
@@ -162,16 +162,16 @@
 s.Path;%0A
-
 import j
@@ -224,16 +224,53 @@
 ontext;%0A
+import javax.ws.rs.core.HttpHeaders;%0A
 import j
@@ -445,16 +445,16 @@
 tbeat%22)%0A
-
 public c
@@ -506,16 +506,210 @@
 point %7B%0A
+%0A%09@OPTIONS%0A%09@ReturnType(%22java.lang.Void%22)%0A%09public Response crossOriginForApplication(@Context HttpHeaders headers) %7B%0A%09%09return appendPreflightResponseHeaders(headers, Response.ok()).build();%0A%09%7D%0A%0A
 %09/**%0A%09 *

Add OPTIONS to hartbeat API