I tested the VelocityServlet in the whiteboard/geir and all is OK
(with my application, and as stated before, meticolous review shows
that it is compatible with original version).
+1 to check it in.
:) Christoph
"Geir Magnusson Jr." wrote:
>
> I implemented a few changes, derivative if not outright stolen from
> Christoph's ideas :), to VelocityServlet, and put it up in
> whiteboard/geir. These changes are transparent to current users - but
> encapsulate the primary parts of the servlet processing as separate
> methods so they could be overridden.
>
> They are all called from within doRequest(), have default
> implementations that behave as the current implementation, and are :
>
> protected Context createContext(HttpServletRequest request,
> HttpServletResponse response ) : to allow the servlet author to create
> and fill/wrap the context to be used in template processing
>
> protected void setContentType( HttpServletRequest request,
> HttpServletResponse response ) : sets the content type - the current
> impl just doesn't work... This gives the servlet author a change to
> examine the request, and alter the content type on a per-request basis.
>
> protected abstract Template handleRequest( Context ctx ) : as is - still
> abstract, because I think the servlet author should do *something*....
> I really detest that we don't pass the request and response directly as
> args, but have to pass them through the context....
>
> protected void mergeTemplate( Template template, Context context,
> HttpServletResponse response ) : does the merging of the template
> returned by handleRequest with the context. This hopefully shouldn't
> need to be overridden.
>
> Comments? If nothing wrong, I will check in tomorrow...
>
> geir