aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/api
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/api')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/Index.java14
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;
+ }
}