private void handleItemType(ItemType type, Request request, Response response) throws ActionHandlerException { if (request.getRequestParts().length > 2) { String name = request.getRequestParts()[2]; AbstractItem item = null; try { item = type.getItem(name, request.getDB()); } catch (CouldNotLoadItemException e) { throw new ActionHandlerException(e); } /* Authorization */ checkAuthorization( item, request.getUser(), Authorizer.Authorization.get(request.isRequestPost())); request.getContext().put("title", item.getDisplayName()); if (item instanceof Actionable) { actions(item, 3, request, response); } else { if (request.getRequestParts().length > 2) { throw new ActionHandlerException("No such action, " + request.getRequestURI()); } else { executeThing(request, response, item, "index"); } } } else { /* TODO, what? */ } }
public Renderer(Request request) { this.theme = request.getTheme(); // this.locale = request.getLocale(); this.context = request.getContext(); this.db = request.getDB(); }