commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32720] New: - in JellyServlet, the procedure used to determine the script's URL is too simplistic.
Date Wed, 15 Dec 2004 18:05:07 GMT
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


Mime
View raw message