-
-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathSessionService.java
More file actions
53 lines (43 loc) · 1.7 KB
/
SessionService.java
File metadata and controls
53 lines (43 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package org.jivesoftware.openfire.plugin.rest.service;
import javax.annotation.PostConstruct;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.jivesoftware.openfire.plugin.rest.controller.SessionController;
import org.jivesoftware.openfire.plugin.rest.entity.SessionEntities;
import org.jivesoftware.openfire.plugin.rest.exceptions.ServiceException;
@Path("restapi/v1/sessions")
public class SessionService {
private SessionController sessionController;
@PostConstruct
public void init() {
sessionController = SessionController.getInstance();
}
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public SessionEntities getAllSessions() throws ServiceException {
return sessionController.getAllSessions();
}
@GET
@Path("/load")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public SessionEntities getAllSessionsLoad() throws ServiceException {
return sessionController.getAllSessionsLoad();
}
@GET
@Path("/{username}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public SessionEntities getUserSessions(@PathParam("username") String username) throws ServiceException {
return sessionController.getUserSessions(username);
}
@DELETE
@Path("/{username}")
public Response kickSession(@PathParam("username") String username) throws ServiceException {
sessionController.removeUserSessions(username);
return Response.status(Response.Status.OK).build();
}
}