diff options
author | 2018-02-17 22:13:12 +0300 | |
---|---|---|
committer | 2018-02-17 22:13:12 +0300 | |
commit | dd8a51e0f342c183116d8b2af3f12394b0ac53dd (patch) | |
tree | ea88db8f0c79256f9527d1220023f2ba5d24994d /juick-server/src/main/java/com/juick/server/api/Index.java | |
parent | ae265f84efc37619411fb21d92b51183a4744478 (diff) |
server: merge xmpp
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/api/Index.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/api/Index.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/Index.java b/juick-server/src/main/java/com/juick/server/api/Index.java index dba8357d..b1d87f67 100644 --- a/juick-server/src/main/java/com/juick/server/api/Index.java +++ b/juick-server/src/main/java/com/juick/server/api/Index.java @@ -19,6 +19,8 @@ package com.juick.server.api; import com.juick.Status; import com.juick.server.WebsocketManager; +import com.juick.server.XMPPServer; +import com.juick.xmpp.helpers.XMPPStatus; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -39,16 +41,26 @@ import java.net.URI; public class Index { @Inject private WebsocketManager wsHandler; + @Inject + private XMPPServer xmpp; @RequestMapping(value = "/", method = RequestMethod.GET, headers = "Connection!=Upgrade") public ResponseEntity<Void> description() { URI redirectUri = ServletUriComponentsBuilder.fromCurrentRequestUri().path("/swagger-ui.html").build().toUri(); return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY).location(redirectUri).build(); } - @RequestMapping(value = "/api/status", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, headers = "Connection!=Upgrade") public Status status() { return Status.getStatus(String.valueOf(wsHandler.getClients().size())); } + @RequestMapping(method = RequestMethod.GET, value = "/xmpp/status", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + public XMPPStatus xmppStatus() { + XMPPStatus status = new XMPPStatus(); + if (xmpp != null) { + status.setInbound(xmpp.getInConnections()); + status.setOutbound(xmpp.getOutConnections().keySet()); + } + return status; + } } |