Revision 3ee27ba6 src/gr/ebs/gss/server/rest/UserSearchHandler.java
b/src/gr/ebs/gss/server/rest/UserSearchHandler.java | ||
---|---|---|
71 | 71 |
try { |
72 | 72 |
JSONArray json = new JSONArray(); |
73 | 73 |
|
74 |
if (mustEndWithAt && !path.endsWith("@"))
|
|
74 |
if (mustEndWithAt && !path.endsWith("@") && !path.contains("@")){
|
|
75 | 75 |
path += '@'; |
76 |
List<UserDTO> users = getService().getUsersByUserNameLike(path.substring(1)); |
|
77 |
for (UserDTO u: users) { |
|
78 |
// Build the proper parent URL |
|
79 |
String pathInfo = req.getPathInfo(); |
|
76 |
List<UserDTO> users = getService().getUsersByUserNameLike(path.substring(1)); |
|
77 |
for (UserDTO u: users) { |
|
78 |
// Build the proper parent URL |
|
79 |
String pathInfo = req.getPathInfo(); |
|
80 |
String parentUrl = contextPath.replaceFirst(pathInfo, ""); |
|
81 |
JSONObject j = new JSONObject(); |
|
82 |
j.put("username", u.getUsername()).put("name", u.getName()). |
|
83 |
put("uri", parentUrl + "/" + u.getUsername()); |
|
84 |
json.put(j); |
|
85 |
} |
|
86 |
}else if(path.contains("@")){ |
|
87 |
path = path.substring(1,path.length()); |
|
88 |
UserDTO user = getService().getUserByUserName(path); |
|
89 |
String pathInfo = req.getPathInfo(); |
|
80 | 90 |
String parentUrl = contextPath.replaceFirst(pathInfo, ""); |
81 | 91 |
JSONObject j = new JSONObject(); |
82 |
j.put("username", u.getUsername()).put("name", u.getName()). |
|
83 |
put("uri", parentUrl + "/" + u.getUsername()); |
|
92 |
j.put("username", user.getUsername()) |
|
93 |
.put("name", user.getName()) |
|
94 |
.put("uri", parentUrl + "/" + user.getUsername()); |
|
84 | 95 |
json.put(j); |
85 |
}
|
|
96 |
}
|
|
86 | 97 |
sendJson(req, resp, json.toString()); |
87 | 98 |
// Workaround for IE's broken caching behavior. |
88 | 99 |
resp.setHeader("Expires", "-1"); |
Also available in: Unified diff