/** * Respond to a request by dispatching to a portlet like "do" method based on the portlet mode and tool mode */ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException { doGet(req, res); } // doPost
/** * Add some standard references to the vm context. * * @param request * The render request. * @param response * The render response. */ protected void setVmStdRef(HttpServletRequest request, HttpServletResponse response) { super.setVmStdRef(request, response); // add the tool mode setVmReference("sakai_toolMode", getToolMode(request), request); // add alert setVmReference("sakai_alert", getAlert(request), request); // add menu setVmReference("sakai_menu", getMenu(request), request); } // setVmStdRef
/** * Set the tool mode. * * @param toolMode * The new tool mode. * @param req * The portlet request. */ protected void setToolMode(String toolMode, HttpServletRequest req) { // update the attribute in session state getState(req).setAttribute(TOOL_MODE_ATTR, toolMode); } // setToolMode
if (sendToHelper(req, res, req.getPathInfo())) prepState(req, res); processAction(req, res); toolModeDispatch("doView", getToolMode(req), req, res);
SessionState state = getState(req); initState(state, req, res); updateState(state, req, res);
/** * Initialize for the first time the session state for this session. If overridden in a sub-class, make sure to call super. * * @param state * The session state. * @param req * The current portlet request. * @param res * The current portlet response. */ protected void initState(SessionState state, HttpServletRequest req, HttpServletResponse res) { super.initState(state, req, res); // call the old initState: VelocityPortlet portlet = (VelocityPortlet) req.getAttribute(ATTR_PORTLET); JetspeedRunData rundata = (JetspeedRunData) req.getAttribute(ATTR_RUNDATA); initState(state, portlet, rundata); } // initState
/** * Access the SessionState for the current request. Note: this is scoped only for the current request. * * @param req * The current portlet request. * @return The SessionState objet for the current request. */ protected SessionState getState(HttpServletRequest req) { // key the state based on the pid, if present. If not we will use the servlet's class name String key = getPid(req); if (key == null) { key = this.toString() + "."; log.warn("getState(): using servlet key: " + key); } SessionState rv = UsageSessionService.getSessionState(key); if (rv == null) { log.warn("getState(): no state found for key: " + key + " " + req.getPathInfo() + " " + req.getQueryString() + " " + req.getRequestURI()); } return rv; }
/** * Process a Portlet action. */ @SuppressWarnings("unchecked") protected void processAction(HttpServletRequest req, HttpServletResponse res) { // see if there's an action parameter, whose value has the action to use String action = ((ParameterParser) req.getAttribute(ATTR_PARAMS)).getString(PARAM_ACTION); // if that's not present, see if there's a combination name with the action encoded in the name if (action == null) { Enumeration<String> names = req.getParameterNames(); while (names.hasMoreElements()) { String name = names.nextElement(); if (name.startsWith(PARAM_ACTION_COMBO)) { action = name.substring(PARAM_ACTION_COMBO.length()); break; } } } // process the action if present if (action != null) { actionDispatch("processAction", action, req, res); } } // processAction
getServletContext().log("Exception calling method " + methodName + " " + e); getServletContext().log("Exception calling method " + methodName + " " + e); getServletContext().log("Exception calling method " + methodName + " " + e + xtra);
if (sendToHelper(req, res, req.getPathInfo())) prepState(req, res); processAction(req, res); toolModeDispatch("doView", getToolMode(req), req, res);
SessionState state = getState(req); initState(state, req, res); updateState(state, req, res);
/** * Initialize for the first time the session state for this session. If overridden in a sub-class, make sure to call super. * * @param state * The session state. * @param req * The current portlet request. * @param res * The current portlet response. */ protected void initState(SessionState state, HttpServletRequest req, HttpServletResponse res) { super.initState(state, req, res); // call the old initState: VelocityPortlet portlet = (VelocityPortlet) req.getAttribute(ATTR_PORTLET); JetspeedRunData rundata = (JetspeedRunData) req.getAttribute(ATTR_RUNDATA); initState(state, portlet, rundata); } // initState
/** * Access the SessionState for the current request. Note: this is scoped only for the current request. * * @param req * The current portlet request. * @return The SessionState objet for the current request. */ protected SessionState getState(HttpServletRequest req) { // key the state based on the pid, if present. If not we will use the servlet's class name String key = getPid(req); if (key == null) { key = this.toString() + "."; log.warn("getState(): using servlet key: " + key); } SessionState rv = UsageSessionService.getSessionState(key); if (rv == null) { log.warn("getState(): no state found for key: " + key + " " + req.getPathInfo() + " " + req.getQueryString() + " " + req.getRequestURI()); } return rv; }
/** * Process a Portlet action. */ @SuppressWarnings("unchecked") protected void processAction(HttpServletRequest req, HttpServletResponse res) { // see if there's an action parameter, whose value has the action to use String action = ((ParameterParser) req.getAttribute(ATTR_PARAMS)).getString(PARAM_ACTION); // if that's not present, see if there's a combination name with the action encoded in the name if (action == null) { Enumeration<String> names = req.getParameterNames(); while (names.hasMoreElements()) { String name = names.nextElement(); if (name.startsWith(PARAM_ACTION_COMBO)) { action = name.substring(PARAM_ACTION_COMBO.length()); break; } } } // process the action if present if (action != null) { actionDispatch("processAction", action, req, res); } } // processAction
getServletContext().log("Exception calling method " + methodName + " " + e); getServletContext().log("Exception calling method " + methodName + " " + e); getServletContext().log("Exception calling method " + methodName + " " + e + xtra);
/** * Add some standard references to the vm context. * * @param request * The render request. * @param response * The render response. */ protected void setVmStdRef(HttpServletRequest request, HttpServletResponse response) { super.setVmStdRef(request, response); // add the tool mode setVmReference("sakai_toolMode", getToolMode(request), request); // add alert setVmReference("sakai_alert", getAlert(request), request); // add menu setVmReference("sakai_menu", getMenu(request), request); } // setVmStdRef
/** * Set the tool mode. * * @param toolMode * The new tool mode. * @param req * The portlet request. */ protected void setToolMode(String toolMode, HttpServletRequest req) { // update the attribute in session state getState(req).setAttribute(TOOL_MODE_ATTR, toolMode); } // setToolMode
/** * Respond to a request by dispatching to a portlet like "do" method based on the portlet mode and tool mode */ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException { doGet(req, res); } // doPost
/** * Access the tool mode for the current Portlet mode. * * @return the tool mode for the current Portlet mode. * @param req * The portlet request. */ protected String getToolMode(HttpServletRequest req) { String toolMode = (String) getState(req).getAttribute(TOOL_MODE_ATTR); // use the default mode if nothing set if (toolMode == null) { toolMode = TOOL_MODE_DEFAULT; } return toolMode; } // getToolMode
/** * Respond to a request by dispatching to a portlet like "do" method based on the portlet mode and tool mode */ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException { // set in VmServlet ParameterParser params = (ParameterParser) req.getAttribute(ATTR_PARAMS); // we will need some covers... Note: parameters are parsed (i.e. files are read) here Context context = new Context(this, req); Placement placement = ToolManager.getCurrentPlacement(); PortletConfig config = new PortletConfig(getServletConfig(), placement.getPlacementConfig(), placement.getTool() .getRegisteredConfig(), placement); VelocityPortlet portlet = new VelocityPortlet(getPid(req), config); JetspeedRunData rundata = new JetspeedRunData(req, getState(req), getPid(req), params); req.setAttribute(ATTR_CONTEXT, context); req.setAttribute(ATTR_CONFIG, config); req.setAttribute(ATTR_PORTLET, portlet); req.setAttribute(ATTR_RUNDATA, rundata); super.doGet(req, res); }