package com.juick.ws.controllers; import com.juick.Status; import com.juick.ws.WebsocketComponent; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.inject.Inject; /** * Created by vitalyster on 25.07.2016. */ @RestController public class ApiController { @Inject WebsocketComponent wsHandler; @RequestMapping(value = "/api/status", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public Status status() { return Status.getStatus(String.valueOf(wsHandler.getClients().size())); } }