Uploaded image for project: 'Velocity Tools'
  1. Velocity Tools
  2. VELTOOLS-111

Suggestion to retain deprecated handleRequest

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.4, 2.0
    • 2.0
    • VelocityView
    • None

    Description

      When migrating from VelocityServlet to VelocityViewServlet, a major headache for many will be rewriting handleRequest(req, res, ctx) since it is deprecated in VelocityTools 1.4 and said to be omitted starting with 2.0. This is particularly true since prior VelocityServlet javadocs say it MUST be overridden. It is suggested to leave handleRequest as-is and non-deprecated in VelocityViewServlet.

      Apparently the idea is to separate filling the context with data based on the request (using fillContext(ctx, req)) from obtaining the template name (using getTemplate(req, res)). One difficult example is redirecting to a custom error page when the template cannot be found/loaded. This isn't known until getTemplate is called well after fillContext, so there isn't a way to put additional information into the context from inside getTemplate. Conversely fillContext can't do it all since it doesn't have access to res and doesn't return the template name. I'm not saying it can't be done, but it seems more difficult to workaround than retaining the flexibility to allow users to do it either in the combined handleRequest way or the separated fillContext/getTemplate approach.

      Attachments

        Activity

          People

            Unassigned Unassigned
            slslhale Steve Hale
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: