/** * Forwards the response to the given target, which may contain parameters appended like for example <code>?a=b&c=d</code>.<p> * * Please note: If possible, use <code>{@link #forwardRequest(String, Map, HttpServletRequest, HttpServletResponse)}</code> * where the parameters are passed as a map, since the parsing of the parameters may introduce issues with encoding * and is in general much less effective.<p> * * The parsing of parameters will likely fail for "large values" (e.g. full blown web forms with <textarea> * elements etc. Use this method only if you know that the target will just contain up to 3 parameters which * are relatively short and have no encoding or line break issues.<p> * * @param target the target to forward to (may contain parameters like <code>?a=b&c=d</code>) * @param req the request to forward * @param res the response to forward * * @throws IOException in case the forwarding fails * @throws ServletException in case the forwarding fails */ public static void forwardRequest(String target, HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { // clear the current parameters CmsUriSplitter uri = new CmsUriSplitter(target); Map params = createParameterMap(uri.getQuery()); forwardRequest(uri.getPrefix(), params, req, res); }
/** * Redirects to the given page with the given parameters.<p> * * @param wp the workplace object * @param pagePath the path to the page to redirect to * @param params the parameters to send * * @throws IOException in case of errors during forwarding * @throws ServletException in case of errors during forwarding */ public void jspForwardPage(CmsWorkplace wp, String pagePath, Map<String, String[]> params) throws IOException, ServletException { Map<String, String[]> newParams = createToolParams(wp, pagePath, params); if (pagePath.indexOf("?") > 0) { pagePath = pagePath.substring(0, pagePath.indexOf("?")); } wp.setForwarded(true); // forward to the requested page uri CmsRequestUtil.forwardRequest( wp.getJsp().link(pagePath), CmsRequestUtil.createParameterMap(newParams), wp.getJsp().getRequest(), wp.getJsp().getResponse()); }
/** * Forwards the response to the given target, which may contain parameters appended like for example <code>?a=b&c=d</code>.<p> * * Please note: If possible, use <code>{@link #forwardRequest(String, Map, HttpServletRequest, HttpServletResponse)}</code> * where the parameters are passed as a map, since the parsing of the parameters may introduce issues with encoding * and is in general much less effective.<p> * * The parsing of parameters will likely fail for "large values" (e.g. full blown web forms with <textarea> * elements etc. Use this method only if you know that the target will just contain up to 3 parameters which * are relatively short and have no encoding or line break issues.<p> * * @param target the target to forward to (may contain parameters like <code>?a=b&c=d</code>) * @param req the request to forward * @param res the response to forward * * @throws IOException in case the forwarding fails * @throws ServletException in case the forwarding fails */ public static void forwardRequest(String target, HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { // clear the current parameters CmsUriSplitter uri = new CmsUriSplitter(target); Map<String, String[]> params = createParameterMap(uri.getQuery()); forwardRequest(uri.getPrefix(), params, req, res); }
/** * Redirects to the given page with the given parameters.<p> * * @param wp the workplace object * @param pagePath the path to the page to redirect to * @param params the parameters to send * * @throws IOException in case of errors during forwarding * @throws ServletException in case of errors during forwarding */ public void jspForwardPage(CmsWorkplace wp, String pagePath, Map params) throws IOException, ServletException { Map newParams = createToolParams(wp, pagePath, params); if (pagePath.indexOf("?") > 0) { pagePath = pagePath.substring(0, pagePath.indexOf("?")); } wp.setForwarded(true); // forward to the requested page uri CmsRequestUtil.forwardRequest( wp.getJsp().link(pagePath), CmsRequestUtil.createParameterMap(newParams), wp.getJsp().getRequest(), wp.getJsp().getResponse()); }
/** * Forwards to the specified location in the OpenCms VFS.<p> * * @param location the location the response is redirected to * @param params the map of parameters to use for the forwarded request * * @throws IOException in case the forward fails * @throws ServletException in case the forward fails */ public void sendForward(String location, Map params) throws IOException, ServletException { setForwarded(true); // params must be arrays of String, ensure this is the case params = CmsRequestUtil.createParameterMap(params); CmsRequestUtil.forwardRequest(getJsp().link(location), params, getJsp().getRequest(), getJsp().getResponse()); }
/** * Forwards to the specified location in the OpenCms VFS.<p> * * @param location the location the response is redirected to * @param params the map of parameters to use for the forwarded request * * @throws IOException in case the forward fails * @throws ServletException in case the forward fails */ public void sendForward(String location, Map<String, String[]> params) throws IOException, ServletException { setForwarded(true); // params must be arrays of String, ensure this is the case Map<String, String[]> parameters = CmsRequestUtil.createParameterMap(params); CmsRequestUtil.forwardRequest( getJsp().link(location), parameters, getJsp().getRequest(), getJsp().getResponse()); }
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws IOException, ServletException { if (getParamListAction().equals(LIST_ACTION_TRANSFER) || getParamListAction().equals(LIST_DEFACTION_TRANSFER)) { // execute the delete action try { Iterator it = CmsStringUtil.splitAsList(getParamUserid(), CmsHtmlList.ITEM_SEPARATOR, true).iterator(); while (it.hasNext()) { CmsUUID id = new CmsUUID((String)it.next()); getCms().deleteUser(id, new CmsUUID(getSelectedItem().getId())); } CmsRequestUtil.forwardRequest(getParamCloseLink(), getJsp().getRequest(), getJsp().getResponse()); setForwarded(true); } catch (CmsException e) { throw new CmsRuntimeException( Messages.get().container(Messages.ERR_TRANSFER_USER_1, getSelectedItem().get(LIST_COLUMN_NAME)), e); } } else { throwListUnsupportedActionException(); } listSave(); }
CmsRequestUtil.forwardRequest( getParamCloseLink(), getJsp().getRequest(),
CmsRequestUtil.forwardRequest( getParamCloseLink(), getJsp().getRequest(),
/** * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions() */ @Override public void executeListSingleActions() throws IOException, ServletException, CmsRuntimeException { if (getParamListAction().equals(LIST_DEFACTION_TRANSFER) || getParamListAction().equals(LIST_ACTION_TRANSFER)) { try { getCms().deleteGroup(new CmsUUID(getParamGroupid()), new CmsUUID(getSelectedItem().getId())); CmsRequestUtil.forwardRequest(getParamCloseLink(), getJsp().getRequest(), getJsp().getResponse()); setForwarded(true); } catch (CmsException e) { throw new CmsRuntimeException( Messages.get().container(Messages.ERR_TRANSFER_GROUP_1, getSelectedItem().get(LIST_COLUMN_NAME)), e); } } else { throwListUnsupportedActionException(); } listSave(); }
CmsRequestUtil.forwardRequest( OpenCms.getStaticExportManager().getVfsPrefix() + relPath, getRequest(),