You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/12/15 19:05:07 UTC

DO NOT REPLY [Bug 32720] New: - in JellyServlet, the procedure used to determine the script's URL is too simplistic.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32720>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32720

           Summary: in JellyServlet, the procedure used to determine the
                    script's URL is too simplistic.
           Product: Commons
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jelly
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: drobert@bfm.bm


Suggestion for replacing the getScript method (based on the process used by
Freemarker); this covers many more cases...:

protected URL getScript(HttpServletRequest req)
			throws MalformedURLException {
		String scriptUrl = null;
		
		String includedPath = (String)
req.getAttribute("javax.servlet.include.servlet_path");
		if (includedPath != null) { //This is the result of a RequestDispatcher include...
			String includedPathInfo = (String)
req.getAttribute("javax.servlet.include.path_info");
			if (includedPathInfo != null) {
				scriptUrl = includedPathInfo;
			} else {
				scriptUrl = includedPath;
			}
		} else {
			scriptUrl = req.getParameter("script");
			if (scriptUrl == null) {
				scriptUrl = req.getPathInfo();
			}
			if (scriptUrl == null) {
				scriptUrl = req.getServletPath();
			}
		}
		
		URL url = getServletContext().getResource(scriptUrl);
		if (url == null) {
			throw new IllegalArgumentException("Invalid script url:"
					+ scriptUrl);
		}
		return url;
	}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org