[opencms-dev] External link: redirecting parameters to target page - SOLUTION

Martin Bednář bednar at triax.cz
Sat Jan 22 02:17:27 CET 2005


This patch allows redirect parameters pointed to resource defined in 
workspace as External link, to target page.

OpenCMS 6.0 alpha 3

Class:org.opencms.loader.CmsPointerLoader

    /**
     * @see 
org.opencms.loader.I_CmsResourceLoader#load(org.opencms.file.CmsObject,
     *      org.opencms.file.CmsResource, 
javax.servlet.http.HttpServletRequest,
     *      javax.servlet.http.HttpServletResponse)
     */
    public void load(CmsObject cms, CmsResource resource,
            HttpServletRequest req, HttpServletResponse res)
            throws IOException, CmsException {
        String pointer = new String(CmsFile.upgrade(resource, cms)
                .getContents());
        if (pointer == null || "".equals(pointer.trim())) {
            throw new CmsLoaderException("Invalid pointer file "
                    + resource.getName());
        }
*        res.sendRedirect(pointer + appendRequestParameters(req));*
    }

*    /**
     * @param req
     * @return
     */
    private String appendRequestParameters(HttpServletRequest req) {
        StringBuffer sb = new StringBuffer();
        Enumeration e = req.getParameterNames();
        if (e.hasMoreElements()) {
            sb.append("?");
        }
        while (e.hasMoreElements()) {
            String paramName = (String) e.nextElement();
            String paramValue = req.getParameter(paramName);

            sb.append(paramName).append("=").append(paramValue);
            if (e.hasMoreElements()) {
                sb.append("&");
            }
        }
        return sb.toString();
    }
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050122/66978feb/attachment.htm>


More information about the opencms-dev mailing list