Uploaded image for project: 'Commons Jelly'
  1. Commons Jelly
  2. JELLY-177

In JellyServlet, the procedure used to determine the script's location is too simplistic

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.0-beta-5, 1.0-RC1
    • Fix Version/s: 1.0.1
    • Component/s: core / taglib.core
    • Labels:
      None
    • Environment:

      Servlet, 1.0RC1

      Description

      In JellyServlet, the procedure used to determine the script's location is too simplistic; it misses simple cases like the a *.jelly servlet-mapping.

      I suggest replacing the getScript method with something like (taken in part from the Freemarker servlet):

      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;
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              drobert_bfm Denis Robert
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: