int idx = pathInfo.lastIndexOf('/');
pathInfo = pathInfo.substring(0, idx);
+ page = pages.get(pathInfo + "/*");
+ if (page != null) {
+ return page;
+ }
+
+ idx = pathInfo.lastIndexOf('/');
+ if (idx == -1) {
+ return null;
+ }
+ pathInfo = pathInfo.substring(0, idx);
+
page = pages.get(pathInfo + "/*");
if (page != null) {
return page;
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- int id;
+ int id = -1;
String[] idP = req.getPathInfo().split("/");
- id = Integer.parseInt(idP[idP.length - 1]);
+ try {
+ if (req.getPathInfo().endsWith("history") || req.getPathInfo().endsWith("trainings")) {
+ id = Integer.parseInt(idP[idP.length - 2]);
+ } else {
+ id = Integer.parseInt(idP[idP.length - 1]);
+ }
+ } catch (NumberFormatException e) {
+ resp.sendError(404);
+ }
final User user = User.getById(id);
String ticket = (String) req.getSession().getAttribute("ticketNo" + user.getId());
SupportUserDetailsForm f = new SupportUserDetailsForm(req, new SupportedUser(user, getUser(req), ticket));