Revision 10
trunk/src/java/org/lidar/api/Management.java | ||
---|---|---|
31 | 31 |
* Web service operation |
32 | 32 |
*/ |
33 | 33 |
@WebMethod() |
34 |
public String getStatus(){ |
|
35 |
String status = null; |
|
34 |
public boolean getLockStatus(String authToken){ |
|
35 |
Client c = getClient(String.format("token = '%s'", authToken)); |
|
36 |
if(c == null) return true; |
|
36 | 37 |
|
37 |
if(Management.locked){ |
|
38 |
status = "locked"; |
|
39 |
} else { |
|
40 |
status = "unlocked"; |
|
41 |
} |
|
42 |
|
|
43 |
return status; |
|
38 |
return Management.locked; |
|
44 | 39 |
} |
45 | 40 |
|
46 |
@WebMethod() |
|
47 |
public String getFood(String type){ |
|
48 |
return type; |
|
49 |
} |
|
50 |
|
|
51 | 41 |
/** |
52 | 42 |
* Client helper |
53 | 43 |
* @param where |
... | ... | |
122 | 112 |
@WebMethod |
123 | 113 |
public boolean unlock(String lockToken){ |
124 | 114 |
synchronized(lock){ |
125 |
if(!Management.locked || Management.lockToken != lockToken) return false;
|
|
115 |
if(!Management.locked || !Management.lockToken.equals(lockToken)) return false;
|
|
126 | 116 |
Management.locked = false; |
127 | 117 |
Management.lockToken = null; |
128 | 118 |
} |
trunk/web/status.jsp | ||
---|---|---|
1 | 1 |
<%@page import="org.lidar.Config"%> |
2 | 2 |
<%@page import="org.apache.commons.configuration.XMLConfiguration"%> |
3 | 3 |
<%@page import="net.sf.jpam.Pam"%> |
4 |
<%@page import="org.lidar.api.LIDAR"%>
|
|
4 |
<%@page import="org.lidar.api.Management"%>
|
|
5 | 5 |
<% |
6 | 6 |
if(session.getAttribute("authenticated") == null || |
7 | 7 |
Boolean.parseBoolean(session.getAttribute("authenticated").toString()) == false){ |
... | ... | |
9 | 9 |
} |
10 | 10 |
%> |
11 | 11 |
Authenticated as: <b><%= session.getAttribute("username") %></b> - <a href="logout.jsp">Logout</a><br/> |
12 |
Locked: <strong><%= LIDAR.locked %></strong><br/><br/>
|
|
12 |
Locked: <strong><%= Management.locked %></strong><br/><br/>
|
|
13 | 13 |
<% |
14 | 14 |
XMLConfiguration c = Config.getConfiguration(); |
15 | 15 |
%> |
Also available in: Unified diff