return page;
}
int idx = pathInfo.lastIndexOf('/');
- pathInfo = pathInfo.substring(0, idx);
- page = pages.get(pathInfo + "/*");
+ page = pages.get(pathInfo.substring(0, idx) + "/*");
if (page != null) {
return page;
}
- idx = pathInfo.lastIndexOf('/');
- if (idx == -1) {
+ int lIdx = pathInfo.lastIndexOf('/', idx);
+ if (lIdx == -1) {
return null;
}
- pathInfo = pathInfo.substring(0, idx);
-
- page = pages.get(pathInfo + "/*");
- if (page != null) {
- return page;
- }
- return null;
+ page = pages.get(pathInfo.substring(0, lIdx) + "/" + pathInfo.substring(idx));
+ return page;
}
int id = -1;
String[] idP = req.getPathInfo().split("/");
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]);
- }
+ id = Integer.parseInt(idP[idP.length - 1]);
} catch (NumberFormatException e) {
resp.sendError(404);
}